You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Jorge Williams <jo...@rackspace.com> on 2009/07/31 22:27:12 UTC

PATCH: JAX-RS Handle possible number format exception when reading primitive param

Hello all,

We ran into this issue in JAX-RS:   A request to something like /path/ 
to/{id} where {id} is expected to be an integer would throw a  
NumberFormatException in the case where we send something other than  
an integer (/path/to/bla, for example).  The NumberFormatException  
didn't find its way to our ExceptionMapper and resulted in an XMLFault  
being serialized which is wrong.

The attached patch fixes things for us.  We simply capture the NFE and  
resend it as a WebApplicationException -- we send a  404 when we're  
dealing with path params and 400 otherwise.  The patch is against the  
current trunk but honestly we've really only tested against 2.2.2 --  
since that's what we're using :-)

Regards,

jOrGe W.




Confidentiality Notice: This e-mail message (including any attached or
embedded documents) is intended for the exclusive and confidential use of the
individual or entity to which this message is addressed, and unless otherwise
expressly indicated, is confidential and privileged information of Rackspace. 
Any dissemination, distribution or copying of the enclosed material is prohibited.
If you receive this transmission in error, please notify us immediately by e-mail
at abuse@rackspace.com, and delete the original message. 
Your cooperation is appreciated.


RE: PATCH: JAX-RS Handle possible number format exception when reading primitive param

Posted by Jorge Williams <jo...@rackspace.com>.
Done.  CXF-2374.

-jOrGe W.

________________________________________
From: Daniel Kulp [dkulp@apache.org]
Sent: Friday, July 31, 2009 3:54 PM
To: dev@cxf.apache.org
Cc: Jorge Williams
Subject: Re: PATCH: JAX-RS Handle possible number format exception when reading primitive param

Can you file a JIRA at:
https://issues.apache.org/jira/browse/CXF
and attach the patch there.   The Apache mail system stripped off the
attachment.

Dan


On Fri July 31 2009 4:27:12 pm Jorge Williams wrote:
> Hello all,
>
> We ran into this issue in JAX-RS:   A request to something like /path/
> to/{id} where {id} is expected to be an integer would throw a
> NumberFormatException in the case where we send something other than
> an integer (/path/to/bla, for example).  The NumberFormatException
> didn't find its way to our ExceptionMapper and resulted in an XMLFault
> being serialized which is wrong.
>
> The attached patch fixes things for us.  We simply capture the NFE and
> resend it as a WebApplicationException -- we send a  404 when we're
> dealing with path params and 400 otherwise.  The patch is against the
> current trunk but honestly we've really only tested against 2.2.2 --
> since that's what we're using :-)
>
> Regards,
>
> jOrGe W.
>
>
>
>
> Confidentiality Notice: This e-mail message (including any attached or
> embedded documents) is intended for the exclusive and confidential use of
> the individual or entity to which this message is addressed, and unless
> otherwise expressly indicated, is confidential and privileged information
> of Rackspace. Any dissemination, distribution or copying of the enclosed
> material is prohibited. If you receive this transmission in error, please
> notify us immediately by e-mail at abuse@rackspace.com, and delete the
> original message.
> Your cooperation is appreciated.

--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog


Confidentiality Notice: This e-mail message (including any attached or
embedded documents) is intended for the exclusive and confidential use of the
individual or entity to which this message is addressed, and unless otherwise
expressly indicated, is confidential and privileged information of Rackspace. 
Any dissemination, distribution or copying of the enclosed material is prohibited.
If you receive this transmission in error, please notify us immediately by e-mail
at abuse@rackspace.com, and delete the original message. 
Your cooperation is appreciated.


Re: PATCH: JAX-RS Handle possible number format exception when reading primitive param

Posted by Daniel Kulp <dk...@apache.org>.
Can you file a JIRA at:
https://issues.apache.org/jira/browse/CXF
and attach the patch there.   The Apache mail system stripped off the 
attachment.

Dan


On Fri July 31 2009 4:27:12 pm Jorge Williams wrote:
> Hello all,
>
> We ran into this issue in JAX-RS:   A request to something like /path/
> to/{id} where {id} is expected to be an integer would throw a
> NumberFormatException in the case where we send something other than
> an integer (/path/to/bla, for example).  The NumberFormatException
> didn't find its way to our ExceptionMapper and resulted in an XMLFault
> being serialized which is wrong.
>
> The attached patch fixes things for us.  We simply capture the NFE and
> resend it as a WebApplicationException -- we send a  404 when we're
> dealing with path params and 400 otherwise.  The patch is against the
> current trunk but honestly we've really only tested against 2.2.2 --
> since that's what we're using :-)
>
> Regards,
>
> jOrGe W.
>
>
>
>
> Confidentiality Notice: This e-mail message (including any attached or
> embedded documents) is intended for the exclusive and confidential use of
> the individual or entity to which this message is addressed, and unless
> otherwise expressly indicated, is confidential and privileged information
> of Rackspace. Any dissemination, distribution or copying of the enclosed
> material is prohibited. If you receive this transmission in error, please
> notify us immediately by e-mail at abuse@rackspace.com, and delete the
> original message.
> Your cooperation is appreciated.

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog