Program: 68661
Project: 68661
Buggy source:
public Object valueFromRow(AbstractRecord row,JoinedAttributeManager joinManager,ObjectBuildingQuery query,AbstractSession executionSession){
  Object value=row.get(this.field);
  if (value == null) {
    return value;
  }
  Object fieldValue=null;
  XMLUnmarshaller unmarshaller=((XMLRecord)row).getUnmarshaller();
  if (value instanceof String) {
    if (this.isSwaRef() && (unmarshaller.getAttachmentUnmarshaller() != null)) {
      if (getAttributeClassification() == XMLBinaryDataHelper.getXMLBinaryDataHelper().DATA_HANDLER) {
        fieldValue=unmarshaller.getAttachmentUnmarshaller().getAttachmentAsDataHandler((String)value);
      }
 else {
        fieldValue=unmarshaller.getAttachmentUnmarshaller().getAttachmentAsByteArray((String)value);
      }
    }
 else     if (!this.isSwaRef()) {
      byte[] bytes=((XMLConversionManager)executionSession.getDatasourcePlatform().getConversionManager()).convertSchemaBase64ToByteArray(value);
      fieldValue=bytes;
    }
  }
 else {
    XMLRecord record=(XMLRecord)value;
    if ((unmarshaller.getAttachmentUnmarshaller() != null) && unmarshaller.getAttachmentUnmarshaller().isXOPPackage() && !this.isSwaRef()&& !this.shouldInlineBinaryData()) {
      String xpath="String_Node_Str";
      NamespaceResolver resolver=((XMLDescriptor)getDescriptor()).getNamespaceResolver();
      if (resolver == null) {
        resolver=new NamespaceResolver();
        ((XMLDescriptor)getDescriptor()).setNamespaceResolver(resolver);
      }
      String prefix=resolver.resolveNamespaceURI(XMLConstants.XOP_URL);
      if (prefix == null) {
        prefix=resolver.generatePrefix();
        resolver.put(prefix,XMLConstants.XOP_URL);
      }
      xpath=prefix + include;
      XMLField field=new XMLField(xpath);
      field.setNamespaceResolver(resolver);
      String includeValue=(String)record.get(field);
      if (value != null) {
        if ((getAttributeClassification() == ClassConstants.ABYTE) || (getAttributeClassification() == ClassConstants.APBYTE)) {
          fieldValue=unmarshaller.getAttachmentUnmarshaller().getAttachmentAsByteArray(includeValue);
        }
 else {
          fieldValue=unmarshaller.getAttachmentUnmarshaller().getAttachmentAsDataHandler(includeValue);
        }
      }
    }
 else     if ((unmarshaller.getAttachmentUnmarshaller() != null) && isSwaRef()) {
      String refValue=(String)record.get("String_Node_Str");
      if (refValue != null) {
        fieldValue=unmarshaller.getAttachmentUnmarshaller().getAttachmentAsDataHandler(refValue);
      }
    }
 else {
      fieldValue=record.get("String_Node_Str");
      fieldValue=((XMLConversionManager)executionSession.getDatasourcePlatform().getConversionManager()).convertSchemaBase64ToByteArray(fieldValue);
    }
  }
  Object attributeValue=fieldValue;
  if (getConverter() != null) {
    if (getConverter() instanceof XMLConverter) {
      attributeValue=((XMLConverter)getConverter()).convertDataValueToObjectValue(fieldValue,executionSession,unmarshaller);
    }
 else {
      attributeValue=getConverter().convertDataValueToObjectValue(fieldValue,executionSession);
    }
  }
  attributeValue=XMLBinaryDataHelper.getXMLBinaryDataHelper().convertObject(attributeValue,getAttributeClassification(),executionSession);
  return attributeValue;
}

Fixed version (ground truth):
public Object valueFromRow(AbstractRecord row,JoinedAttributeManager joinManager,ObjectBuildingQuery query,AbstractSession executionSession){
  Object value=row.get(this.field);
  if (value == null) {
    return value;
  }
  Object fieldValue=null;
  XMLUnmarshaller unmarshaller=((XMLRecord)row).getUnmarshaller();
  if (value instanceof String) {
    if (this.isSwaRef() && (unmarshaller.getAttachmentUnmarshaller() != null)) {
      if (getAttributeClassification() == XMLBinaryDataHelper.getXMLBinaryDataHelper().DATA_HANDLER) {
        fieldValue=unmarshaller.getAttachmentUnmarshaller().getAttachmentAsDataHandler((String)value);
      }
 else {
        fieldValue=unmarshaller.getAttachmentUnmarshaller().getAttachmentAsByteArray((String)value);
      }
    }
 else     if (!this.isSwaRef()) {
      byte[] bytes=((XMLConversionManager)executionSession.getDatasourcePlatform().getConversionManager()).convertSchemaBase64ToByteArray(value);
      fieldValue=bytes;
    }
  }
 else {
    XMLRecord record=(XMLRecord)value;
    if ((unmarshaller.getAttachmentUnmarshaller() != null) && unmarshaller.getAttachmentUnmarshaller().isXOPPackage() && !this.isSwaRef()&& !this.shouldInlineBinaryData()) {
      String xpath="String_Node_Str";
      String prefix=null;
      NamespaceResolver descriptorResolver=((XMLDescriptor)getDescriptor()).getNamespaceResolver();
      if (descriptorResolver != null) {
        prefix=descriptorResolver.resolveNamespaceURI(XMLConstants.XOP_URL);
      }
      if (prefix == null) {
        prefix=XMLConstants.XOP_PREFIX;
      }
      NamespaceResolver tempResolver=new NamespaceResolver();
      tempResolver.put(prefix,XMLConstants.XOP_URL);
      xpath=prefix + include;
      XMLField field=new XMLField(xpath);
      field.setNamespaceResolver(tempResolver);
      String includeValue=(String)record.get(field);
      if (value != null) {
        if ((getAttributeClassification() == ClassConstants.ABYTE) || (getAttributeClassification() == ClassConstants.APBYTE)) {
          fieldValue=unmarshaller.getAttachmentUnmarshaller().getAttachmentAsByteArray(includeValue);
        }
 else {
          fieldValue=unmarshaller.getAttachmentUnmarshaller().getAttachmentAsDataHandler(includeValue);
        }
      }
    }
 else     if ((unmarshaller.getAttachmentUnmarshaller() != null) && isSwaRef()) {
      String refValue=(String)record.get("String_Node_Str");
      if (refValue != null) {
        fieldValue=unmarshaller.getAttachmentUnmarshaller().getAttachmentAsDataHandler(refValue);
      }
    }
 else {
      fieldValue=record.get("String_Node_Str");
      fieldValue=((XMLConversionManager)executionSession.getDatasourcePlatform().getConversionManager()).convertSchemaBase64ToByteArray(fieldValue);
    }
  }
  Object attributeValue=fieldValue;
  if (getConverter() != null) {
    if (getConverter() instanceof XMLConverter) {
      attributeValue=((XMLConverter)getConverter()).convertDataValueToObjectValue(fieldValue,executionSession,unmarshaller);
    }
 else {
      attributeValue=getConverter().convertDataValueToObjectValue(fieldValue,executionSession);
    }
  }
  attributeValue=XMLBinaryDataHelper.getXMLBinaryDataHelper().convertObject(attributeValue,getAttributeClassification(),executionSession);
  return attributeValue;
}