Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48863
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 18 Feb 2011 20:58:16 +0000 (20:58 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 18 Feb 2011 20:58:16 +0000 (20:58 +0000)
Better logging when specifying an invalid directory for a class loader.
Based on a patch by Ralf Hauser.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1072145 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/startup/ClassLoaderFactory.java
java/org/apache/catalina/startup/LocalStrings.properties
webapps/docs/changelog.xml

index dff7702..e498d3d 100644 (file)
@@ -30,6 +30,7 @@ import java.util.Set;
 import org.apache.catalina.loader.StandardClassLoader;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.res.StringManager;
 
 
 /**
@@ -55,6 +56,9 @@ public final class ClassLoaderFactory {
 
 
     private static final Log log = LogFactory.getLog(ClassLoaderFactory.class);
+    
+    private static final StringManager sm =
+        StringManager.getManager(Constants.Package);
 
     protected static final Integer IS_DIR = Integer.valueOf(0);
     protected static final Integer IS_JAR = Integer.valueOf(1);
@@ -196,8 +200,14 @@ public final class ClassLoaderFactory {
                 } else if ( types[i] == IS_GLOB ) {
                     File directory=new File(location);
                     if (!directory.exists() || !directory.isDirectory() ||
-                        !directory.canRead())
+                        !directory.canRead()) {
+                        log.warn(sm.getString("classLoaderFactory.badDirectory",
+                                directory.getAbsolutePath(),
+                                Boolean.valueOf(directory.exists()),
+                                Boolean.valueOf(directory.isDirectory()),
+                                Boolean.valueOf(directory.canRead())));
                         continue;
+                    }
                     if (log.isDebugEnabled())
                         log.debug("  Including directory glob "
                             + directory.getAbsolutePath());
index 086e06b..3cab506 100644 (file)
@@ -16,6 +16,7 @@
 catalina.configFail=Unable to load server configuration from [{0}]
 catalina.shutdownHookFail=The shutdown hook experienced an error while trying to stop the server
 catalina.stopServer=No shutdown port configured. Shut down server through OS signal. Server not shut down.
+classLoaderFactory.badDirectory=Problem with directory [{0}], exists: [{1}], isDirectory: [{2}], canRead: [{4}]
 contextConfig.altDDNotFound=alt-dd file {0} not found
 contextConfig.applicationUrl=Unable to determine URL for application web.xml
 contextConfig.applicationMissing=Missing application web.xml, using defaults only
index 66c4945..aa4754f 100644 (file)
 <section name="Tomcat 7.0.9 (markt)">
   <subsection name="Catalina">
     <changelog>
+      <fix>
+        <bug>48863</bug>: Better logging when specifying an invalid directory
+        for a class loader. Based on a patch by Ralf Hauser. (markt)
+      </fix>
       <add>
         Enhance the RemoteIpFilter and RemoteIpValve so that the modified remote
         address, remote host, protocol and server port may be used in an access