BugRat Report # 429

Project: Tomcat Release: 3.2b8
Category: Bug Report SubCategory: New Bug Report
Class: swbug State: received
Priority: low Severity: non-critical
Confidence: public

Submitter: Ralf Suckow ( Ralf.Suckow@alcatel.de )
Date Submitted: Nov 24 2000, 11:44:39 CST
Responsible: Z_Tomcat Alias ( tomcat-bugs@cortexity.com )

tomcat usage output missing/written twice
Environment: (jvm, os, osrel, platform)
jdk1.1.7, HP-UX, 10.20, HPPA-RISC

Additional Environment Description:

Report 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 /conf/server.xml\n\ \t-config file same as -f file\n\ \t-h dir use given directory instead of \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

How To Reproduce:


View this report online...