Bug 44337 - Dir listing crashes if no readme-file present
Summary: Dir listing crashes if no readme-file present
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 6.0.14
Hardware: Sun Windows Server 2003
: P2 blocker (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL: http://www.a-weinert.de
Depends on:
Reported: 2008-02-01 01:54 UTC by Dr. Albrecht Weinert
Modified: 2008-02-12 08:17 UTC (History)
1 user (show)

Patch to DefaultServlet.java (1.00 KB, patch)
2008-02-02 10:34 UTC, Tim Funk
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dr. Albrecht Weinert 2008-02-01 01:54:32 UTC
DefaultServlet docu 6.0  says about attibute readmeFile:
If a directory listing is presented, a readme file
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.
Error opening readme resource at

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:

Comment 1 Tim Funk 2008-02-02 10:34:59 UTC
Created attachment 21461 [details]
Patch to DefaultServlet.java

Patch is for tomcat6 trunk. 

When the readme resource is not found. A NamingException is thrown instead of
assuming null is returned.

Patch eats the NamingException and returns null as well as optionally logs it
if debugging turned up very high.

Same condition can occur with the localxslt lookup.
Comment 2 Tim Funk 2008-02-12 08:17:55 UTC
applied to version 6.0.17+