Author: markt
Date: Wed Dec 10 21:30:43 2014
New Revision: 1644529

URL: http://svn.apache.org/r1644529
Log:
kkolinko review of fix for 
https://issues.apache.org/bugzilla/show_bug.cgi?id=57215
Don't return the uri if things go wrong. Given that the error states in 
question should never happen, throw an ISE instead.

Modified:
    tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties
    tomcat/trunk/java/org/apache/catalina/connector/Request.java

Modified: 
tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties?rev=1644529&r1=1644528&r2=1644529&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties Wed 
Dec 10 21:30:43 2014
@@ -31,6 +31,7 @@ coyoteConnector.parseBodyMethodNoTrace=T
 
 coyoteOutputStream.nbNotready=In non-blocking mode you may not write to the 
ServletOutputStream until the previous write has completed and isReady() 
returns true
 
+coyoteRequest.getContextPath.ise=Unable to find match between the canonical 
context path [{0}] and the URI presented by the user agent [{1}]
 coyoteRequest.getInputStream.ise=getReader() has already been called for this 
request
 coyoteRequest.getReader.ise=getInputStream() has already been called for this 
request
 coyoteRequest.gssLifetimeFail=Failed to obtain remaining lifetime for user 
principal [{0}]

Modified: tomcat/trunk/java/org/apache/catalina/connector/Request.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Request.java?rev=1644529&r1=1644528&r2=1644529&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Wed Dec 10 
21:30:43 2014
@@ -1886,7 +1886,9 @@ public class Request
         while (lastSlash > 0) {
             pos = nextSlash(uriChars, pos + 1);
             if (pos == -1) {
-                return uri;
+                // Should never happen
+                throw new IllegalStateException(sm.getString(
+                        "coyoteRequest.getContextPath.ise", 
canonicalContextPath, uri));
             }
             lastSlash--;
         }
@@ -1901,7 +1903,9 @@ public class Request
         while (!canonicalContextPath.equals(candidate)) {
             pos = nextSlash(uriChars, pos + 1);
             if (pos == -1) {
-                return uri;
+                // Should never happen
+                throw new IllegalStateException(sm.getString(
+                        "coyoteRequest.getContextPath.ise", 
canonicalContextPath, uri));
             }
             candidate = uri.substring(0, pos);
             candidate = UDecoder.URLDecode(candidate, 
connector.getURIEncoding());



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

Reply via email to