< prev index next >

src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java

Print this page
rev 47855 : 8189102: All tools should support -?, -h and --help

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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

@@ -92,18 +92,22 @@
      *      exit code. 0 if success.
      *
      */
     public static int run(String[] args, ClassLoader classLoader) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
         final Options options = new Options();
-        if (args.length ==0) {
+        if (args.length == 0) {
             usage();
             return -1;
         }
         for (String arg : args) {
-            if (arg.equals("-help")) {
+            if (arg.equals("-?") ||
+                arg.equals("-h") ||
+                arg.equals("--help") ||
+                // -help: legacy. Undocumented.
+                arg.equals("-help")) {
                 usage();
-                return -1;
+                return 0;
             }
 
             if (arg.equals("-version")) {
                 System.out.println(Messages.VERSION.format());
                 return -1;
< prev index next >