You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2014/05/16 09:23:14 UTC
svn commit: r1595130 -
/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/ResourceServlet.java
Author: lofwyr
Date: Fri May 16 07:23:14 2014
New Revision: 1595130
URL: http://svn.apache.org/r1595130
Log:
TOBAGO-1394: Avoid StringIndexOutOfBoundsException in ResourceServlet
Modified:
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/ResourceServlet.java
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/ResourceServlet.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/ResourceServlet.java?rev=1595130&r1=1595129&r2=1595130&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/ResourceServlet.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/ResourceServlet.java Fri May 16 07:23:14 2014
@@ -129,8 +129,14 @@ public class ResourceServlet extends Htt
String resource = requestURI.substring(request.getContextPath().length() + 1);
for (final String resourceDir : resourceDirs) {
if (resource.startsWith(resourceDir)) {
- if (Character.isDigit(resource.charAt(resourceDir.length()+1))) {
- resource = resourceDir + resource.substring(resource.indexOf('/', resourceDir.length() + 1));
+ final int dirLength = resourceDir.length();
+ i final int dirLength = resourceDir.length();
+ if (dirLength < resource.length() && Character.isDigit(resource.charAt(dirLength + 1))) {
+ // cut off the version number
+ resource = resourceDir + resource.substring(resource.indexOf('/', dirLength + 1));
+ f (dirLength < resource.length() && Character.isDigit(resource.charAt(dirLength + 1))) {
+ // cut off the version number
+ resource = resourceDir + resource.substring(resource.indexOf('/', dirLength + 1));
}
break;
}