jaxp
  1. jaxp
  2. JAXP-79

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

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • 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

        Hide
        Joe Wang added a comment -

        This is a JAXB issue. Please file bug in JAXB IssueTracker at https://java.net/jira/browse/JAXB/. Thanks.

        Show
        Joe Wang added a comment - This is a JAXB issue. Please file bug in JAXB IssueTracker at https://java.net/jira/browse/JAXB/ . Thanks.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: