DO NOT REPLY [Bug 28058] - JspRuntimeLibrary.getContextRelativePath() can throw StringIndexOutOfBoundsException

2004-03-31 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=28058.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28058

JspRuntimeLibrary.getContextRelativePath() can throw StringIndexOutOfBoundsException





--- Additional Comments From [EMAIL PROTECTED]  2004-03-31 17:35 ---
You are right.  I ended up stripping out the code to handle that because I 
never got that far.  Here is the code:

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Example servlet
 *
 */

public class Test extends HttpServlet {

public void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {

ServletContext sc = getServletContext();
RequestDispatcher rd = sc.getNamedDispatcher(jsp);

Object attr = req.getAttribute  
(javax.servlet.include.request_uri);

if (attr != null) {
rd.include(req, resp);
req.setAttribute(javax.servlet.include.request_uri, 
attr);
} else {
try {
rd.forward(req, resp);
} catch (IllegalStateException e) {
rd.include(req, resp);
}
}
}
}

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 28058] - JspRuntimeLibrary.getContextRelativePath() can throw StringIndexOutOfBoundsException

2004-03-30 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=28058.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28058

JspRuntimeLibrary.getContextRelativePath() can throw StringIndexOutOfBoundsException





--- Additional Comments From [EMAIL PROTECTED]  2004-03-30 19:21 ---
I was able to reproduce your problem w/ TC 5.0.19.

I assume you have a chain of jsp:include, and have the following jsp-config
element in your web.xml:

jsp-config
  jsp-property-group
url-pattern/*/url-pattern
  /jsp-property-group
/jsp-config

If so, this bug has already been fixed - it is a duplicate of Bugzilla 27704
(Result of request.getServletPath() wrong in case JSP inside
jsp-property-group).

The fix is in CVS, and will be available in TC 5.0.21.

Please confirm that your problem is being caused by the above jsp-config, and I
will go ahead and close this bug as a duplicate of Bugzilla 27704.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 28058] - JspRuntimeLibrary.getContextRelativePath() can throw StringIndexOutOfBoundsException

2004-03-30 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=28058.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28058

JspRuntimeLibrary.getContextRelativePath() can throw StringIndexOutOfBoundsException





--- Additional Comments From [EMAIL PROTECTED]  2004-03-30 19:29 ---
Thats my problem.  Though it's not a chain of jsp includes.  I have a servlet 
that forwards a request to a JSP using the jsp named dispatcher.  The JSP 
then has an include in it.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 28058] - JspRuntimeLibrary.getContextRelativePath() can throw StringIndexOutOfBoundsException

2004-03-30 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=28058.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28058

JspRuntimeLibrary.getContextRelativePath() can throw StringIndexOutOfBoundsException





--- Additional Comments From [EMAIL PROTECTED]  2004-03-30 19:32 ---
The servlet is at

  servlet-mapping
servlet-namefoo/servlet-name
url-pattern/*/url-pattern
  /servlet-mapping

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 28058] - JspRuntimeLibrary.getContextRelativePath() can throw StringIndexOutOfBoundsException

2004-03-30 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=28058.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28058

JspRuntimeLibrary.getContextRelativePath() can throw StringIndexOutOfBoundsException





--- Additional Comments From [EMAIL PROTECTED]  2004-03-30 20:25 ---
Created an attachment (id=11064)
Test Case

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 28058] - JspRuntimeLibrary.getContextRelativePath() can throw StringIndexOutOfBoundsException

2004-03-30 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=28058.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28058

JspRuntimeLibrary.getContextRelativePath() can throw StringIndexOutOfBoundsException





--- Additional Comments From [EMAIL PROTECTED]  2004-03-30 20:26 ---
I have attached a test case.

/test/jsp/test.jsp displays This is a test
/test/jsp/include.jsp throws java.lang.StringIndexOutOfBoundsException

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 28058] - JspRuntimeLibrary.getContextRelativePath() can throw StringIndexOutOfBoundsException

2004-03-30 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=28058.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28058

JspRuntimeLibrary.getContextRelativePath() can throw StringIndexOutOfBoundsException

[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED



--- Additional Comments From [EMAIL PROTECTED]  2004-03-30 20:41 ---
I was able to reproduce this bug using the servlet wildcard mapping.

Bugzilla 27704 fixes the problem where the including JSP was mapped to by
a /* jsp-config mapping (and getServletPath() used to be empty), but it does
not address the case where a servlet mapped to by /* is the entry point.

Kin-Man committed a fix earlier that fixes this problem.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 28058] - JspRuntimeLibrary.getContextRelativePath() can throw StringIndexOutOfBoundsException

2004-03-30 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=28058.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28058

JspRuntimeLibrary.getContextRelativePath() can throw StringIndexOutOfBoundsException





--- Additional Comments From [EMAIL PROTECTED]  2004-03-30 23:59 ---
I think your test case has a problem unrelated to the
StringIndexOutOfBoundsException issue it uncovered.

Not only the initial request, but also the target of your jsp:include will be
routed through your test servlet (due to the /* mapping), which means you
end up doing a request dispatcher forward (from your servlet) inside an include.

As a result of this, you'll see this warning in the logs:

  WARNING: Internal error flushing the buffer in release(): java.io.IOException:
Stream closed

when releasing the page context of the including JSP.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]