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-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 >> > >
