cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joe Sunday (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CXF-1675) @QueryParam is not following reference javadoc for primitive types
Date Sat, 28 Jun 2008 18:17:45 GMT

    [ https://issues.apache.org/jira/browse/CXF-1675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12609030#action_12609030
] 

Joe Sunday commented on CXF-1675:
---------------------------------

Not sure if this should be split into a second issue, but @DefaultValue doesn't appear to
be used at all for objects either:
public Result getUpdates(@PathParam("since") long since, @QueryParam("terse") @DefaultValue("false")
Boolean terse) { ... } 
public Result getUpdates(@PathParam("since") long since, @QueryParam("terse") @DefaultValue("true")
Boolean terse) { ... } 

Get without query string in both cases results in terse = null instead of the @DefaultValue
specified.



> @QueryParam is not following reference javadoc for primitive types
> ------------------------------------------------------------------
>
>                 Key: CXF-1675
>                 URL: https://issues.apache.org/jira/browse/CXF-1675
>             Project: CXF
>          Issue Type: Bug
>          Components: REST
>    Affects Versions: 2.1.2
>            Reporter: Joe Sunday
>
> The reference javadoc for @DefaultValue states:
> If this annotation is not used and the corresponding metadata is not present in the request,
the value will be an empty collection for List, Set or SortedSet, null for other object types,
and the Java-defined default for primitive types.
> If @QueryParameter is used with a primitive type, a null pointer exeption is thrown rather
than setting the parameter to the java-defined default:
> @Path("/update/{id}")
> @GET
> public Result getUpdates(@PathParam("since") long since, @QueryParam("terse") boolean
terse) { ... }
> org.apache.cxf.interceptor.Fault: null while invoking public com.example.Result com.example.Service.getUpdates(long,boolean)
with params [0, null].
>         at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:121)
>         at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:113)
>         at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:98)
>         at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:53)
>         at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56)
>         at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
> $ curl http://localhost:2259/example/update/0
> <ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring
xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.IllegalArgumentException</ns1:faultstring></ns1:XMLFault>
> It seems to ignore @DefaultValue altogether, as the same fault happens if the method
is changed to:
> public Result getUpdates(@PathParam("since") long since, @QueryParam("terse") @DefaultValue("false")
boolean terse) { ... }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message