< prev index next >

src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wscompile/Options.java

Print this page
rev 47855 : 8189102: All tools should support -?, -h and --help
   1 /*
   2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 329                 throw new BadCommandLineException(WscompileMessages.WSIMPORT_ILLEGAL_TARGET_VERSION(token));
 330             return 2;
 331         } else if (args[i].equals("-classpath") || args[i].equals("-cp")) {
 332             classpath = requireArgument("-classpath", args, ++i) + File.pathSeparator + System.getProperty("java.class.path");
 333             return 2;
 334         } else if (args[i].equals("-d")) {
 335             destDir = new File(requireArgument("-d", args, ++i));
 336             if (!destDir.exists())
 337                 throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(destDir.getPath()));
 338             return 2;
 339         } else if (args[i].equals("-s")) {
 340             sourceDir = new File(requireArgument("-s", args, ++i));
 341             keep = true;
 342             if (!sourceDir.exists()) {
 343                 throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(sourceDir.getPath()));
 344             }
 345             return 2;
 346         } else if (args[i].equals("-extension")) {
 347             compatibilityMode = EXTENSION;
 348             return 1;
 349         } else if (args[i].startsWith("-help")) {




 350             WeAreDone done = new WeAreDone();
 351             done.initOptions(this);
 352             throw done;
 353         } else if (args[i].equals("-Xnocompile")) {
 354             // -nocompile implies -keep. this is undocumented switch.
 355             nocompile = true;
 356             keep = true;
 357             return 1;
 358         } else if (args[i].equals("-encoding")) {
 359             encoding = requireArgument("-encoding", args, ++i);
 360             try {
 361                 if (!Charset.isSupported(encoding)) {
 362                     throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
 363                 }
 364             } catch (IllegalCharsetNameException icne) {
 365                 throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
 366             }
 367             return 2;
 368         } else if (args[i].equals("-disableXmlSecurity")) {
 369             disableXmlSecurity();


   1 /*
   2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 329                 throw new BadCommandLineException(WscompileMessages.WSIMPORT_ILLEGAL_TARGET_VERSION(token));
 330             return 2;
 331         } else if (args[i].equals("-classpath") || args[i].equals("-cp")) {
 332             classpath = requireArgument("-classpath", args, ++i) + File.pathSeparator + System.getProperty("java.class.path");
 333             return 2;
 334         } else if (args[i].equals("-d")) {
 335             destDir = new File(requireArgument("-d", args, ++i));
 336             if (!destDir.exists())
 337                 throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(destDir.getPath()));
 338             return 2;
 339         } else if (args[i].equals("-s")) {
 340             sourceDir = new File(requireArgument("-s", args, ++i));
 341             keep = true;
 342             if (!sourceDir.exists()) {
 343                 throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(sourceDir.getPath()));
 344             }
 345             return 2;
 346         } else if (args[i].equals("-extension")) {
 347             compatibilityMode = EXTENSION;
 348             return 1;
 349         } else if (args[i].startsWith("-?") ||
 350                    args[i].startsWith("-h") ||
 351                    args[i].startsWith("--help") ||
 352                    // -help: legacy. Undocumented.
 353                    args[i].startsWith("-help")) {
 354             WeAreDone done = new WeAreDone();
 355             done.initOptions(this);
 356             throw done;
 357         } else if (args[i].equals("-Xnocompile")) {
 358             // -nocompile implies -keep. this is undocumented switch.
 359             nocompile = true;
 360             keep = true;
 361             return 1;
 362         } else if (args[i].equals("-encoding")) {
 363             encoding = requireArgument("-encoding", args, ++i);
 364             try {
 365                 if (!Charset.isSupported(encoding)) {
 366                     throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
 367                 }
 368             } catch (IllegalCharsetNameException icne) {
 369                 throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
 370             }
 371             return 2;
 372         } else if (args[i].equals("-disableXmlSecurity")) {
 373             disableXmlSecurity();


< prev index next >