< prev index next >
src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java
Print this page
@@ -1,7 +1,7 @@
/*
- * 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -55,10 +55,13 @@
* CLI entry-point to the schema generator.
*
* @author Bhakti Mehta
*/
public class SchemaGenerator {
+
+ private static final Logger LOGGER = Logger.getLogger(SchemaGenerator.class.getName());
+
/**
* Runs the schema generator.
*/
public static void main(String[] args) throws Exception {
System.exit(run(args));
@@ -70,11 +73,11 @@
if (cl==null) {
cl = SecureLoader.getSystemClassLoader();
}
return run(args, cl);
} catch(Exception e) {
- System.err.println(e.getMessage());
+ LOGGER.log(Level.SEVERE, e.getMessage(), e);
return -1;
}
}
/**
@@ -204,13 +207,13 @@
f = new File(new URL(jarFileUrl).getFile());
if (f.exists() && f.getName().endsWith(".jar")) { // this is here for potential backw. compatibility issues
return f.getPath();
}
} catch (URISyntaxException ex) {
- Logger.getLogger(SchemaGenerator.class.getName()).log(Level.SEVERE, null, ex);
+ LOGGER.log(Level.SEVERE, ex.getMessage(), ex);
} catch (MalformedURLException ex) {
- Logger.getLogger(SchemaGenerator.class.getName()).log(Level.SEVERE, null, ex);
+ LOGGER.log(Level.SEVERE, ex.getMessage(), ex);
}
return null;
}
private static void usage( ) {
@@ -223,12 +226,13 @@
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();
StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null);
JavacOptions options = JavacOptions.parse(compiler, fileManager, args);
List<String> unrecognizedOptions = options.getUnrecognizedOptions();
- if (!unrecognizedOptions.isEmpty())
- Logger.getLogger(SchemaGenerator.class.getName()).log(Level.WARNING, "Unrecognized options found: {0}", unrecognizedOptions);
+ if (!unrecognizedOptions.isEmpty()) {
+ LOGGER.log(Level.WARNING, "Unrecognized options found: {0}", unrecognizedOptions);
+ }
Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromFiles(options.getFiles());
JavaCompiler.CompilationTask task = compiler.getTask(
null,
fileManager,
diagnostics,
< prev index next >