You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "michael Cheung (JIRA)" <ji...@apache.org> on 2010/02/10 01:39:27 UTC

[jira] Updated: (CXF-2666) @DefaultValue should be the default value instead of empty string

     [ https://issues.apache.org/jira/browse/CXF-2666?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

michael Cheung updated CXF-2666:
--------------------------------

    Attachment: InjectionUtils.java

Modify createParameterObject to return defaultValue when result is empty.

  String result = null;
            if (paramValues.size() > 0) {
		if (ParameterType.QUERY == pathParam) {
			result = result.trim().length() > 0 ? paramValues.get(0) : defaultValue;
		}
		else { 
                	boolean isLast = pathParam == ParameterType.PATH ? true : false;
                	result = isLast ? paramValues.get(paramValues.size() - 1)
                        	        : paramValues.get(0);
		}
            }


> @DefaultValue should be the default value instead of empty string
> -----------------------------------------------------------------
>
>                 Key: CXF-2666
>                 URL: https://issues.apache.org/jira/browse/CXF-2666
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.5, 2.2.6
>         Environment: mac OSX, jdk 1.6
>            Reporter: michael Cheung
>         Attachments: InjectionUtils.java
>
>
> When doing a HTTP GET /getFoo?id= to the resource below, the default value does not override the query parameter.
> @GET
> @Path("/getFoo")
> public Response getFoo(@QueryParam("id") @DefaultValue("-1") String gameId)
>     

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