Repository: cxf Updated Branches: refs/heads/3.0.x-fixes 9ba83efa2 -> 90b555a05
[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/90b555a0 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/90b555a0 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/90b555a0 Branch: refs/heads/3.0.x-fixes Commit: 90b555a0583e7d3ab2cd882fc7bb687edd16a70a Parents: 9ba83ef Author: Sergey Beryozkin <[email protected]> Authored: Wed Jun 8 11:19:43 2016 +0100 Committer: Sergey Beryozkin <[email protected]> Committed: Wed Jun 8 11:21:25 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/90b555a0/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));
