Java Code Examples for com.sun.tools.internal.ws.resources.WscompileMessages#WSIMPORT_ILLEGAL_TARGET_VERSION

The following examples show how to use com.sun.tools.internal.ws.resources.WscompileMessages#WSIMPORT_ILLEGAL_TARGET_VERSION . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Options.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Parses an option <code>args[i]</code> and return
 * the number of tokens consumed.
 *
 * @return
 *      0 if the argument is not understood. Returning 0
 *      will let the caller report an error.
 * @exception BadCommandLineException
 *      If the callee wants to provide a custom message for an error.
 */
protected int parseArguments(String[] args, int i) throws BadCommandLineException {
    if (args[i].equals("-g")) {
        debug = true;
        return 1;
    } else if (args[i].equals("-Xdebug")) {
        debugMode = true;
        return 1;
    } else if (args[i].equals("-Xendorsed")) {
        // this option is processed much earlier, so just ignore.
        return 1;
    } else if (args[i].equals("-verbose")) {
        verbose = true;
        return 1;
    } else if (args[i].equals("-quiet")) {
        quiet = true;
        return 1;
    } else if (args[i].equals("-keep")) {
        keep = true;
        return 1;
    }  else if (args[i].equals("-target")) {
        String token = requireArgument("-target", args, ++i);
        target = Target.parse(token);
        if(target == null)
            throw new BadCommandLineException(WscompileMessages.WSIMPORT_ILLEGAL_TARGET_VERSION(token));
        return 2;
    } else if (args[i].equals("-classpath") || args[i].equals("-cp")) {
        classpath = requireArgument("-classpath", args, ++i) + File.pathSeparator + System.getProperty("java.class.path");
        return 2;
    } else if (args[i].equals("-d")) {
        destDir = new File(requireArgument("-d", args, ++i));
        if (!destDir.exists())
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(destDir.getPath()));
        return 2;
    } else if (args[i].equals("-s")) {
        sourceDir = new File(requireArgument("-s", args, ++i));
        keep = true;
        if (!sourceDir.exists()) {
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(sourceDir.getPath()));
        }
        return 2;
    } else if (args[i].equals("-extension")) {
        compatibilityMode = EXTENSION;
        return 1;
    } else if (args[i].startsWith("-help")) {
        WeAreDone done = new WeAreDone();
        done.initOptions(this);
        throw done;
    } else if (args[i].equals("-Xnocompile")) {
        // -nocompile implies -keep. this is undocumented switch.
        nocompile = true;
        keep = true;
        return 1;
    } else if (args[i].equals("-encoding")) {
        encoding = requireArgument("-encoding", args, ++i);
        try {
            if (!Charset.isSupported(encoding)) {
                throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
            }
        } catch (IllegalCharsetNameException icne) {
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
        }
        return 2;
    } else if (args[i].equals("-disableXmlSecurity")) {
        disableXmlSecurity();
        return 1;
    } else if (args[i].startsWith("-J")) {
        if (javacOptions == null) {
            javacOptions = new ArrayList<String>();
        }
        javacOptions.add(args[i].substring(2));
        return 1;
    }
    return 0;
}
 
Example 2
Source File: Options.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Parses an option <code>args[i]</code> and return
 * the number of tokens consumed.
 *
 * @return
 *      0 if the argument is not understood. Returning 0
 *      will let the caller report an error.
 * @exception BadCommandLineException
 *      If the callee wants to provide a custom message for an error.
 */
