Log unexpected runtima and IO errors in ApplicationContext#getResource() and Applicat...
authorkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 30 Apr 2010 03:49:40 +0000 (03:49 +0000)
committerkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 30 Apr 2010 03:49:40 +0000 (03:49 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@939551 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/core/ApplicationContext.java
java/org/apache/catalina/core/LocalStrings.properties

index d25302e..47b18b1 100644 (file)
@@ -507,8 +507,12 @@ public class ApplicationContext
                 return new URL
                     ("jndi", "", 0, getJNDIUri(hostName, fullPath),
                      new DirContextURLStreamHandler(resources));
-            } catch (Exception e) {
+            } catch (NamingException e) {
                 // Ignore
+            } catch (Exception e) {
+                // Unexpected
+                log(sm.getString("applicationContext.lookup.error", path,
+                        getContextPath()), e);
             }
         }
 
@@ -543,8 +547,12 @@ public class ApplicationContext
                 Object resource = resources.lookup(normalizedPath);
                 if (resource instanceof Resource)
                     return (((Resource) resource).streamContent());
-            } catch (Exception e) {
+            } catch (NamingException e) {
                 // Ignore
+            } catch (Exception e) {
+                // Unexpected
+                log(sm.getString("applicationContext.lookup.error", path,
+                        getContextPath()), e);
             }
         }
         return (null);
index 2a77469..65121ad 100644 (file)
@@ -30,6 +30,7 @@ applicationContext.addSessionCookieConfig.ise=Session Cookie configuration canno
 applicationContext.setSessionTracking.ise=The session tracking modes for context {0} cannot be set whilst the context is running
 applicationContext.setSessionTracking.iae.invalid=The session tracking mode {0} requested for context {1} is not supported by that context
 applicationContext.setSessionTracking.iae.ssl=The session tracking modes requested for context {1} included SSL and at least one other mode. SSL may not be configured with other modes.
+applicationContext.lookup.error=Failed to locate resource [{0}] in context [{1}]
 applicationDispatcher.allocateException=Allocate exception for servlet {0}
 applicationDispatcher.deallocateException=Deallocate exception for servlet {0}
 applicationDispatcher.forward.ise=Cannot forward after response has been committed