support newer JDKs
Project: http://git-wip-us.apache.org/repos/asf/incubator-wave/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-wave/commit/3077484d Tree: http://git-wip-us.apache.org/repos/asf/incubator-wave/tree/3077484d Diff: http://git-wip-us.apache.org/repos/asf/incubator-wave/diff/3077484d Branch: refs/heads/master Commit: 3077484def8badb73c166c7081f2c46712359e2b Parents: 2c075c6 Author: Andreas 'count' Kotes <[email protected]> Authored: Tue Feb 2 17:09:24 2016 +0100 Committer: Andreas 'count' Kotes <[email protected]> Committed: Tue Feb 2 17:09:24 2016 +0100 ---------------------------------------------------------------------- .../main/java/org/apache/wave/pst/PstFileDescriptor.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/3077484d/pst/src/main/java/org/apache/wave/pst/PstFileDescriptor.java ---------------------------------------------------------------------- diff --git a/pst/src/main/java/org/apache/wave/pst/PstFileDescriptor.java b/pst/src/main/java/org/apache/wave/pst/PstFileDescriptor.java index 7dafc70..abdc544 100644 --- a/pst/src/main/java/org/apache/wave/pst/PstFileDescriptor.java +++ b/pst/src/main/java/org/apache/wave/pst/PstFileDescriptor.java @@ -155,7 +155,14 @@ public final class PstFileDescriptor { return null; } else { // Compiled the file! Now to determine where javac put it. - Pattern pattern = Pattern.compile("\\[wrote ([^\\]]*)\\]"); + Pattern pattern; + if (Integer.parseInt(System.getProperty("java.version").split("\\.")[1]) <= 6) { + // JDK 6 or lower + pattern = Pattern.compile("\\[wrote ([^\\]]*)\\]"); + } else { + // JDK 7 or higher + pattern = Pattern.compile("\\[wrote RegularFileObject\\[([^\\]]*)\\]\\]"); + } String pathToClass = null; for (String line : stdErr) { Matcher lineMatcher = pattern.matcher(line);
