You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Robin Meade <rm...@outreach.hawaii.edu> on 2000/03/17 09:07:19 UTC
[PATCH] fixes shutdown null ptr exception
Hi,
I'm getting a null pointer exception when I execute shutdown.bat
because variable configFile is null.
(Anybody else getting this exception?)
This diff file shows how I fixed it:
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/startup/Tomcat.java,v
retrieving revision 1.17
diff -r1.17 Tomcat.java
107,125c107,110
< File f;
<
< // - if no -f config is specified, use tomcat.home and set
ContextManager.home to the same thing.
< // The user probably wants the default tomcat.
< // - if a config file is specified - just use it, it will probably set the
contextmanager home.
< if( configFile==null ) {
< String tchome=System.getProperty("tomcat.home");
< if( tchome == null ) {
< System.out.println("No tomcat.home property, you need to set TOMCAT_HOME
or add -Dtomcat.home ");
< // try "." - a better solution would be to just exit.
< tchome=".";
< }
< // Home will be identical to tomcat home if default config is used.
< cm.setHome( tchome );
< f=new File(tchome, DEFAULT_CONFIG );
< } else {
< // config file is relative to the working directory
< // if it doesn't set a home for the context manager, tomcat.home will
be used
< f=new File(configFile);
---
> if (configFile == null) {
> // - if no -f config is specified, set ContextManager.home to tomcat.home.
> // The user probably wants the default tomcat.
> cm.setHome(getTomcatHome());
126a112,113
>
> File f = getConfigFile();
145a133,154
> String getTomcatHome() {
> String tchome=System.getProperty("tomcat.home");
> if( tchome == null ) {
> System.out.println("No tomcat.home property, you need to set TOMCAT_HOME or add -Dtomcat.home ");
> // try "." - a better solution would be to just exit.
> tchome=".";
> }
> return tchome;
> }
>
> File getConfigFile() {
> // - if no -f config is specified, use tomcat's default and set ContextManager.home to tomcat.home.
> // The user probably wants the default tomcat.
> // - if a config file is specified - just use it, it will probably set the contextmanager home.
> if( configFile==null ) {
> return new File(getTomcatHome(), DEFAULT_CONFIG );
> } else {
> // config file is relative to the working directory
> return new File(configFile);
> }
> }
>
172c181,187
< File f=new File(cm.getHome(), configFile);
---
> if (configFile == null) {
> // - if no -f config is specified, set ContextManager.home to tomcat.home.
> // The user probably wants the default tomcat.
> cm.setHome(getTomcatHome());
> }
>
> File f = getConfigFile(getTomcatHome());
======================================================================