jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wscompile/WsgenTool.java
changeset 27837 86d4f46e622a
parent 25871 b80b84e87032
child 37844 339503342184
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wscompile/WsgenTool.java	Wed Jul 05 20:08:43 2017 +0200
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wscompile/WsgenTool.java	Tue Dec 02 15:03:49 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,7 +69,6 @@
 import java.io.PrintStream;
 import java.net.URLClassLoader;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -187,7 +186,11 @@
             args.addAll(options.getJavacOptions(args, listener));
         }
 
-        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();//        compiler = JavacTool.create();
+        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        if (compiler == null) {
+            out.println(WscompileMessages.WSCOMPILE_CANT_GET_COMPILER(property("java.home"), property("java.version"), property("java.vendor")));
+            return false;
+        }
         DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();
         StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null);
         JavaCompiler.CompilationTask task = compiler.getTask(
@@ -305,6 +308,15 @@
         return true;
     }
 
+    private String property(String key) {
+        try {
+            String property = System.getProperty(key);
+            return property != null ? property : "UNKNOWN";
+        } catch (SecurityException ignored) {
+            return "UNKNOWN";
+        }
+    }
+
     private List<File> getExternalFiles(List<String> exts) {
         List<File> files = new ArrayList<File>();
         for (String ext : exts) {