protected int parseArguments(String[] args, int i) throws BadCommandLineException {
    if (args[i].equals("-g")) {
        debug = true;
        return 1;
    } else if (args[i].equals("-Xdebug")) {
        debugMode = true;
        return 1;
    } else if (args[i].equals("-Xendorsed")) {
        // this option is processed much earlier, so just ignore.
        return 1;
    } else if (args[i].equals("-verbose")) {
        verbose = true;
        return 1;
    } else if (args[i].equals("-quiet")) {
        quiet = true;
        return 1;
    } else if (args[i].equals("-keep")) {
        keep = true;
        return 1;
    }  else if (args[i].equals("-target")) {
        String token = requireArgument("-target", args, ++i);
        target = Target.parse(token);
        if(target == null)
            throw new BadCommandLineException(WscompileMessages.WSIMPORT_ILLEGAL_TARGET_VERSION(token));
        return 2;
    } else if (args[i].equals("-classpath") || args[i].equals("-cp")) {
        classpath = requireArgument("-classpath", args, ++i) + File.pathSeparator + System.getProperty("java.class.path");
        return 2;
    } else if (args[i].equals("-d")) {
        destDir = new File(requireArgument("-d", args, ++i));
        if (!destDir.exists())
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(destDir.getPath()));
        return 2;
    } else if (args[i].equals("-s")) {
        sourceDir = new File(requireArgument("-s", args, ++i));
        keep = true;
        if (!sourceDir.exists()) {
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(sourceDir.getPath()));
        }
        return 2;
    } else if (args[i].equals("-extension")) {
        compatibilityMode = EXTENSION;
        return 1;
    } else if (args[i].startsWith("-help")) {
        WeAreDone done = new WeAreDone();
        done.initOptions(this);
        throw done;
    } else if (args[i].equals("-Xnocompile")) {
        // -nocompile implies -keep. this is undocumented switch.
        nocompile = true;
        keep = true;
        return 1;
    } else if (args[i].equals("-encoding")) {
        encoding = requireArgument("-encoding", args, ++i);
        try {
            if (!Charset.isSupported(encoding)) {
                throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
            }
        } catch (IllegalCharsetNameException icne) {
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
        }
        return 2;
    } else if (args[i].equals("-disableXmlSecurity")) {
        disableXmlSecurity();
        return 1;
    } else if (args[i].startsWith("-J")) {
        if (javacOptions == null) {
            javacOptions = new ArrayList<String>();
        }
        javacOptions.add(args[i].substring(2));
        return 1;
    }
    return 0;
}
 
Example 3
Source File: Options.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Parses an option <code>args[i]</code> and return
 * the number of tokens consumed.
 *
 * @return
 *      0 if the argument is not understood. Returning 0
 *      will let the caller report an error.
 * @exception BadCommandLineException
 *      If the callee wants to provide a custom message for an error.
 */
protected int parseArguments(String[] args, int i) throws BadCommandLineException {
    if (args[i].equals("-g")) {
        debug = true;
        return 1;
    } else if (args[i].equals("-Xdebug")) {
        debugMode = true;
        return 1;
    } else if (args[i].equals("-Xendorsed")) {
        // this option is processed much earlier, so just ignore.
        return 1;
    } else if (args[i].equals("-verbose")) {
        verbose = true;
        return 1;
    } else if (args[i].equals("-quiet")) {
        quiet = true;
        return 1;
    } else if (args[i].equals("-keep")) {
        keep = true;
        return 1;
    }  else if (args[i].equals("-target")) {
        String token = requireArgument("-target", args, ++i);
        target = Target.parse(token);
        if(target == null)
            throw new BadCommandLineException(WscompileMessages.WSIMPORT_ILLEGAL_TARGET_VERSION(token));
        return 2;
    } else if (args[i].equals("-classpath") || args[i].equals("-cp")) {
        classpath = requireArgument("-classpath", args, ++i) + File.pathSeparator + System.getProperty("java.class.path");
        return 2;
    } else if (args[i].equals("-d")) {
        destDir = new File(requireArgument("-d", args, ++i));
        if (!destDir.exists())
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(destDir.getPath()));
        return 2;
    } else if (args[i].equals("-s")) {
        sourceDir = new File(requireArgument("-s", args, ++i));
        keep = true;
        if (!sourceDir.exists()) {
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(sourceDir.getPath()));
        }
        return 2;
    } else if (args[i].equals("-extension")) {
        compatibilityMode = EXTENSION;
        return 1;
    } else if (args[i].startsWith("-help")) {
        WeAreDone done = new WeAreDone();
        done.initOptions(this);
        throw done;
    } else if (args[i].equals("-Xnocompile")) {
        // -nocompile implies -keep. this is undocumented switch.
        nocompile = true;
        keep = true;
        return 1;
    } else if (args[i].equals("-encoding")) {
        encoding = requireArgument("-encoding", args, ++i);
        try {
            if (!Charset.isSupported(encoding)) {
                throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
            }
        } catch (IllegalCharsetNameException icne) {
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
        }
        return 2;
    } else if (args[i].equals("-disableXmlSecurity")) {
        disableXmlSecurity();
        return 1;
    } else if (args[i].startsWith("-J")) {
        if (javacOptions == null) {
            javacOptions = new ArrayList<String>();
        }
        javacOptions.add(args[i].substring(2));
        return 1;
    }
    return 0;
}
 
Example 4
Source File: Options.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Parses an option <code>args[i]</code> and return
 * the number of tokens consumed.
 *
 * @return
 *      0 if the argument is not understood. Returning 0
 *      will let the caller report an error.
 * @exception BadCommandLineException
 *      If the callee wants to provide a custom message for an error.
 */
protected int parseArguments(String[] args, int i) throws BadCommandLineException {
    if (args[i].equals("-g")) {
        debug = true;
        return 1;
    } else if (args[i].equals("-Xdebug")) {
        debugMode = true;
        return 1;
    } else if (args[i].equals("-Xendorsed")) {
        // this option is processed much earlier, so just ignore.
        return 1;
    } else if (args[i].equals("-verbose")) {
        verbose = true;
        return 1;
    } else if (args[i].equals("-quiet")) {
        quiet = true;
        return 1;
    } else if (args[i].equals("-keep")) {
        keep = true;
        return 1;
    }  else if (args[i].equals("-target")) {
        String token = requireArgument("-target", args, ++i);
        target = Target.parse(token);
        if(target == null)
            throw new BadCommandLineException(WscompileMessages.WSIMPORT_ILLEGAL_TARGET_VERSION(token));
        return 2;
    } else if (args[i].equals("-classpath") || args[i].equals("-cp")) {
        classpath = requireArgument("-classpath", args, ++i) + File.pathSeparator + System.getProperty("java.class.path");
        return 2;
    } else if (args[i].equals("-d")) {
        destDir = new File(requireArgument("-d", args, ++i));
        if (!destDir.exists())
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(destDir.getPath()));
        return 2;
    } else if (args[i].equals("-s")) {
        sourceDir = new File(requireArgument("-s", args, ++i));
        keep = true;
        if (!sourceDir.exists()) {
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(sourceDir.getPath()));
        }
        return 2;
    } else if (args[i].equals("-extension")) {
        compatibilityMode = EXTENSION;
        return 1;
    } else if (args[i].startsWith("-help")) {
        WeAreDone done = new WeAreDone();
        done.initOptions(this);
        throw done;
    } else if (args[i].equals("-Xnocompile")) {
        // -nocompile implies -keep. this is undocumented switch.
        nocompile = true;
        keep = true;
        return 1;
    } else if (args[i].equals("-encoding")) {
        encoding = requireArgument("-encoding", args, ++i);
        try {
            if (!Charset.isSupported(encoding)) {
                throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
            }
        } catch (IllegalCharsetNameException icne) {
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
        }
        return 2;
    } else if (args[i].equals("-disableXmlSecurity")) {
        disableXmlSecurity();
        return 1;
    } else if (args[i].startsWith("-J")) {
        if (javacOptions == null) {
            javacOptions = new ArrayList<String>();
        }
        javacOptions.add(args[i].substring(2));
        return 1;
    }
    return 0;
}
 
Example 5
Source File: Options.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Parses an option {@code args[i]} and return
 * the number of tokens consumed.
 *
 * @return
 *      0 if the argument is not understood. Returning 0
 *      will let the caller report an error.
 * @exception BadCommandLineException
 *      If the callee wants to provide a custom message for an error.
 */
protected int parseArguments(String[] args, int i) throws BadCommandLineException {
    if (args[i].equals("-g")) {
        debug = true;
        return 1;
    } else if (args[i].equals("-Xdebug")) {
        debugMode = true;
        return 1;
    } else if (args[i].equals("-Xendorsed")) {
        // this option is processed much earlier, so just ignore.
        return 1;
    } else if (args[i].equals("-verbose")) {
        verbose = true;
        return 1;
    } else if (args[i].equals("-quiet")) {
        quiet = true;
        return 1;
    } else if (args[i].equals("-keep")) {
        keep = true;
        return 1;
    }  else if (args[i].equals("-target")) {
        String token = requireArgument("-target", args, ++i);
        target = Target.parse(token);
        if(target == null)
            throw new BadCommandLineException(WscompileMessages.WSIMPORT_ILLEGAL_TARGET_VERSION(token));
        return 2;
    } else if (args[i].equals("-classpath") || args[i].equals("-cp")) {
        classpath = requireArgument("-classpath", args, ++i) + File.pathSeparator + System.getProperty("java.class.path");
        return 2;
    } else if (args[i].equals("-d")) {
        destDir = new File(requireArgument("-d", args, ++i));
        if (!destDir.exists())
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(destDir.getPath()));
        return 2;
    } else if (args[i].equals("-s")) {
        sourceDir = new File(requireArgument("-s", args, ++i));
        keep = true;
        if (!sourceDir.exists()) {
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(sourceDir.getPath()));
        }
        return 2;
    } else if (args[i].equals("-extension")) {
        compatibilityMode = EXTENSION;
        return 1;
    } else if (args[i].startsWith("-help")) {
        WeAreDone done = new WeAreDone();
        done.initOptions(this);
        throw done;
    } else if (args[i].equals("-Xnocompile")) {
        // -nocompile implies -keep. this is undocumented switch.
        nocompile = true;
        keep = true;
        return 1;
    } else if (args[i].equals("-encoding")) {
        encoding = requireArgument("-encoding", args, ++i);
        try {
            if (!Charset.isSupported(encoding)) {
                throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
            }
        } catch (IllegalCharsetNameException icne) {
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
        }
        return 2;
    } else if (args[i].equals("-disableXmlSecurity")) {
        disableXmlSecurity();
        return 1;
    } else if (args[i].startsWith("-J")) {
        if (javacOptions == null) {
            javacOptions = new ArrayList<String>();
        }
        javacOptions.add(args[i].substring(2));
        return 1;
    }
    return 0;
}
 
Example 6
Source File: Options.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Parses an option <code>args[i]</code> and return
 * the number of tokens consumed.
 *
 * @return
 *      0 if the argument is not understood. Returning 0
 *      will let the caller report an error.
 * @exception BadCommandLineException
 *      If the callee wants to provide a custom message for an error.
 */
protected int parseArguments(String[] args, int i) throws BadCommandLineException {
    if (args[i].equals("-g")) {
        debug = true;
        return 1;
    } else if (args[i].equals("-Xdebug")) {
        debugMode = true;
        return 1;
    } else if (args[i].equals("-Xendorsed")) {
        // this option is processed much earlier, so just ignore.
        return 1;
    } else if (args[i].equals("-verbose")) {
        verbose = true;
        return 1;
    } else if (args[i].equals("-quiet")) {
        quiet = true;
        return 1;
    } else if (args[i].equals("-keep")) {
        keep = true;
        return 1;
    }  else if (args[i].equals("-target")) {
        String token = requireArgument("-target", args, ++i);
        target = Target.parse(token);
        if(target == null)
            throw new BadCommandLineException(WscompileMessages.WSIMPORT_ILLEGAL_TARGET_VERSION(token));
        return 2;
    } else if (args[i].equals("-classpath") || args[i].equals("-cp")) {
        classpath = requireArgument("-classpath", args, ++i) + File.pathSeparator + System.getProperty("java.class.path");
        return 2;
    } else if (args[i].equals("-d")) {
        destDir = new File(requireArgument("-d", args, ++i));
        if (!destDir.exists())
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(destDir.getPath()));
        return 2;
    } else if (args[i].equals("-s")) {
        sourceDir = new File(requireArgument("-s", args, ++i));
        keep = true;
        if (!sourceDir.exists()) {
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(sourceDir.getPath()));
        }
        return 2;
    } else if (args[i].equals("-extension")) {
        compatibilityMode = EXTENSION;
        return 1;
    } else if (args[i].startsWith("-help")) {
        WeAreDone done = new WeAreDone();
        done.initOptions(this);
        throw done;
    } else if (args[i].equals("-Xnocompile")) {
        // -nocompile implies -keep. this is undocumented switch.
        nocompile = true;
        keep = true;
        return 1;
    } else if (args[i].equals("-encoding")) {
        encoding = requireArgument("-encoding", args, ++i);
        try {
            if (!Charset.isSupported(encoding)) {
                throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
            }
        } catch (IllegalCharsetNameException icne) {
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
        }
        return 2;
    } else if (args[i].equals("-disableXmlSecurity")) {
        disableXmlSecurity();
        return 1;
    } else if (args[i].startsWith("-J")) {
        if (javacOptions == null) {
            javacOptions = new ArrayList<String>();
        }
        javacOptions.add(args[i].substring(2));
        return 1;
    }
    return 0;
}
 
Example 7
Source File: Options.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Parses an option <code>args[i]</code> and return
 * the number of tokens consumed.
 *
 * @return
 *      0 if the argument is not understood. Returning 0
 *      will let the caller report an error.
 * @exception BadCommandLineException
 *      If the callee wants to provide a custom message for an error.
 */
