Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-1602

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.1.1, 2.0.7
    • None
    • None

    Description

      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

      Attachments

        1. date_bug.zip
          11 kB
          aaron pieper

        Activity

          People

            dkulp Daniel Kulp
            piepera aaron pieper
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: