Bug 47976 - org.apache.catalina.startup.Catalina's usage() method is not complete
org.apache.catalina.startup.Catalina's usage() method is not complete
Status: RESOLVED FIXED
Product: Tomcat 6
Classification: Unclassified
Component: Catalina
6.0.20
PC All
: P2 trivial (vote)
: default
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2009-10-10 01:18 UTC by qingyang.xu
Modified: 2009-12-21 03:38 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description qingyang.xu 2009-10-10 01:18:09 UTC
Below is the usage() method of org.apache.catalina.startup.Catalina class:

protected void usage() {
        System.out.println
            ("usage: java org.apache.catalina.startup.Catalina"
             + " [ -config {pathname} ]"
             + " [ -nonaming ] { start | stop }");
}


However, it misses one option: [ -help ]. Please refer to the arguments() method of the same class as below:

protected boolean arguments(String args[]) {

        boolean isConfig = false;

        if (args.length < 1) {
            usage();
            return (false);
        }

        for (int i = 0; i < args.length; i++) {
            if (isConfig) {
                configFile = args[i];
                isConfig = false;
            } else if (args[i].equals("-config")) {
                isConfig = true;
            } else if (args[i].equals("-nonaming")) {
                setUseNaming( false );
            } else if (args[i].equals("-help")) {
                usage();
                return (false);
            } else if (args[i].equals("start")) {
                starting = true;
                stopping = false;
            } else if (args[i].equals("stop")) {
                starting = false;
                stopping = true;
            } else {
                usage();
                return (false);
            }
        }

        return (true);

    }


By the way, the javadoc of the Catalina class is not correct or updated. It lacks information about "-nonaming" and "start", and "-stop" should be "stop":

/**
 * Startup/Shutdown shell program for Catalina.  The following command line
 * options are recognized:
 * <ul>
 * <li><b>-config {pathname}</b> - Set the pathname of the configuration file
 *     to be processed.  If a relative path is specified, it will be
 *     interpreted as relative to the directory pathname specified by the
 *     "catalina.base" system property.   [conf/server.xml]
 * <li><b>-help</b> - Display usage information.
 * <li><b>-stop</b> - Stop the currently running instance of Catalina.
 * </u>
 *
 * Should do the same thing as Embedded, but using a server.xml file.
 *
 * @author Craig R. McClanahan
 * @author Remy Maucherat
 * @version $Revision: 737768 $ $Date: 2009-01-27 01:55:19 +0800 (Tue, 27 Jan 2009) $
 */
Comment 1 Mark Thomas 2009-12-19 20:01:38 UTC
This has already been fixed in trunk. I have proposed the relevant patches for 6.0.x
Comment 2 Mark Thomas 2009-12-21 03:38:36 UTC
This has been fixed in 6.0.x and will be included in 6.0.21 onwards.