You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2013/08/08 14:44:48 UTC
[jira] [Resolved] (WICKET-5287) NumberFormatException when parsing
the port from Requests with invalid URIs
[ https://issues.apache.org/jira/browse/WICKET-5287?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Grigorov resolved WICKET-5287.
-------------------------------------
Resolution: Fixed
Fix Version/s: 6.10.0
7.0.0
> NumberFormatException when parsing the port from Requests with invalid URIs
> ---------------------------------------------------------------------------
>
> Key: WICKET-5287
> URL: https://issues.apache.org/jira/browse/WICKET-5287
> Project: Wicket
> Issue Type: Bug
> Affects Versions: 1.5.10, 6.9.1
> Reporter: Martin Funk
> Assignee: Martin Grigorov
> Fix For: 7.0.0, 6.10.0
>
>
> we still can reproduce this on any version.
> Maybe this git diff gives a clearer picture:
> diff --git a/wicket-core/src/test/java/org/apache/wicket/protocol/http/servlet/ServletWebRequestTest.java b/wicket-core/src/test/java/org/apache/wicket/protocol/http/servlet/ServletWebRequestTest.java
> index f974a06..9ee3308 100644
> --- a/wicket-core/src/test/java/org/apache/wicket/protocol/http/servlet/ServletWebRequestTest.java
> +++ b/wicket-core/src/test/java/org/apache/wicket/protocol/http/servlet/ServletWebRequestTest.java
> @@ -191,6 +191,16 @@
> assertEquals("any/source/of/error", errorClientUrl.toString());
> }
>
> + @Test
> + public void wicketFoo()
> + {
> + String filterPath = "filterPath";
> + MockHttpServletRequest httpRequest = new MockHttpServletRequest(null, null, null);
> + httpRequest.setURL("http://localhost" + '/' + filterPath + "/request/foo://:/");
> +
> + ServletWebRequest webRequest = new ServletWebRequest(httpRequest, filterPath);
> + }
> +
> private static class CustomRequestPage extends WebPage implements IMarkupResourceStreamProvider
> {
> private static final long serialVersionUID = 1L;
> This tests leads to this exption
> java.lang.NumberFormatException: For input string: ""
> at java.lang.NumberFormatException.forInputString(Unknown Source)
> at java.lang.Integer.parseInt(Unknown Source)
> at java.lang.Integer.parseInt(Unknown Source)
> at org.apache.wicket.request.Url.parse(Url.java:277)
> at org.apache.wicket.protocol.http.servlet.ServletWebRequest.getContextRelativeUrl(ServletWebRequest.java:208)
> at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:112)
> at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:82)
> at org.apache.wicket.protocol.http.servlet.ServletWebRequestTest.wicketFoo(ServletWebRequestTest.java:201)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
> at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
> at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
> at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira