NullPointerException when reading a soap encoded struct with a nested element 
that's nil
----------------------------------------------------------------------------------------

                 Key: CXF-2695
                 URL: https://issues.apache.org/jira/browse/CXF-2695
             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(BeanTypeInfo.java:384)
        at 
org.apache.cxf.aegis.type.basic.BeanType.readObject(BeanType.java:165)
{code}

This should be easily replicated by using the following xml for the 
StructTypeTest.testSimpleStruct() test:

{code}
<b:shipping xmlns:b="urn:Bean" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
    <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() method?


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

Reply via email to