Author: violetagg Date: Wed Aug 31 11:16:49 2016 New Revision: 1758584 URL: http://svn.apache.org/viewvc?rev=1758584&view=rev Log: Fixed StringIndexOutOfBoundsException when trying to get the first char of an empty string. String.substring methods always return an object. Based on a patch provided by wuwen via Github. This closes apache/tomcat70#10 and apache/tomcat80#6
Modified: tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java?rev=1758584&r1=1758583&r2=1758584&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java (original) +++ tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java Wed Aug 31 11:16:49 2016 @@ -115,7 +115,7 @@ public class JspCompilationContext { String baseURI = jspUri.substring(0, jspUri.lastIndexOf('/') + 1); // hack fix for resolveRelativeURI - if (baseURI == null) { + if (baseURI.isEmpty()) { baseURI = "/"; } else if (baseURI.charAt(0) != '/') { // strip the base slash since it will be combined with the Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1758584&r1=1758583&r2=1758584&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Wed Aug 31 11:16:49 2016 @@ -271,6 +271,10 @@ Ignore <code>engineOptionsClass</code> and <code>scratchdir</code> when running under a security manager. (markt) </fix> + <fix> + Fixed StringIndexOutOfBoundsException. Based on a patch provided by + wuwen via Github. (violetagg) + </fix> </changelog> </subsection> <subsection name="WebSocket"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org