DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28871>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28871

StandardHostDeployer throws a NPE when removing a context

           Summary: StandardHostDeployer throws a NPE when removing a
                    context
           Product: Tomcat 4
           Version: 4.1.30
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Catalina
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The deployer can throw a NPE while removing a context (remove method) because 
the docbase may not be an absolute path so the parentFile would return null in 
the following code:

                File contextFile = new File(context.getDocBase());
                File baseDir = contextFile.getParentFile();
                if (appBase.getCanonicalPath().equals(baseDir.getCanonicalPath
())) {
                    isAppBase = true;
                }


To be consistent with all the code in the app, it should probably be something 
like:

File contextFile = new File(context.getDocBase());
if (!contextFile .isAbsolute()){
   contextFile = new File(System.getProperty("catalina.base"), contextFile);
}
File baseDir = contextFile.getParentFile();

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to