Author: markt Date: Wed Feb 10 15:13:17 2016 New Revision: 1729625 URL: http://svn.apache.org/viewvc?rev=1729625&view=rev Log: Correct a regression in the fix for 58867. When configuring a Context to use an external directory for the docBase, and that directory happens to be located along side the original WAR, use the directory as the docBase rather than expanding the WAR into the appBase and using the newly created expanded directory as the docBase.
Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1729625&r1=1729624&r2=1729625&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original) +++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Wed Feb 10 15:13:17 2016 @@ -579,8 +579,7 @@ public class ContextConfig implements Li * Adjust docBase. * @throws IOException cannot access the context base path */ - protected void fixDocBase() - throws IOException { + protected void fixDocBase() throws IOException { Host host = (Host) context.getParent(); File appBase = host.getAppBaseFile(); @@ -616,6 +615,8 @@ public class ContextConfig implements Li } } + boolean docBaseInAppBase = docBase.startsWith(appBase.getPath() + File.separatorChar); + if (docBase.toLowerCase(Locale.ENGLISH).endsWith(".war") && !file.isDirectory()) { URL war = new URL("jar:" + (new File(docBase)).toURI().toURL() + "!/"); if (unpackWARs) { @@ -632,7 +633,7 @@ public class ContextConfig implements Li File docDir = new File(docBase); File warFile = new File(docBase + ".war"); URL war = null; - if (warFile.exists()) { + if (warFile.exists() && docBaseInAppBase) { war = new URL("jar:" + warFile.toURI().toURL() + "!/"); } if (docDir.exists()) { @@ -660,7 +661,7 @@ public class ContextConfig implements Li } } - if (docBase.startsWith(appBase.getPath() + File.separatorChar)) { + if (docBaseInAppBase) { docBase = docBase.substring(appBase.getPath().length()); docBase = docBase.replace(File.separatorChar, '/'); if (docBase.startsWith("/")) { @@ -671,7 +672,6 @@ public class ContextConfig implements Li } context.setDocBase(docBase); - } Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1729625&r1=1729624&r2=1729625&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Wed Feb 10 15:13:17 2016 @@ -62,6 +62,14 @@ <code>authenticate()</code> to ensure compatibility with future improvements to <code>AuthenticatorBase</code>. (markt) </scode> + <fix> + Correct a regression in the fix for <bug>58867</bug>. When configuring a + Context to use an external directory for the <code>docBase</code>, and + that directory happens to be located along side the original WAR, use + the directory as the <code>docBase</code> rather than expanding the + WAR into the <code>appBase</code> and using the newly created expanded + directory as the <code>docBase</code>. (markt) + </fix> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org