|
From: Bill B. <bb...@re...> - 2008-06-17 11:13:05
|
ResourceLocator gets hit when:
@Path(...)
public class RootResource {
@Path(...)
public Subresource getSubResource() {...}
}
If you are following me.
Martin Algesten wrote:
>
> There's something I'm missing. I can't work out in why I hit the method:
>
> org.resteasy.ResourceLocator.createResource()
>
> With my test project I do hit it, and that's why I get the uncaught
> NumberFormatException - however I don't understand how I can make a
> test case that use this method, the TestSmoke etc don't seem to hit it -
> so for now I've logged the jira bug and attached a patch that fixes the
> problem, but doesn't have a test case.
>
> Martin
>
>
> On 16 Jun 2008, at 21:15, Bill Burke wrote:
>
>> I'd say 400. Bad request. Please log jira bug. Thanks.
>>
>> Martin Algesten wrote:
>>> In my code I have the following subresource locator:
>>> @Path("{number}")
>>> public AccountResource getAccount( @PathParam("number") int number ) {
>>> This is the only method that can match anything. If I pass in
>>> something that can not get interpreted as a string I get a 500 and a
>>> NumberFormatException - which doesn't seem entirely right. However
>>> from the spec I struggle to work out what it should be. 404? 400?. I
>>> plan to file it as a bug, but would like to provide a test case for
>>> it as well - so I need to work out the wanted behaviour.
>>> Here's the stack trace:
>>> java.lang.NumberFormatException: For input string: "q"
>>> at
>>> java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
>>> at java.lang.Integer.parseInt(Integer.java:447)
>>> at java.lang.Integer.valueOf(Integer.java:553)
>>> at
>>> org.resteasy.util.StringToPrimitive.stringToPrimitiveBoxType(StringToPrimitive.java:18)
>>> at
>>> org.resteasy.StringParameterInjector.extractValue(StringParameterInjector.java:143)
>>> at org.resteasy.PathParamInjector.inject(PathParamInjector.java:44)
>>> at
>>> org.resteasy.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:53)
>>> at org.resteasy.ResourceLocator.createResource(ResourceLocator.java:64)
>>> Martin
>>>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|