protected int parseArguments(String[] args, int i) throws BadCommandLineException {
    if (args[i].equals("-g")) {
        debug = true;
        return 1;
    } else if (args[i].equals("-Xdebug")) {
        debugMode = true;
        return 1;
    } else if (args[i].equals("-Xendorsed")) {
        // this option is processed much earlier, so just ignore.
        return 1;
    } else if (args[i].equals("-verbose")) {
        verbose = true;
        return 1;
    } else if (args[i].equals("-quiet")) {
        quiet = true;
        return 1;
    } else if (args[i].equals("-keep")) {
        keep = true;
        return 1;
    }  else if (args[i].equals("-target")) {
        String token = requireArgument("-target", args, ++i);
        target = Target.parse(token);
        if(target == null)
            throw new BadCommandLineException(WscompileMessages.WSIMPORT_ILLEGAL_TARGET_VERSION(token));
        return 2;
    } else if (args[i].equals("-classpath") || args[i].equals("-cp")) {
        classpath = requireArgument("-classpath", args, ++i) + File.pathSeparator + System.getProperty("java.class.path");
        return 2;
    } else if (args[i].equals("-d")) {
        destDir = new File(requireArgument("-d", args, ++i));
        if (!destDir.exists())
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(destDir.getPath()));
        return 2;
    } else if (args[i].equals("-s")) {
        sourceDir = new File(requireArgument("-s", args, ++i));
        keep = true;
        if (!sourceDir.exists()) {
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(sourceDir.getPath()));
        }
        return 2;
    } else if (args[i].equals("-extension")) {
        compatibilityMode = EXTENSION;
        return 1;
    } else if (args[i].startsWith("-help")) {
        WeAreDone done = new WeAreDone();
        done.initOptions(this);
        throw done;
    } else if (args[i].equals("-Xnocompile")) {
        // -nocompile implies -keep. this is undocumented switch.
        nocompile = true;
        keep = true;
        return 1;
    } else if (args[i].equals("-encoding")) {
        encoding = requireArgument("-encoding", args, ++i);
        try {
            if (!Charset.isSupported(encoding)) {
                throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
            }
        } catch (IllegalCharsetNameException icne) {
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
        }
        return 2;
    } else if (args[i].equals("-disableXmlSecurity")) {
        disableXmlSecurity();
        return 1;
    } else if (args[i].startsWith("-J")) {
        if (javacOptions == null) {
            javacOptions = new ArrayList<String>();
        }
        javacOptions.add(args[i].substring(2));
        return 1;
    }
    return 0;
}
 
Example 8
Source File: Options.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Parses an option <code>args[i]</code> and return
 * the number of tokens consumed.
 *
 * @return
 *      0 if the argument is not understood. Returning 0
 *      will let the caller report an error.
 * @exception BadCommandLineException
 *      If the callee wants to provide a custom message for an error.
 */
protected int parseArguments(String[] args, int i) throws BadCommandLineException {
    if (args[i].equals("-g")) {
        debug = true;
        return 1;
    } else if (args[i].equals("-Xdebug")) {
        debugMode = true;
        return 1;
    } else if (args[i].equals("-Xendorsed")) {
        // this option is processed much earlier, so just ignore.
        return 1;
    } else if (args[i].equals("-verbose")) {
        verbose = true;
        return 1;
    } else if (args[i].equals("-quiet")) {
        quiet = true;
        return 1;
    } else if (args[i].equals("-keep")) {
        keep = true;
        return 1;
    }  else if (args[i].equals("-target")) {
        String token = requireArgument("-target", args, ++i);
        target = Target.parse(token);
        if(target == null)
            throw new BadCommandLineException(WscompileMessages.WSIMPORT_ILLEGAL_TARGET_VERSION(token));
        return 2;
    } else if (args[i].equals("-classpath") || args[i].equals("-cp")) {
        classpath = requireArgument("-classpath", args, ++i) + File.pathSeparator + System.getProperty("java.class.path");
        return 2;
    } else if (args[i].equals("-d")) {
        destDir = new File(requireArgument("-d", args, ++i));
        if (!destDir.exists())
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(destDir.getPath()));
        return 2;
    } else if (args[i].equals("-s")) {
        sourceDir = new File(requireArgument("-s", args, ++i));
        keep = true;
        if (!sourceDir.exists()) {
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(sourceDir.getPath()));
        }
        return 2;
    } else if (args[i].equals("-extension")) {
        compatibilityMode = EXTENSION;
        return 1;
    } else if (args[i].startsWith("-help")) {
        WeAreDone done = new WeAreDone();
        done.initOptions(this);
        throw done;
    } else if (args[i].equals("-Xnocompile")) {
        // -nocompile implies -keep. this is undocumented switch.
        nocompile = true;
        keep = true;
        return 1;
    } else if (args[i].equals("-encoding")) {
        encoding = requireArgument("-encoding", args, ++i);
        try {
            if (!Charset.isSupported(encoding)) {
                throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
            }
        } catch (IllegalCharsetNameException icne) {
            throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
        }
        return 2;
    } else if (args[i].equals("-disableXmlSecurity")) {
        disableXmlSecurity();
        return 1;
    } else if (args[i].startsWith("-J")) {
        if (javacOptions == null) {
            javacOptions = new ArrayList<String>();
        }
        javacOptions.add(args[i].substring(2));
        return 1;
    }
    return 0;
}