Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 382754

Summary: Server 500 error running hosted site
Product: [ECD] Orion Reporter: John Arthorne <john.arthorne>
Component: ServerAssignee: Mark Macdonald <mamacdon>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: mamacdon, simon_kaegi
Version: unspecifiedFlags: john.arthorne: review+
simon_kaegi: review+
Target Milestone: 0.5 RC3   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Complete server log none

Description John Arthorne CLA 2012-06-15 11:40:00 EDT
1709 on orion.eclipse.org

1) Create the "Sample HTML5 site"
2) Create a Site, mapping that project to the root ... '/'
3) Attempt to launch the site. It reports a 500 error from the server.

Here is what I see in the server log:

java.lang.NullPointerException: null
        at org.eclipse.equinox.http.registry.internal.DefaultRegistryHttpContext.getMimeType(DefaultRegistryHttpContext.java:46) ~[na:na]
        at org.eclipse.equinox.http.servlet.internal.ServletContextAdaptor.getMimeType(ServletContextAdaptor.java:126) ~[na:na]
        ... 98 common frames omitted
2012-06-15 11:32:32.123 [qtp551428318-44282] WARN  o.e.jetty.servlet.ServletHandler - /
java.lang.reflect.UndeclaredThrowableException: null
        at $Proxy0.getMimeType(Unknown Source) ~[na:na]
        at org.eclipse.orion.internal.server.hosting.HostedSiteServlet.addContentTypeHeader(HostedSiteServlet.java:287) ~[na:na]
        at org.eclipse.orion.internal.server.hosting.HostedSiteServlet.serveOrionFile(HostedSiteServlet.java:272) ~[na:na]
        at org.eclipse.orion.internal.server.hosting.HostedSiteServlet.serve(HostedSiteServlet.java:225) ~[na:na]
        at org.eclipse.orion.internal.server.hosting.HostedSiteServlet.service(HostedSiteServlet.java:166) ~[na:na]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) ~[javax.servlet_3.0.0.v201112011016.jar:na]
        at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180) ~[na:na]
        at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61) ~[na:na]
        at org.eclipse.equinox.http.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:38) ~[na:na]
        at org.eclipse.orion.internal.server.hosting.HostedSiteRequestFilter.doFilter(HostedSiteRequestFilter.java:50) ~[na:na]
admin@orion:~/current/eclipse>
Comment 1 John Arthorne CLA 2012-06-15 11:43:24 EDT
Created attachment 217441 [details]
Complete server log
Comment 2 John Arthorne CLA 2012-06-15 11:51:06 EDT
The problem is when the site definition has a trailing slash.. like this:


Mappings

Path                        Mounted at:

/hello/                     /
Comment 3 Mark Macdonald CLA 2012-06-15 12:24:35 EDT
The root of the problem was the path-translation logic not handling a trailing slash correctly, and translating it into "/". I will fix that.

Will also add a null check to avoid causing the NPE in equinox's getMimeType() implementation when the translated path is "/". This prevents the following (very unlikely) site setup from causing a 500 error:

Path                        Mounted at:

/                           /