Fix possible NPE when embedded
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 21 Sep 2009 11:02:27 +0000 (11:02 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 21 Sep 2009 11:02:27 +0000 (11:02 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@817204 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/startup/ContextConfig.java

index 3f03464..97f3951 100644 (file)
@@ -1191,9 +1191,14 @@ public class ContextConfig
     protected InputSource getHostWebXmlSource() {
         String resourceName = getHostConfigPath(Constants.HostWebXml);
         
+        // In an embedded environment, configBase might not be set
+        File configBase = getConfigBase();
+        if (configBase == null)
+            return null;
+        
         String basePath = null;
         try {
-            basePath = getConfigBase().getCanonicalPath();
+            basePath = configBase.getCanonicalPath();
         } catch (IOException e) {
             log.error(sm.getString("contectConfig.baseError"), e);
             return null;