Author: markt
Date: Thu Jan 9 15:25:14 2014
New Revision: 1556834
URL: http://svn.apache.org/r1556834
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55970
Ignore non-JAR resources in WEB-INF/lib when checking to see if a reloadable
web application has updated JARs.
Modified:
tomcat/trunk/java/org/apache/catalina/loader/LocalStrings.properties
tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
Modified: tomcat/trunk/java/org/apache/catalina/loader/LocalStrings.properties
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/LocalStrings.properties?rev=1556834&r1=1556833&r2=1556834&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/LocalStrings.properties
(original)
+++ tomcat/trunk/java/org/apache/catalina/loader/LocalStrings.properties Thu
Jan 9 15:25:14 2014
@@ -34,9 +34,9 @@ webappClassLoader.checkThreadLocalsForLe
webappClassLoader.checkThreadsHttpClient=Found HttpClient keep-alive thread
using web application class loader. Fixed by switching thread to the parent
class loader.
webappClassLoader.getThreadGroupError=Unable to obtain the parent for
ThreadGroup [{0}]. It will not be possible to check all threads for potential
memory leaks
webappClassLoader.loadedByThisOrChildFail=Failed to fully check the entries in
an instance of [{0}] for potential memory leaks in context [{1}]
-webappClassLoader.jarsAdded=One of more JARs have been added to the web
application [{0}]
-webappClassLoader.jarsModified=One of more JARs have been modified in the web
application [{0}]
-webappClassLoader.jarsRemoved=One of more JARs have been removed from the web
application [{0}]
+webappClassLoader.jarsAdded=One or more JARs have been added to the web
application [{0}]
+webappClassLoader.jarsModified=One or more JARs have been modified in the web
application [{0}]
+webappClassLoader.jarsRemoved=One or more JARs have been removed from the web
application [{0}]
webappClassLoader.resourceModified=Resource [{0}] has been modified. The last
modified time was [{1}] and is now [{2}]
webappClassLoader.stopThreadFail=Failed to terminate thread named [{0}] for
web application [{1}]
webappClassLoader.stopTimerThreadFail=Failed to terminate TimerThread named
[{0}] for web application [{1}]
Modified: tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java?rev=1556834&r1=1556833&r2=1556834&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Thu Jan
9 15:25:14 2014
@@ -735,21 +735,15 @@ public class WebappClassLoader extends U
// Check if JARs have been added or removed
WebResource[] jars = resources.listResources("/WEB-INF/lib");
- if (jars.length > jarModificationTimes.size()) {
- log.info(sm.getString("webappClassLoader.jarsAdded",
- resources.getContext().getName()));
- return true;
- } else if (jars.length < jarModificationTimes.size()){
- log.info(sm.getString("webappClassLoader.jarsRemoved",
- resources.getContext().getName()));
- return true;
- }
+ // Filter out non-JAR resources
+ int jarCount = 0;
for (WebResource jar : jars) {
if (jar.getName().endsWith(".jar") && jar.isFile() &&
jar.canRead()) {
+ jarCount++;
Long recordedLastModified =
jarModificationTimes.get(jar.getName());
if (recordedLastModified == null) {
- // Jars have been added and removed
+ // Jar has been added
log.info(sm.getString("webappClassLoader.jarsAdded",
resources.getContext().getName()));
return true;
@@ -760,11 +754,16 @@ public class WebappClassLoader extends U
resources.getContext().getName()));
return true;
}
- jarModificationTimes.put(
- jar.getName(), Long.valueOf(jar.getLastModified()));
}
}
+ if (jarCount < jarModificationTimes.size()){
+ log.info(sm.getString("webappClassLoader.jarsRemoved",
+ resources.getContext().getName()));
+ return true;
+ }
+
+
// No classes have been modified
return false;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]