Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Unmarshalling JSON with unknown property with null value

Hi Eric,

I’ve just tested the case with eclipseLink v.2.5.2 and with the latest nightly build. And there is no problems with null values. In both case I’ve unmarshalled valid object.

So what you can do now:
- provide a reproducible test case for eclipseLink
- fire a bug agains jersey (for 100% they will also want the testCase)

—
Best regards.
Yarda



On 21 Aug 2014, at 17:53, Eric Stein <steine@xxxxxxxxxxxx> wrote:

> Sorry if the "What gives?" comes off as rude. I was shooting for flip, not cranky. 
> 
> Is there a chance this is a bug? I figure it might also be a setting somewhere, but bug seems more likely to me.
> 
> Thanks,
> Eric
> 
> -----Original Message-----
> From: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of Eric Stein
> Sent: Thursday, August 21, 2014 9:56 AM
> To: eclipselink-users@xxxxxxxxxxx
> Subject: [eclipselink-users] Unmarshalling JSON with unknown property with null value
> 
> I'm using MOXy to unmarshall incoming JSON to my Jersey API. I have a POJO with three properties: databaseName, initialQuery, and runQueryAsUser. I have a client sending me a POST where the JSON has an additional property that I don't need, secureQuery. When the value of secureQuery is null, MOXy spits back a null object. When the value of secureQuery is the empty string, MOXy returns a valid object with the three properties set and secureQuery correctly ignored. The only annotation the POJO has is `@XmlRootElement(name = "InitialQuery")`.
> 
> What gives? 
> 
> Version:
>    jersey-media-moxy: 2.6
>        org.eclipse.persistence.moxy: 2.5.0
> 
> Method Signature:
> 
>    public Response createSecuredQuery(final InitialQueryBean initialQuery) {
> 
> Null InitialQuery object:
> 
>    {
>        "databaseName":"MyDatabase",
>        "initialQuery":"select 1",
>        "runQueryAsUser":"bob",
>        "secureQuery":null
>    }
> 
> Good InitialQuery object:
> 
>    {
>        "databaseName":"MyDatabase",
>        "initialQuery":"select 1",
>        "runQueryAsUser":"bob",
>        "secureQuery":""
>    }
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users



Back to the top