cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: CXF accepts 'tru*' for boolean fields
Date Mon, 06 Oct 2014 14:49:26 GMT

This is also not really a bug in CXF but a bug in the JDK.    The JAXB runtime would use javax.xml.bind.DatatypeConverter
to parse the booleans and if I write a quick test like:

    @Test
    public void foo() {
        doIt("true");
        doIt("1");
        doIt("trud");
        doIt("trus”);
        doIt("trued");
    }
    public static void doIt(String s) {
        Boolean b = javax.xml.bind.DatatypeConverter.parseBoolean(s);
        System.out.println(s + ": " + b);
    }

I get:
true: true
1: true
trud: true
trus: true
trued: true

Thus, this is really outside of CXF’s control as Oracle would need to fix this in the JAXB
runtime.   

That said, you can turn on schema validation and that SHOULD catch this.     I believe the
schema validator is much much more strict about this.

Dan





On Oct 6, 2014, at 7:49 AM, santodip <santodip@gmail.com> wrote:

> I have written a web service using CXF. The WSDL contains one of the field as
> 'boolean'. Unfortunately at runtime I found that when "trud", "trua" or
> "truee" is passed through that field, it accepts the value as "true". This
> should have been a "false" value for a boolean field.
> 
> Any suggestion is highly appreciated
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/CXF-accepts-tru-for-boolean-fields-tp5749458.html
> Sent from the cxf-user mailing list archive at Nabble.com.

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Mime
View raw message