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

            Bug ID: 56840
           Summary: RewriteValve in context.xml throws
                    NullPointerException
           Product: Tomcat 8
           Version: 8.0.9
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: stuer...@afi-stuttgart.de

I've added a RewriteValve in my context.xml, and have a simple rewrite.config
with one line:

RewriteRule ^/(?:[^/]+/)?(resources/.*)$ /SAPUI5/$1


When requesting a page with the matching URL, a 500 error is returned:

java.lang.NullPointerException
    org.apache.catalina.connector.Request.getContextPath(Request.java:1901)
   
org.apache.catalina.valves.rewrite.RewriteValve.invoke(RewriteValve.java:451)
[...]

I think the problem lies around line 447 in RewriteValve.java:
447                    request.getCoyoteRequest().requestURI().setString(null);
448                    CharChunk chunk =
request.getCoyoteRequest().requestURI().getCharChunk();
449                    chunk.recycle();
450                    if (context) {
451                        chunk.append(request.getContextPath());
452                    }

setString(null) sets the MessageBytes type to TYPE_NULL, and (context is true
in my case) request.getContextPath() tries to access cleared value, which
fails.

-- 
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