On Tue, Mar 10, 2009 at 11:57:08AM +0100, Paul Sandoz wrote:
> Hi Sergey,
>
> Thanks for finding this. Jakub can you fix this?
Done.
~Jakub
>
> Thanks,
> Paul.
>
> On Mar 6, 2009, at 12:48 PM, Privalov, Sergey wrote:
>
>> Hello,
>>
>> It‘s looks like that the list of entities which contains unicode
>> characters are unmarshaled in incorrect way from the json. Seems that
>> problem is in the following piece of code:
>>
>> package com.sun.jersey.json.impl.provider.entity;
>>
>> …
>>
>> public class JSONListElementProvider extends AbstractListElementProvider {
>>
>> …
>>
>> @Override
>> protected final XMLStreamReader getXMLStreamReader(Class<?>
>> elementType, MediaType mediaType, Unmarshaller u, InputStream
>> entityStream) throws XMLStreamException {
>> JSONConfiguration c = JSONConfiguration.DEFAULT;
>> if (u instanceof JSONConfigurated) {
>> c = ((JSONConfigurated) u).getJSONConfiguration();
>> }
>> return Stax2JsonFactory.createReader(new
>> InputStreamReader(entityStream), c,
>> JSONHelper.getRootElementName((Class)elementType), true);
>> }
>> }
>>
>> In our case this problem was fixed by modification this code in the
>> following way:
>>
>>
>> package com.sun.jersey.json.impl.provider.entity;
>>
>> …
>>
>> public class JSONListElementProvider extends AbstractListElementProvider {
>>
>> …
>>
>> @Override
>> protected final XMLStreamReader getXMLStreamReader(Class<?>
>> elementType, MediaType mediaType, Unmarshaller u, InputStream
>> entityStream) throws XMLStreamException {
>> JSONConfiguration c = JSONConfiguration.DEFAULT;
>> final Charset charset = getCharset(mediaType);
>> if (u instanceof JSONConfigurated) {
>> c = ((JSONConfigurated) u).getJSONConfiguration();
>> }
>> return Stax2JsonFactory.createReader(new
>> InputStreamReader(entityStream, charset), c,
>> JSONHelper.getRootElementName((Class)elementType), true);
>> }
>> }
>>
>> We recompiled corresponded class with our fix and put it into the
>> classpath before the original jars.
>>
>> Best Regards,
>> Sergey Privalov
>>
>