Hi
On 03/05/12 10:05, Govindaram PS wrote:
JsonProvider gets the following exception.
javax.xml.stream.XMLStreamException:
org.codehaus.jettison.json.JSONException: A JSONObject text must begin with
'{' at character 1 of junk

I fixed JSONProvider yesterday to throw 400 in this case, did not merge to 2.5.x yet, as there will be few more fixes coming in, in meantime registering a custom WebApplicationException mapper will be a good workaround. Another option to try: extend JSONProvider.readFrom and rethrow the caught WebApplicationException with a new status set

HTH, Sergey

-Govind

On Thu, May 3, 2012 at 11:36 AM, Govindaram PS<[email protected]>  wrote:

The original exception in the scenario I debugged
is org.codehaus.jettison.json.JSONException.

-Govind


On Wed, May 2, 2012 at 5:13 PM, Govindaram PS<[email protected]>  wrote:

I have a service which takes request body in Json format.
It is working fine when request body is in proper Json format.

When the request body has wrong data, CXF is throwing 500(Internal server
error) response.

The reason is readFrom api in JsonProvider is throwing default
WebApplicationError in case of exception.

http://svn.apache.org/repos/asf/cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JSONProvider.java


I want to throw 400(Bad request) in this case.
What is the best way to achieve this?

Thanks,
Govind






--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to