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 2014/08/12 15:12:01 UTC

[Bug 56840] New: RewriteValve in context.xml throws NullPointerException

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: stuermer@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56840] RewriteValve in context.xml throws NullPointerException

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

Remy Maucherat <re...@apache.org> changed:

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

--- Comment #1 from Remy Maucherat <re...@apache.org> ---
The fix will be included in 8.0.11+.

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