You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Ralf Suckow <Ra...@alcatel.de> on 2000/11/24 18:51:22 UTC
tomcat usage output missing/written twice
Hello,
I've just submitted the following problem/solution
to BugRat as Report number 429.
This is my first jakarta bug report,
so I'm taking advice from the web page to also
send it to the mailing list. Hope that helps
and does not annoy too much, the submitted
bug is a minor problem ;-)
Yours,
Ralf
Bug Report 429: 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/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 by repackaging the jar 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