From e0977ffa762181ec0e49c86c2dee31454060cc62 Mon Sep 17 00:00:00 2001 From: markt Date: Mon, 21 Sep 2009 11:02:27 +0000 Subject: [PATCH] Fix possible NPE when embedded git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@817204 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/catalina/startup/ContextConfig.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/java/org/apache/catalina/startup/ContextConfig.java b/java/org/apache/catalina/startup/ContextConfig.java index 3f0346455..97f3951c6 100644 --- a/java/org/apache/catalina/startup/ContextConfig.java +++ b/java/org/apache/catalina/startup/ContextConfig.java @@ -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; -- 2.11.0