tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BugRat Mail System <>
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:


REPORT #429 Details.

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

tomcat usage output missing/written twice

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/

replaced the line


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/
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();

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


View raw message