users@jersey.java.net

[Jersey] Re: Jersey Client unmarshalls empty arrays strangely...

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Wed, 09 Mar 2011 16:52:58 +0100

Hello Dan,

can you share a testcase or at least your resource and class it returns?
You might be encountering some ugly corner case..

Thanks,
Pavel

On 02/28/2011 06:40 PM, dslack_at_langui.com wrote:
> Hello,
>
> I searched through the mailing list and didn't see this question posed.
>
> I'm having an issue using the Jersey Client to properly unmarshall a
> List of objects. First, I'm using Glassfish v3.1, and my web service
> is returning JSON.
>
> Basically, when I return a List of objects that are empty, it gets
> marshalled into an empty JSON Array (as expected), however, when I use
> the Jersey Client to unmarshall, it creates a List with one entry, with
> all null values. I'm not really sure why this is occuring, and I've
> resorted to a horrible hack whereby I check if the 0th entry has a null
> ID field (which should never be null).
>
> I'm registering my own JAXBContextResolver for the Object type, and I'm
> using natural() building.
>
> I've seen this question posed once before (on stackoverflow), but there
> weren't any responses. Can anybody help out, or explain to me whats
> going on?
>
> Thanks,
>
> Dan Slack
>
>