You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/12/21 22:10:08 UTC

DO NOT REPLY [Bug 25680] New: - Exception thrown when including a jsp mapped to a custom servlet name

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25680>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25680

Exception thrown when including a jsp mapped to a custom servlet name

           Summary: Exception thrown when including a jsp mapped to a custom
                    servlet name
           Product: Tomcat 5
           Version: 5.0.16
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Blocker
          Priority: Other
         Component: Jasper
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: sabiq@purdue.edu


In essence, when index.jsp includes using a custom name /include/included.jsp 
which is defined as a servlet that maps to a custom name /included.jsp, 
StringIndexOutOfBoundsException is thrown.
The fix is trivial:
jakarta-tomcat-5.0.16-src\jakarta-tomcat-jasper\jasper2
\src\share\org\apache\jasper\servlet\JspServlet.java:

204,214c204,210
<             if (requestUri != null) {
<               // rs: avoid out of range exception
<               int index = requestUri.indexOf(includeUri);
<               if (index > -1) {
<                       String currentIncludedUri
<                           = requestUri.substring(index);
<
<                       if ( !includeUri.equals(currentIncludedUri) ) {
<                           includeUri = currentIncludedUri;
<                       }
<               }
---
>             if (requestUri != null){
>                 String currentIncludedUri
>                     = requestUri.substring(requestUri.indexOf(includeUri));
>
>                 if ( !includeUri.equals(currentIncludedUri) ) {
>                     includeUri = currentIncludedUri;
>                 }

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