Author: markt
Date: Sat Jul 21 19:10:39 2012
New Revision: 1364154
URL: http://svn.apache.org/viewvc?rev=1364154&view=rev
Log:
FindBugs - Possible NPE
Use consistent approach to exception handling and the creation of the
FailedContext instance
context cannot be null
Modified:
tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java
Modified: tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java?rev=1364154&r1=1364153&r2=1364154&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java Sat Jul 21
19:10:39 2012
@@ -547,8 +547,10 @@ public class HostConfig
log.error(sm.getString(
"hostConfig.deployDescriptor.error",
contextXml.getAbsolutePath()));
- context = new FailedContext();
} finally {
+ if (context == null) {
+ context = new FailedContext();
+ }
digester.reset();
}
}
@@ -598,7 +600,7 @@ public class HostConfig
// default to appBase dir + name
expandedDocBase = new File(host.getAppBaseFile(),
cn.getBaseName());
- if (context != null && context.getDocBase() != null) {
+ if (context.getDocBase() != null) {
// first assume docBase is absolute
expandedDocBase = new File(context.getDocBase());
if (!expandedDocBase.isAbsolute()) {
@@ -644,7 +646,7 @@ public class HostConfig
addGlobalRedeployResources(deployedApp);
}
- if (context != null && host.findChild(context.getName()) != null) {
+ if (host.findChild(context.getName()) != null) {
deployed.put(context.getName(), deployedApp);
}
}
@@ -834,8 +836,10 @@ public class HostConfig
log.error(sm.getString(
"hostConfig.deployDescriptor.error",
war.getAbsolutePath()));
- context = new FailedContext();
} finally {
+ if (context == null) {
+ context = new FailedContext();
+ }
digester.reset();
}
}
@@ -995,8 +999,10 @@ public class HostConfig
log.error(sm.getString(
"hostConfig.deployDescriptor.error",
xml));
- context = new FailedContext();
} finally {
+ if (context == null) {
+ context = new FailedContext();
+ }
digester.reset();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]