tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BugRat Mail System <tomcat-b...@cortexity.com>
Subject BugRat Report #429 has been filed.
Date Fri, 24 Nov 2000 17:44:39 GMT
Bug report #429 has just been filed.

You can view the report at the following URL:

   <http://znutar.cortexity.com/BugRatViewer/ShowReport/429>

REPORT #429 Details.

Project: Tomcat
Category: Bug Report
SubCategory: New Bug Report
Class: swbug
State: received
Priority: low
Severity: non-critical
Confidence: public
Environment: 
   Release: 3.2b8
   JVM Release: jdk1.1.7
   Operating System: HP-UX
   OS Release: 10.20
   Platform: HPPA-RISC

Synopsis: 
tomcat usage output missing/written twice

Description:
The startup class does not write a usage
beyond "usage:" This makes it difficult 
to learn about the (very useful) options.
Also, if the -help option is used, the
usage is printed twice, second time with
"Wrong arguments", which is wrong :-)
Finally, tomcat is not checking for invalid arguments.

To fix this, I did the following:

In .../src/share/apache/tomcat/startup/LocalStrings.properties

replaced the line
tomcat.usage=usage:

by

tomcat.usage=usage: java org.apache.tomcat.startup.Tomcat options\n\
options are:\n\
\t-help        shows this help\n\
\thelp         same as -help\n\
\t-stop        shutdown tomcat\n\
\t-f file      use given file instead of <tomcat.home>/conf/server.xml\n\
\t-config file same as -f file\n\
\t-h dir       use given directory instead of <tomcat.home>\n\
\t-home dir    same as -h dir\n

This has been tested with tomcat 3.1 and seems to work.

In .../src/share/apache/tomcat/startup/Tomcat.java
changed two methods (NOT TESTED - I did never build tomcat):

    public void execute(String args[] ) throws Exception {
	if( ! processArgs( args ) ) {
           // 2 Lines Commented out because already done in processArgs:
	   // System.out.println(sm.getString("tomcat.wrongargs"));
	   // printUsage();
	    return;
	}

    public  boolean processArgs(String[] args) {
	for (int i = 0; i < args.length; i++) {
	    String arg = args[i];
            
	    if (arg.equals("-help") || arg.equals("help")) {
		printUsage();
		return false;
		
	    } else if (arg.equals("-stop")) {
		doStop=true;
	    } else if (arg.equals("-f") || arg.equals("-config")) {
		i++;
		if( i < args.length )
		    configFile = args[i];
	    } else if (arg.equals("-h") || arg.equals("-home")) {
		i++;
		if (i < args.length)
		    System.getProperties().put("tomcat.home", args[i]);
            // added the following three lines
	    } else { // do not allow for bad options
                printUsage();
                return false;
            }
	}
	return true;
    }        

Yours,
Ralf

Mime
View raw message