http://issues.apache.org/bugzilla/show_bug.cgi?id=44337
authorfunkman <funkman@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 4 Feb 2008 02:10:39 +0000 (02:10 +0000)
committerfunkman <funkman@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 4 Feb 2008 02:10:39 +0000 (02:10 +0000)
Dir listing crashes if no readme-file present

Catch NamingException on resource not found instead of checking for null

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

java/org/apache/catalina/servlets/DefaultServlet.java

index 9f3f7c1..57631f2 100644 (file)
@@ -1415,7 +1415,10 @@ public class DefaultServlet
                     return buffer.toString();
                 }
             } catch (NamingException e) {
-                throw new ServletException("Error opening readme resource", e);
+                if (debug > 10)
+                    log("readme '" + readmeFile + "' not found", e);
+
+                return null;
             }
         }
 
@@ -1438,7 +1441,10 @@ public class DefaultServlet
                         return is;
                 }
             } catch (NamingException e) {
-                throw new ServletException("Error opening XSLT resource", e);
+                if (debug > 10)
+                    log("localXsltFile '" + localXsltFile + "' not found", e);
+
+                return null;
             }
         }