jaxb
  1. jaxb
  2. JAXB-1007

NPE from marshalling an IDREF that point to a missing ID attribute value

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: runtime
    • Labels:
      None

      Description

      NPE is thrown prematurely in case of an id attribute being null instead of a more appropriate validation event (Object "..." is found in an IDREF property but this object doesnt have an ID.). In order to fix this see AttributeProperty.serializeAttributes method that deals with the null correctly.

      It seems that other people have had to deal this problem before (http://stackoverflow.com/questions/10705532/in-jaxb-marshalling-how-to-identify-which-child-element-caused-jaxb-marshallin). I guess that pinpointing of the cause can be quite problematic with the current behavior.

      • * StackTrace * *
        AttributeProperty<BeanT>.getIdValue(BeanT) line: 128
        ClassBeanInfoImpl<BeanT>.getId(BeanT, XMLSerializer) line: 322
        TransducedAccessor$IDREFTransducedAccessorImpl<BeanT,TargetT>.print(BeanT) line: 290
        TransducedAccessor$IDREFTransducedAccessorImpl<BeanT,TargetT>(DefaultTransducedAccessor<T>).writeLeafElement(XMLSerializer, Name, T, String) line: 69
        SingleElementLeafProperty<BeanT>.serializeBody(BeanT, XMLSerializer, Object) line: 130
        ClassBeanInfoImpl<BeanT>.serializeBody(BeanT, XMLSerializer) line: 361
        XMLSerializer.childAsXsiType(Object, String, JaxBeanInfo, boolean) line: 696

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Iaroslav Savytskyi
            Reporter:
            tuomas_kiviaho
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: