Project: Tomcat
Bug 44337 Dir listing crashes if no readme-file present
Reported: 2008-02-01 01:54:32 | Status: resolved fixed

DefaultServlet docu 6.0 says about attibute readmeFile: If a directory listing is presented, a readme file *may* also be presented with the listing. This file is inserted ..... This was true for 5.5.x. 6.0.14 crashes if the file is absent in the listed directory. javax.servlet.ServletException: Error opening readme resource at org.apache.catalina.servlets.DefaultServlet.getReadme(DefaultServlet.java:1418) This new behaviour blocks the listing of big directory trees managed by others, where the work-around is nor feasible. Work around 1: readme file in *every* subdir, empty (length=0) if none wanted (and subsequent changes in the used XSL-Transformers) Work around 2: Change "may" to "must" in docu. Repair: fix DefaultServlet From web.xml: <servlet> <servlet-name>default</servlet-name> <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class> <init-param> <param-name>listings</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>globalXsltFile</param-name> <param-value>D:\www\serv-intra\meva-dir-li.xsl</param-value> </init-param> <init-param> <param-name>readmeFile</param-name> <param-value>readme.htm</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet>

Files changed in fix:
java/org/apache/catalina/servlets/DefaultServlet.java