You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "qxo (Commented) (JIRA)" <ji...@apache.org> on 2012/02/09 09:28:59 UTC
[jira] [Commented] (WICKET-4387) StringIndexOutOfBoundsException
when forwarding requests
[ https://issues.apache.org/jira/browse/WICKET-4387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13204352#comment-13204352 ]
qxo commented on WICKET-4387:
-----------------------------
fix patch in org.apache.wicket.protocol.http.servlet.ServletWebRequest:
{code}
private Url getContextRelativeUrl(String uri, String filterPrefix)
{
if (filterPrefix.length() > 0 && !filterPrefix.endsWith("/"))
{
filterPrefix += "/";
}
StringBuilder url = new StringBuilder();
uri = Strings.stripJSessionId(uri);
final int start = httpServletRequest.getContextPath().length() + filterPrefix.length() + 1;
url.append(uri.length()<start ? uri: uri.substring(start)); //for WICKET-4387
if (errorAttributes == null)
{
String query = httpServletRequest.getQueryString();
if (!Strings.isEmpty(query))
{
url.append('?');
url.append(query);
}
}
return setParameters(Url.parse(url.toString(), getCharset()));
}
{code}
> StringIndexOutOfBoundsException when forwarding requests
> --------------------------------------------------------
>
> Key: WICKET-4387
> URL: https://issues.apache.org/jira/browse/WICKET-4387
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.5.4
> Reporter: Yossi Shaul
> Priority: Critical
> Attachments: wicket.zip
>
>
> We're getting StringIndexOutOfBoundsException from wicket when forwarding a request from our servlet filter (using request dispatcher) to wicket.
> The problem occurs whenever the original URI is shorter than the wicket filter mapping.
> I created an example webapp (based on the quickstart) in which a ForwardFilter is mapped to /f/* and it forwards all the requests to /wicket/ (see web.xml snippet below).
> With this webapp a request to "http://localhost:8081/wicket/f/" results in the following exception:
> {code}
> ERROR - RequestCycle - Error during processing error message
> java.lang.StringIndexOutOfBoundsException: String index out of range: -5
> at java.lang.String.substring(String.java:1958)
> at java.lang.String.substring(String.java:1925)
> at org.apache.wicket.protocol.http.servlet.ServletWebRequest.getContextRelativeUrl(ServletWebRequest.java:180)
> at org.apache.wicket.protocol.http.servlet.ServletWebRequest.getClientUrl(ServletWebRequest.java:140)
> at org.apache.wicket.request.UrlRenderer.<init>(UrlRenderer.java:59)
> at org.apache.wicket.request.cycle.RequestCycle.newUrlRenderer(RequestCycle.java:148)
> at org.apache.wicket.request.cycle.RequestCycle.getUrlRenderer(RequestCycle.java:172)
> at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:145)
> at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
> at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:781)
> at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
> at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:304)
> at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:313)
> at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:313)
> at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:313)
> at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:313)
> at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:313)
> at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:313)
> at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:313)
> at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:313)
> at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:313)
> at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:313)
> at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:227)
> at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283)
> at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
> at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
> at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
> at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
> at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
> at org.jfrog.ForwardFilter.doFilter(ForwardFilter.java:22)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
> at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
> at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
> at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:284)
> at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:322)
> at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1714)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
> at java.lang.Thread.run(Thread.java:722)
> {code}
> {code:title=web.xml snippet}
> <filter>
> <filter-name>forward</filter-name>
> <filter-class>org.jfrog.ForwardFilter</filter-class>
> </filter>
> <filter>
> <filter-name>wicket.wicket</filter-name>
> <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
> <init-param>
> <param-name>applicationClassName</param-name>
> <param-value>org.jfrog.WicketApplication</param-value>
> </init-param>
> </filter>
> <filter-mapping>
> <filter-name>forward</filter-name>
> <url-pattern>/f/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>wicket.wicket</filter-name>
> <url-pattern>/wicket/*</url-pattern>
> <dispatcher>FORWARD</dispatcher>
> <dispatcher>REQUEST</dispatcher>
> </filter-mapping>
> {code}
> This bug is opened here following a [bug we found|https://issues.jfrog.org/jira/browse/RTFACT-4767] in Artifactory after upgrading to Wicket 1.5
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira