javaee / jersey

This is no longer the active Jersey repository. Please see the README.md
http://jersey.github.io
Other
2.86k stars 2.35k forks source link

Bean attribute not correctly valorized when boolean and its name is "isSomething" #3627

Open xcobra81 opened 7 years ago

xcobra81 commented 7 years ago

Hi,

Dunno if this is a bug or what, but on the server side I have a WS call defined like this:

    @Path("/simulaFattura")
    @Consumes({MediaType.APPLICATION_JSON + "; charset=UTF-8"})
    @Produces({MediaType.APPLICATION_JSON + "; charset=UTF-8"})
    public FatturaRowBean[] simulaFattura(SimulatorInputBean input) throws Exception
    {

If i submit data for that Bean "SimulatorInputBean " which has a boolean parameter called "isFixed" via ajax/JSON with " isFixed : {anyvalue}" then on the server side i'll always obtain a "isFixed=false" no matter the client value. I also tried with a int parameter keeping the same name and the result is always "0" no matter the client input value.

By changing the Bean parameter name from "isFixed" to "fixed" i was able to resolve the issue.

So it looks like having a name starting with "is" kinda screw up the Jersey Conversion JSON->BEAN.

Best Regards,

Silvio

pavelbucek commented 7 years ago

Hi Silvio,

thanks for your report. Do you know which Jersey version do you use? And which Json marshaller?

Thanks, Pavel

xcobra81 commented 7 years ago

Hi Pavel,

I'm using Jersey 2.10.1, plus Genson 1.4 Do you think it could be Genson to give such problem?

Thanks,

Silvio