Revision: 1299
Author: dhanji
Date: Thu Oct 21 05:35:46 2010
Log: Tentative fix for string index out of bounds exception in issue #560
http://code.google.com/p/google-guice/source/detail?r=1299

Modified:
/trunk/extensions/servlet/src/com/google/inject/servlet/ServletDefinition.java

=======================================
--- /trunk/extensions/servlet/src/com/google/inject/servlet/ServletDefinition.java Sat Oct 16 18:31:25 2010 +++ /trunk/extensions/servlet/src/com/google/inject/servlet/ServletDefinition.java Thu Oct 21 05:35:46 2010
@@ -202,9 +202,9 @@
       @Override
       public String getPathInfo() {
         if (!isPathInfoComputed()) {
-          final int servletPathLength = getServletPath().length();
- pathInfo = getRequestURI().substring(getContextPath().length()).replaceAll("[/]{2,}", "/")
-              .substring(servletPathLength);
+          int servletPathLength = getServletPath().length();
+ pathInfo = getRequestURI().substring(getContextPath().length()).replaceAll("[/]{2,}", "/"); + pathInfo = pathInfo.length() > servletPathLength ? pathInfo.substring(servletPathLength) : null;

// Corner case: when servlet path and request path match exactly (without trailing '/'),
           // then pathinfo is null

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice-dev?hl=en.

Reply via email to