You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by SK <sk...@gmail.com> on 2012/10/02 02:04:16 UTC

JSON request - unknown field/element

Hello,
We are using CXF for REST and Jettison 1.3.2. For a JSON request when SAXParseException is thrown the column and line are incorrect in the exception. The line is always -1 and the column is 0. Note, this is not the case for the same request is XML. Is there any way to get the line/column detail JSON requests when the reader/unmarshaller encounters an unknown element? Thanks!

- Steve

Re: JSON request - unknown field/element

Posted by SK <sk...@gmail.com>.
Thanks Sergey!

- Steve

On Oct 2, 2012, at 2:45 AM, Sergey Beryozkin <sb...@gmail.com> wrote:

> Hi
> On 02/10/12 01:04, SK wrote:
>> Hello,
>> We are using CXF for REST and Jettison 1.3.2. For a JSON request when SAXParseException is thrown the column and line are incorrect in the exception. The line is always -1 and the column is 0. Note, this is not the case for the same request is XML. Is there any way to get the line/column detail JSON requests when the reader/unmarshaller encounters an unknown element? Thanks!
> I'm not sure that SAXParserException should even be exposed in such cases given that SAXParserException is XML centric exception, I guess it does escape from the parsing layer.
> 
> I think that the issue is that Jettison does not correctly implement some of the relevant reader methods. Perhaps it is possible to tweak it for a 'column' in the exception to point to the actual character in the JSON sequence which caused an error. I'll have a look later when I start working on the next Jettison release
> 
> Cheers, Sergey
> 
>> - Steve
> 

Re: JSON request - unknown field/element

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 02/10/12 12:45, Sergey Beryozkin wrote:
> Hi
> On 02/10/12 01:04, SK wrote:
>> Hello,
>> We are using CXF for REST and Jettison 1.3.2. For a JSON request when
>> SAXParseException is thrown the column and line are incorrect in the
>> exception. The line is always -1 and the column is 0. Note, this is
>> not the case for the same request is XML. Is there any way to get the
>> line/column detail JSON requests when the reader/unmarshaller
>> encounters an unknown element? Thanks!
>>
> I'm not sure that SAXParserException should even be exposed in such
> cases given that SAXParserException is XML centric exception, I guess it
> does escape from the parsing layer.
>
> I think that the issue is that Jettison does not correctly implement
> some of the relevant reader methods. Perhaps it is possible to tweak it
> for a 'column' in the exception to point to the actual character in the
> JSON sequence which caused an error. I'll have a look later when I start
> working on the next Jettison release
>

An absolute column number will be reported started from Jettison 1.3.3 
(this will be available in the original JSONException and 
XMLStreamException Location object at the CXF level, with 
XMLStreamException being wrapped within WebApplicationException)

Calculating the line is more sensitive, will get it fixed sometime 
later, Jettison patch will also be welcome

Cheers, Sergey
>
>> - Steve
>


-- 
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com

Re: JSON request - unknown field/element

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 02/10/12 01:04, SK wrote:
> Hello,
> We are using CXF for REST and Jettison 1.3.2. For a JSON request when SAXParseException is thrown the column and line are incorrect in the exception. The line is always -1 and the column is 0. Note, this is not the case for the same request is XML. Is there any way to get the line/column detail JSON requests when the reader/unmarshaller encounters an unknown element? Thanks!
>
I'm not sure that SAXParserException should even be exposed in such 
cases given that SAXParserException is XML centric exception, I guess it 
does escape from the parsing layer.

I think that the issue is that Jettison does not correctly implement 
some of the relevant reader methods. Perhaps it is possible to tweak it 
for a 'column' in the exception to point to the actual character in the 
JSON sequence which caused an error. I'll have a look later when I start 
working on the next Jettison release

Cheers, Sergey

> - Steve