Description
I get this exception when trying to create a URL with RequestCycle#urlFor:
org.apache.wicket.WicketRuntimeException: An error occurred while generating an Url for handler 'ResourceReferenceRequestHandler
{resourceReference=scope: org.apache.wicket.Application; name: ImageResource; locale: null; style: null; variation: null, pageParameters=publicId=[f74df62d-cbdb-49db-96e4-36e3ea62610e], type=[sr]}'
at org.apache.wicket.request.cycle.RequestCycle.urlFor(RequestCycle.java:516) [wicket-core-6.6.0.jar:6.6.0]
at org.apache.wicket.request.cycle.RequestCycle.urlFor(RequestCycle.java:473) [wicket-core-6.6.0.jar:6.6.0]
at xxx.XXXWebApplication.urlFor(XXXWebApplication.java:161) ~[xxx-web-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
[...]
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:604) ~[na:1.7.0_10]
at java.util.ArrayList.remove(ArrayList.java:445) ~[na:1.7.0_10]
at org.apache.wicket.request.UrlRenderer.removeCommonPrefixes(UrlRenderer.java:319) ~[wicket-request-6.6.0.jar:6.6.0]
at org.apache.wicket.request.UrlRenderer.renderRelativeUrl(UrlRenderer.java:220) ~[wicket-request-6.6.0.jar:6.6.0]
at org.apache.wicket.request.UrlRenderer.renderUrl(UrlRenderer.java:117) ~[wicket-request-6.6.0.jar:6.6.0]
at org.apache.wicket.request.cycle.RequestCycle.renderUrl(RequestCycle.java:529) [wicket-core-6.6.0.jar:6.6.0]
at org.apache.wicket.request.cycle.RequestCycle.urlFor(RequestCycle.java:511) [wicket-core-6.6.0.jar:6.6.0]
... 46 common frames omitted
The app uses a context path and no filter path. I see that UrlRenderer#removeCommonPrefixes receives an empty list and the code in the method assumes that context path + filter path is always a common prefix and tries to remove it later from the empty list.