You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2014/07/04 22:35:38 UTC

svn commit: r1607936 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/core/ApplicationHttpRequest.java webapps/docs/changelog.xml

Author: markt
Date: Fri Jul  4 20:35:37 2014
New Revision: 1607936

URL: http://svn.apache.org/r1607936
Log:
When the current PathInfo is modified as a result of dispatching a request, ensure that a call to HttpServletRequest.getPathTranslated() returns a value that is based on the modified PathInfo.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1607930-1607931

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java?rev=1607936&r1=1607935&r2=1607936&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java Fri Jul  4 20:35:37 2014
@@ -451,6 +451,20 @@ class ApplicationHttpRequest extends Htt
 
 
     /**
+     * Override the <code>getPathTranslated()</code> method of the wrapped
+     * request.
+     */
+    @Override
+    public String getPathTranslated() {
+        if (getPathInfo() == null) {
+            return null;
+        }
+
+        return getServletContext().getRealPath(getPathInfo());
+    }
+
+
+    /**
      * Override the <code>getQueryString()</code> method of the wrapped
      * request.
      */

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1607936&r1=1607935&r2=1607936&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri Jul  4 20:35:37 2014
@@ -135,6 +135,12 @@
         <code>HttpServletRequest.getServletContext()</code> returns the correct
         value during a cross-context dispatch. (markt)
       </fix>
+      <fix>
+        When the current PathInfo is modified as a result of dispatching a
+        request, ensure that a call to
+        <code>HttpServletRequest.getPathTranslated()</code> returns a value that
+        is based on the modified PathInfo. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



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


Re: svn commit: r1607936 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/core/ApplicationHttpRequest.java webapps/docs/changelog.xml

Posted by Mark Thomas <ma...@apache.org>.
On 06/07/2014 13:18, Konstantin Kolinko wrote:
> 2014-07-05 0:35 GMT+04:00  <ma...@apache.org>:
>> Author: markt
>> Date: Fri Jul  4 20:35:37 2014
>> New Revision: 1607936
>>
>> URL: http://svn.apache.org/r1607936
>> Log:
>> When the current PathInfo is modified as a result of dispatching a request, ensure that a call to HttpServletRequest.getPathTranslated() returns a value that is based on the modified PathInfo.
>>
>> Modified:
>>     tomcat/tc7.0.x/trunk/   (props changed)
>>     tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java
>>     tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
>>
>> Propchange: tomcat/tc7.0.x/trunk/
>> ------------------------------------------------------------------------------
>>   Merged /tomcat/trunk:r1607930-1607931
>>
>> Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java
>> URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java?rev=1607936&r1=1607935&r2=1607936&view=diff
>> ==============================================================================
>> --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java (original)
>> +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java Fri Jul  4 20:35:37 2014
>> @@ -451,6 +451,20 @@ class ApplicationHttpRequest extends Htt
>>
>>
>>      /**
>> +     * Override the <code>getPathTranslated()</code> method of the wrapped
>> +     * request.
>> +     */
>> +    @Override
>> +    public String getPathTranslated() {
>> +        if (getPathInfo() == null) {
>> +            return null;
>> +        }
>> +
>> +        return getServletContext().getRealPath(getPathInfo());
> 
> According to recent r1607935, the getServletContext() method may
> return null, causing an NPE here.

Thanks. Fixed for 8.0.x and 7.0.x.

Mark


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


Re: svn commit: r1607936 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/core/ApplicationHttpRequest.java webapps/docs/changelog.xml

Posted by Konstantin Kolinko <kn...@gmail.com>.
2014-07-05 0:35 GMT+04:00  <ma...@apache.org>:
> Author: markt
> Date: Fri Jul  4 20:35:37 2014
> New Revision: 1607936
>
> URL: http://svn.apache.org/r1607936
> Log:
> When the current PathInfo is modified as a result of dispatching a request, ensure that a call to HttpServletRequest.getPathTranslated() returns a value that is based on the modified PathInfo.
>
> Modified:
>     tomcat/tc7.0.x/trunk/   (props changed)
>     tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java
>     tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
>
> Propchange: tomcat/tc7.0.x/trunk/
> ------------------------------------------------------------------------------
>   Merged /tomcat/trunk:r1607930-1607931
>
> Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java
> URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java?rev=1607936&r1=1607935&r2=1607936&view=diff
> ==============================================================================
> --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java (original)
> +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java Fri Jul  4 20:35:37 2014
> @@ -451,6 +451,20 @@ class ApplicationHttpRequest extends Htt
>
>
>      /**
> +     * Override the <code>getPathTranslated()</code> method of the wrapped
> +     * request.
> +     */
> +    @Override
> +    public String getPathTranslated() {
> +        if (getPathInfo() == null) {
> +            return null;
> +        }
> +
> +        return getServletContext().getRealPath(getPathInfo());

According to recent r1607935, the getServletContext() method may
return null, causing an NPE here.

> +    }
> +

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