You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2009/12/01 16:07:10 UTC

DO NOT REPLY [Bug 48318] New: WebDAV servlet returns 500 if files not readable

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

           Summary: WebDAV servlet returns 500 if files not readable
           Product: Tomcat 6
           Version: 6.0.20
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Servlet & JSP API
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: mcarpenter@free.fr


If a directory contains a file that is not readable by the Tomcat
process (eg file permissions, dangling symlink) then Tomcat throws a
NullPointerException and returns a 500 Internal Server Error to the
client.

Throwing NPE in these circumstances is certainly wrong.  Returning 500
with no further information is unhelpful behavior and should be fixed.
Generally, interfaces of this type at least list inaccessible files
(Windows Explorer, UNIX ls(1), BSD FTP client, ...) and only return an
error when one attempts to access such a file.

markt suggests an alternative of simply ignoring inaccessible files but notes
that "could cause issues if a user tries to upload a file of that name" and
suggests better error reporting.


Stack:

    SEVERE: Servlet.service() for servlet webdav threw exception
    java.lang.NullPointerException
            at
org.apache.catalina.servlets.WebdavServlet.parseProperties(Unknown Source)
            at org.apache.catalina.servlets.WebdavServlet.doPropfind(Unknown
Source)
            at org.apache.catalina.servlets.WebdavServlet.service(Unknown
Source)
            at javax.servlet.http.HttpServlet.service(Unknown Source)
            ...


Method parseProperties() is in
java/org/apache/catalina/servlets/WebdavServlet.java.org and the NPE
happens when cacheEntry.attributes is null (case FIND_BY_PROPERTY in my
testing and possibly in other cases too).

Following the breadcrumbs via:

    cacheEntry = resources.lookupCache(path);

leads eventually to java/org/apache/naming/resources/FileDirContext.java:

    public Attributes getAttributes(String name, String[] attrIds)
        throws NamingException {
        // Building attribute list
        File file = file(name);
        if (file == null)
            throw new NamingException
                (sm.getString("resources.notFound", name));
    ...
    protected File file(String name) {
        File file = new File(base, name);
        if (file.exists() && file.canRead()) {
            ... // do useful stuff
        } else {
            return null; // ouch
        }

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 48318] WebDAV servlet returns 500 if files not readable

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48318

--- Comment #1 from Mark Thomas <ma...@apache.org> 2010-02-12 22:16:32 UTC ---
This has been fixed in trunk and proposed for 6.0.x

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 48318] WebDAV servlet returns 500 if files not readable

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48318

--- Comment #3 from Rico Neubauer <r....@seeburger.de> 2011-03-15 09:23:23 EDT ---
Besides dead links or missing permissions, also a folder with a trailing dot in
its name leads to this error. e.g. "00."

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 48318] WebDAV servlet returns 500 if files not readable

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48318

Rico Neubauer <r....@seeburger.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.neubauer@seeburger.de

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 48318] WebDAV servlet returns 500 if files not readable

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48318

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #2 from Mark Thomas <ma...@apache.org> 2010-02-22 21:15:22 UTC ---
This has been fixed in 6.0.x and will be included in 6.0.25 onwards.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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