Bug 48059

Summary: org.apache.catalina.startup.Bootstrap's main method handles 'startd' or 'stopd' wrongly
Product: Tomcat 7 Reporter: qingyang.xu <qingyang.xu>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P2    
Version: trunk   
Target Milestone: ---   
Hardware: PC   
OS: Linux   

Description qingyang.xu 2009-10-26 17:21:08 UTC
String command = "start";
if (args.length > 0) {
    command = args[args.length - 1];
}

if (command.equals("startd")) {
    args[0] = "start";
    daemon.load(args);
    daemon.start();
} else if (command.equals("stopd")) {
    args[0] = "stop";
    daemon.stop();
}

should be: 

String command = "start";
if (args.length > 0) {
    command = args[args.length - 1];
}
if (command.equals("startd")) {
    args[args.length - 1] = "start";
    daemon.load(args);
    daemon.start();
} else if (command.equals("stopd")) {
    args[args.length - 1] = "stop";
    daemon.stop();
} 
... ...

Consider what whould happen if Bootstrap is invoked as :

org.apache.catalina.startup.Bootstrap -nonaming startd


Please refer to the following usage method of 
org.apache.catalina.startup.Catalina:
/**
     * Print usage information for this application.
     */
    protected void usage() {

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

    }
Comment 1 qingyang.xu 2009-10-26 17:38:23 UTC
*** Bug 47881 has been marked as a duplicate of this bug. ***
Comment 2 Konstantin Kolinko 2009-11-02 02:46:05 UTC

*** This bug has been marked as a duplicate of bug 47881 ***