Program: 67210
Project: 67210
Buggy source:
@Override public void endElement(String namespaceURI,String localName,String qName) throws SAXException {
  Object value=this.getStringBuffer().toString();
  resetStringBuffer();
  boolean isSwaRef=false;
  if (isCollection) {
    isSwaRef=((XMLBinaryDataCollectionMapping)mapping).isSwaRef();
  }
 else {
    isSwaRef=((XMLBinaryDataMapping)mapping).isSwaRef();
  }
  if (isSwaRef && (parent.getUnmarshaller().getAttachmentUnmarshaller() != null)) {
    if (mapping.getAttributeClassification() == XMLBinaryDataHelper.getXMLBinaryDataHelper().DATA_HANDLER) {
      value=parent.getUnmarshaller().getAttachmentUnmarshaller().getAttachmentAsDataHandler((String)value);
    }
 else {
      value=parent.getUnmarshaller().getAttachmentUnmarshaller().getAttachmentAsByteArray((String)value);
    }
    if (converter != null) {
      if (converter instanceof XMLConverter) {
        value=((XMLConverter)converter).convertDataValueToObjectValue(value,parent.getSession(),parent.getUnmarshaller());
      }
 else {
        value=converter.convertDataValueToObjectValue(value,parent.getSession());
      }
    }
  }
 else {
    value=XMLConversionManager.getDefaultXMLManager().convertSchemaBase64ToByteArray(value);
    if (converter != null) {
      if (converter instanceof XMLConverter) {
        value=((XMLConverter)converter).convertDataValueToObjectValue(value,parent.getSession(),parent.getUnmarshaller());
      }
 else {
        value=converter.convertDataValueToObjectValue(value,parent.getSession());
      }
    }
  }
  value=XMLBinaryDataHelper.getXMLBinaryDataHelper().convertObject(value,mapping.getAttributeClassification(),parent.getSession());
  if (isCollection) {
    if (value != null) {
      parent.addAttributeValue((ContainerValue)nodeValue,value);
    }
  }
 else {
    parent.setAttributeValue(value,mapping);
  }
  parent.getXMLReader().setContentHandler(parent);
  parent.endElement(namespaceURI,localName,qName);
}

Fixed version (ground truth):
@Override public void endElement(String namespaceURI,String localName,String qName) throws SAXException {
  XMLField field=null;
  Object value=this.getStringBuffer().toString();
  resetStringBuffer();
  boolean isSwaRef=false;
  if (isCollection) {
    isSwaRef=((XMLBinaryDataCollectionMapping)mapping).isSwaRef();
    field=(XMLField)((XMLBinaryDataCollectionMapping)mapping).getField();
  }
 else {
    isSwaRef=((XMLBinaryDataMapping)mapping).isSwaRef();
    field=(XMLField)((XMLBinaryDataMapping)mapping).getField();
  }
  if (isSwaRef && (parent.getUnmarshaller().getAttachmentUnmarshaller() != null)) {
    if (mapping.getAttributeClassification() == XMLBinaryDataHelper.getXMLBinaryDataHelper().DATA_HANDLER) {
      value=parent.getUnmarshaller().getAttachmentUnmarshaller().getAttachmentAsDataHandler((String)value);
    }
 else {
      value=parent.getUnmarshaller().getAttachmentUnmarshaller().getAttachmentAsByteArray((String)value);
    }
    if (converter != null) {
      if (converter instanceof XMLConverter) {
        value=((XMLConverter)converter).convertDataValueToObjectValue(value,parent.getSession(),parent.getUnmarshaller());
      }
 else {
        value=converter.convertDataValueToObjectValue(value,parent.getSession());
      }
    }
  }
 else {
    value=XMLConversionManager.getDefaultXMLManager().convertSchemaBase64ToByteArray(value);
    if (converter != null) {
      if (converter instanceof XMLConverter) {
        value=((XMLConverter)converter).convertDataValueToObjectValue(value,parent.getSession(),parent.getUnmarshaller());
      }
 else {
        value=converter.convertDataValueToObjectValue(value,parent.getSession());
      }
    }
  }
  value=XMLBinaryDataHelper.getXMLBinaryDataHelper().convertObject(value,mapping.getAttributeClassification(),parent.getSession());
  if (isCollection) {
    if (value != null) {
      parent.addAttributeValue((ContainerValue)nodeValue,value);
    }
  }
 else {
    parent.setAttributeValue(value,mapping);
  }
  if (!field.isSelfField()) {
    parent.getXMLReader().setContentHandler(parent);
    parent.endElement(namespaceURI,localName,qName);
  }
}