Author: markt Date: Tue May 3 11:36:52 2016 New Revision: 1742101 URL: http://svn.apache.org/viewvc?rev=1742101&view=rev Log: (empty)
Modified: tomcat/trunk/java/org/apache/tomcat/util/scan/StandardJarScanner.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/tomcat/util/scan/StandardJarScanner.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/scan/StandardJarScanner.java?rev=1742101&r1=1742100&r2=1742101&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/scan/StandardJarScanner.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/scan/StandardJarScanner.java Tue May 3 11:36:52 2016 @@ -187,23 +187,22 @@ public class StandardJarScanner implemen } // Scan WEB-INF/classes - URL webInfURL = null; try { - webInfURL = context.getResource(Constants.WEB_INF_CLASSES); - if (isScanAllDirectories()) { - URL url = context.getResource(Constants.WEB_INF_CLASSES + "/META-INF"); - if (url != null) { - // Class path scanning will look at WEB-INF/classes since - // that is the URL that Tomcat's web application class - // loader returns. Therefore, it is this URL that needs to - // be added to the set of processed URLs. - if (webInfURL != null) { - processedURLs.add(webInfURL); - } - try { - callback.scanWebInfClasses(); - } catch (IOException e) { - log.warn(sm.getString("jarScan.webinfclassesFail"), e); + URL webInfURL = context.getResource(Constants.WEB_INF_CLASSES); + if (webInfURL != null) { + // WEB-INF/classes will also be included in the URLs returned + // by the web application class loader so ensure the class path + // scanning below does not re-scan this location. + processedURLs.add(webInfURL); + + if (isScanAllDirectories()) { + URL url = context.getResource(Constants.WEB_INF_CLASSES + "/META-INF"); + if (url != null) { + try { + callback.scanWebInfClasses(); + } catch (IOException e) { + log.warn(sm.getString("jarScan.webinfclassesFail"), e); + } } } } @@ -259,17 +258,8 @@ public class StandardJarScanner implemen if (log.isDebugEnabled()) { log.debug(sm.getString("jarScan.classloaderJarScan", urls[i])); } - String webappPath = null; - if (urls[i].equals(webInfURL)) { - if (scanType == JarScanType.PLUGGABILITY) { - // WEB-INF/classes should not be scanned for - // web fragments. - continue; - } - webappPath = Constants.WEB_INF_CLASSES; - } try { - process(scanType, callback, urls[i], webappPath, isWebapp); + process(scanType, callback, urls[i], null, isWebapp); } catch (IOException ioe) { log.warn(sm.getString("jarScan.classloaderFail", urls[i]), ioe); } Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1742101&r1=1742100&r2=1742101&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Tue May 3 11:36:52 2016 @@ -170,6 +170,12 @@ a <code>web-fragment.xml</code> file from a JAR located in an unpacked WAR. (markt) </fix> + <fix> + Ensure that <code>JarScanner</code> only uses the explicit call-back to + process <code>WEB-INF/classes</code> and only when configured to treat + the contents of <code>WEB-INF/classes</code> as a possible exploded JAR. + (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