DataTypeAdapter causes NPE with jaxb-impl 2.1.6 if multiple bindings go to the 
same java type
---------------------------------------------------------------------------------------------

                 Key: CXF-1602
                 URL: https://issues.apache.org/jira/browse/CXF-1602
             Project: CXF
          Issue Type: Bug
            Reporter: aaron pieper


A NullPointerException occurs in the attached example. I'm not sure exactly 
what causes it, but the following conditions seem to play a role:

  * jaxb-impl v2.1.6. If we switch to jaxb-impl v2.0.1, the NPE doesn't happen.
  * We define a custom binding.xml with two classes mapped to the same java 
type. In this example, "date" and "datetime" are both mapped to 
"java.util.Date". If we remove the "datetime" binding, the NPE doesn't happen.

The result is that it tries to pass a "null" value into the Date->String 
adapter, which causes an NPE.

Caused by: java.lang.NullPointerException
        at java.util.Calendar.setTime(Calendar.java:1032)
        at 
org.apache.cxf.tools.common.DataTypeAdapter.printDateTime(DataTypeAdapter.java:52)
        at gen.jdnets.ds.Adapter2.marshal(Adapter2.java:17)
        at gen.jdnets.ds.Adapter2.marshal(Adapter2.java:7)
        at 
com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.get(AdaptedAccessor.java:72)
        ... 52 more

-- 
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