Author: markt Date: Tue Aug 4 21:46:13 2015 New Revision: 1694111 URL: http://svn.apache.org/r1694111 Log: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=58192 Fix a regression in the fix for https://bz.apache.org/bugzilla/show_bug.cgi?id=58023. Ensure that classes are associated with their manifest even if the class file is first read (and cached) without the manifest.
Modified: tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoaderBase.java Modified: tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoaderBase.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoaderBase.java?rev=1694111&r1=1694110&r2=1694111&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoaderBase.java (original) +++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoaderBase.java Tue Aug 4 21:46:13 2015 @@ -142,6 +142,8 @@ public abstract class WebappClassLoaderB private static final String CLASS_FILE_SUFFIX = ".class"; private static final String SERVICES_PREFIX = "/META-INF/services/"; + private static final Manifest MANIFEST_UNKNOWN = new Manifest(); + static { ClassLoader.registerAsParallelCapable(); JVM_THREAD_GROUP_NAMES.add(JVM_THREAD_GROUP_SYSTEM); @@ -2554,8 +2556,17 @@ public abstract class WebappClassLoaderB return null; } + WebResource resource = null; + ResourceEntry entry = resourceEntries.get(path); if (entry != null) { + if (manifestRequired && entry.manifest == MANIFEST_UNKNOWN) { + // This resource was added to the cache when a request was made + // for the resource that did not need the manifest. Now the + // manifest is required, the cache entry needs to be updated. + resource = resources.getClassLoaderResource(path); + entry.manifest = resource.getManifest(); + } return entry; } @@ -2565,7 +2576,6 @@ public abstract class WebappClassLoaderB isCacheable = path.startsWith(SERVICES_PREFIX); } - WebResource resource = null; boolean fileNeedConvert = false; @@ -2623,6 +2633,8 @@ public abstract class WebappClassLoaderB if (manifestRequired) { entry.manifest = resource.getManifest(); + } else { + entry.manifest = MANIFEST_UNKNOWN; } if (isClassResource && entry.binaryContent != null && --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org