Author: remm
Date: Tue Aug 12 13:31:17 2014
New Revision: 1617471
URL: http://svn.apache.org/r1617471
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56840
BZ56840: Tomcat gets the context path from the URI (rather than from the
mapping data, which is another possible source) so it is not possible to reset
it before getting it.
Modified:
tomcat/trunk/java/org/apache/catalina/valves/rewrite/RewriteValve.java
tomcat/trunk/webapps/docs/changelog.xml
Modified: tomcat/trunk/java/org/apache/catalina/valves/rewrite/RewriteValve.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/rewrite/RewriteValve.java?rev=1617471&r1=1617470&r2=1617471&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/valves/rewrite/RewriteValve.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/valves/rewrite/RewriteValve.java Tue
Aug 12 13:31:17 2014
@@ -444,11 +444,15 @@ public class RewriteValve extends ValveB
urlString = urlString.substring(0, queryIndex);
}
// Set the new URL
+ String contextPath = null;
+ if (context) {
+ contextPath = request.getContextPath();
+ }
request.getCoyoteRequest().requestURI().setString(null);
CharChunk chunk =
request.getCoyoteRequest().requestURI().getCharChunk();
chunk.recycle();
if (context) {
- chunk.append(request.getContextPath());
+ chunk.append(contextPath);
}
chunk.append(urlString);
request.getCoyoteRequest().requestURI().toChars();
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1617471&r1=1617470&r2=1617471&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Tue Aug 12 13:31:17 2014
@@ -132,6 +132,10 @@
<bug>56825</bug>: Enable pre-emptive authentication to work with the
SSL authenticator. Based on a patch by jlmonteiro. (markt)
</fix>
+ <fix>
+ <bug>56840</bug>: Avoid NPE when the rewrite valve is mapped to
+ a context. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]