Repository: cxf Updated Branches: refs/heads/master a51f6d96a -> 53d3867cd
[CXF-6935] Better error message than NPE in Compiler.useJava6Compiler, patch from Gary Gregory applied with thanks Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/53d3867c Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/53d3867c Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/53d3867c Branch: refs/heads/master Commit: 53d3867cd7135f8c34f8b570c9812c214c6a22fa Parents: a51f6d9 Author: Sergey Beryozkin <[email protected]> Authored: Wed Jun 8 11:19:43 2016 +0100 Committer: Sergey Beryozkin <[email protected]> Committed: Wed Jun 8 11:19:43 2016 +0100 ---------------------------------------------------------------------- core/src/main/java/org/apache/cxf/common/util/Compiler.java | 4 ++++ 1 file changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/53d3867c/core/src/main/java/org/apache/cxf/common/util/Compiler.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/cxf/common/util/Compiler.java b/core/src/main/java/org/apache/cxf/common/util/Compiler.java index e0247d8..8d9fcaa 100644 --- a/core/src/main/java/org/apache/cxf/common/util/Compiler.java +++ b/core/src/main/java/org/apache/cxf/common/util/Compiler.java @@ -184,6 +184,10 @@ public class Compiler { protected boolean useJava6Compiler(String[] files) { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + if (compiler == null) { + throw new IllegalStateException( + "No compiler detected, make sure you are running on top of a JDK instead of a JRE."); + } StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null); Iterable<? extends JavaFileObject> fileList = fileManager.getJavaFileObjectsFromStrings(Arrays .asList(files));
