https://issues.apache.org/bugzilla/show_bug.cgi?id=53531

          Priority: P2
            Bug ID: 53531
          Assignee: dev@tomcat.apache.org
           Summary: ExpandWar.expand does not check the return value of
                    File.mkdirs
          Severity: trivial
    Classification: Unclassified
                OS: All
          Reporter: ch...@christopherschultz.net
          Hardware: All
            Status: NEW
           Version: 5.5.35
         Component: Catalina
           Product: Tomcat 5

http://markmail.org/message/fvyxksx7muk3icr4

o.a.c.startup.ExpandWar.expand() calls File.mkdirs on line 165 and does not
check the return value. If the call fails, a subsequent attempt to create a new
FileOutputStream for a file in the (failed-to-create) directory results in a
FileNotFoundException with the whole filename as the message. Here is an
example from the above tomcat-user original post:

SEVERE: Exception fixing docBase: {0}
    java.io.FileNotFoundException:
/home/surgnet/public_html/sample/META-INF/MANIFEST.MF (No such file or
directory)
            at java.io.FileOutputStream.open(Native Method)
            at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
            at java.io.FileOutputStream.<init>(FileOutputStream.java:145)
            at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:457)
            at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:173)

This is confusing to users because the real issue has been hidden: the
inability to create the parent directory for the file.

The analogous code in the current trunk is:

                    if (!parent.mkdirs() && !parent.isDirectory()) {
                        throw new IOException(
                                sm.getString("expandWar.createFailed",
parent));
                    }

I believe this is the correct approach, which should be adopted for Tomcat 5.5.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to