cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Kulp (JIRA)" <>
Subject [jira] Commented: (CXF-2695) NullPointerException when reading a soap encoded struct with a nested element that's nil
Date Thu, 08 Apr 2010 03:08:36 GMT


Daniel Kulp commented on CXF-2695:

Soap-encoding pretty much always allows xsi:nil on pretty much any element.   The schema is
kind of just a hint.   Thus, in this case, it's easiest to just do something like:

 if (!alwaysAllowNillables() && !propertyTypeInfo.isNillable(name)) {
    protected boolean alwaysAllowNillables() {
        return false;

and in StructType, override it to return false.

> NullPointerException when reading a soap encoded struct with a nested element that's
> ----------------------------------------------------------------------------------------
>                 Key: CXF-2695
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding
>    Affects Versions: 2.2.6
>            Reporter: Marinó A. Jónsson
> When reading a simple struct that has a nested (unqualified) element set to nil a NullPointerException
is thrown:
> {code}
> java.lang.NullPointerException
> 	at org.apache.cxf.aegis.type.basic.BeanTypeInfo.isNillable(
> 	at org.apache.cxf.aegis.type.basic.BeanType.readObject(
> {code}
> This should be easily replicated by using the following xml for the StructTypeTest.testSimpleStruct()
> {code}
> <b:shipping xmlns:b="urn:Bean" xmlns:xsi="">
>     <street>1234 Riverside Drive</street>
>     <city>Gainesville</city>
>     <state>FL</state>
>     <zip xsi:nil="true"/>
> </b:shipping>
> {code}
> Apparently the problem stems from the fact that when the element is nil it's handled
without involving the StructType (which takes care of "qualifying" the element name in other
cases) - the unqualified name of the element is sent to the BeanTypeInfo.isNillable() method,
which fails to find a Type for the name as a result.
> I'm not sure how to solve this in a "clean" way - maybe extracting the "else" block that
handles nil elements in BeanType.readObject to a seperate overridable method thereby giving
StructType a chance to qualify the name before it's sent to the BeanTypeInfo.isNillable()

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message