Program: 64838
Project: 64838
Buggy source:
public Object valueFromRow(AbstractRecord row,JoinedAttributeManager joinManager,ObjectBuildingQuery query,CacheKey cacheKey,AbstractSession executionSession,boolean isTargetProtected,Boolean[] wasCacheUsed){
  ContainerPolicy cp=this.getContainerPolicy();
  Object fieldValue=row.getValues(this.getField());
  if (fieldValue == null) {
    if (reuseContainer) {
      Object currentObject=((XMLRecord)row).getCurrentObject();
      Object container=getAttributeAccessor().getAttributeValueFromObject(currentObject);
      return container != null ? container : cp.containerInstance();
    }
 else {
      return cp.containerInstance();
    }
  }
  Vector fieldValues=this.getDescriptor().buildDirectValuesFromFieldValue(fieldValue);
  if (fieldValues == null) {
    if (reuseContainer) {
      Object currentObject=((XMLRecord)row).getCurrentObject();
      Object container=getAttributeAccessor().getAttributeValueFromObject(currentObject);
      return container != null ? container : cp.containerInstance();
    }
 else {
      return cp.containerInstance();
    }
  }
  Object result=null;
  if (reuseContainer) {
    Object currentObject=((XMLRecord)row).getCurrentObject();
    Object container=getAttributeAccessor().getAttributeValueFromObject(currentObject);
    result=container != null ? container : cp.containerInstance();
  }
 else {
    result=cp.containerInstance(fieldValues.size());
  }
  for (Enumeration stream=fieldValues.elements(); stream.hasMoreElements(); ) {
    Object element=stream.nextElement();
    XMLUnmarshaller unmarshaller=((XMLRecord)row).getUnmarshaller();
    if (element instanceof String) {
      if (this.isSwaRef() && (unmarshaller.getAttachmentUnmarshaller() != null)) {
        fieldValue=unmarshaller.getAttachmentUnmarshaller().getAttachmentAsDataHandler((String)element);
      }
 else       if (!this.isSwaRef()) {
        byte[] bytes=((XMLConversionManager)executionSession.getDatasourcePlatform().getConversionManager()).convertSchemaBase64ToByteArray(element);
        fieldValue=bytes;
      }
    }
 else {
      XMLRecord record=(XMLRecord)element;
      record.setSession(executionSession);
      if ((unmarshaller.getAttachmentUnmarshaller() != null) && unmarshaller.getAttachmentUnmarshaller().isXOPPackage() && !this.isSwaRef()&& !this.shouldInlineBinaryData()) {
        String xpath=XMLConstants.EMPTY_STRING;
        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 + XMLConstants.COLON + INCLUDE+ "String_Node_Str";
        XMLField field=new XMLField(xpath);
        field.setNamespaceResolver(tempResolver);
        String includeValue=(String)record.get(field);
        if (element != null && includeValue != null) {
          if ((getAttributeElementClass() == ClassConstants.ABYTE) || (getAttributeElementClass() == ClassConstants.APBYTE)) {
            fieldValue=unmarshaller.getAttachmentUnmarshaller().getAttachmentAsByteArray(includeValue);
          }
 else {
            fieldValue=unmarshaller.getAttachmentUnmarshaller().getAttachmentAsDataHandler(includeValue);
          }
        }
 else {
          fieldValue=record.get(XMLConstants.TEXT);
          fieldValue=((XMLConversionManager)executionSession.getDatasourcePlatform().getConversionManager()).convertSchemaBase64ToByteArray(fieldValue);
        }
      }
 else       if ((unmarshaller.getAttachmentUnmarshaller() != null) && isSwaRef()) {
        String refValue=(String)record.get(XMLConstants.TEXT);
        if (refValue != null) {
          fieldValue=unmarshaller.getAttachmentUnmarshaller().getAttachmentAsDataHandler(refValue);
        }
      }
 else {
        fieldValue=record.get(XMLConstants.TEXT);
        fieldValue=((XMLConversionManager)executionSession.getDatasourcePlatform().getConversionManager()).convertSchemaBase64ToByteArray(fieldValue);
      }
    }
    Object attributeValue=fieldValue;
    if (getValueConverter() != null) {
      if (getValueConverter() instanceof XMLConverter) {
        attributeValue=((XMLConverter)getValueConverter()).convertDataValueToObjectValue(fieldValue,executionSession,unmarshaller);
      }
 else {
        attributeValue=getValueConverter().convertDataValueToObjectValue(fieldValue,executionSession);
      }
    }
    cp.addInto(attributeValue,result,query.getSession());
  }
  return result;
}

Fixed version (ground truth):
public Object valueFromRow(AbstractRecord row,JoinedAttributeManager joinManager,ObjectBuildingQuery query,CacheKey cacheKey,AbstractSession executionSession,boolean isTargetProtected,Boolean[] wasCacheUsed){
  ContainerPolicy cp=this.getContainerPolicy();
  Object fieldValue=row.getValues(this.getField());
  if (fieldValue == null) {
    if (reuseContainer) {
      Object currentObject=((XMLRecord)row).getCurrentObject();
      Object container=getAttributeAccessor().getAttributeValueFromObject(currentObject);
      return container != null ? container : cp.containerInstance();
    }
 else {
      return cp.containerInstance();
    }
  }
  Vector fieldValues=this.getDescriptor().buildDirectValuesFromFieldValue(fieldValue);
  if (fieldValues == null) {
    if (reuseContainer) {
      Object currentObject=((XMLRecord)row).getCurrentObject();
      Object container=getAttributeAccessor().getAttributeValueFromObject(currentObject);
      return container != null ? container : cp.containerInstance();
    }
 else {
      return cp.containerInstance();
    }
  }
  Object result=null;
  if (reuseContainer) {
    Object currentObject=((XMLRecord)row).getCurrentObject();
    Object container=getAttributeAccessor().getAttributeValueFromObject(currentObject);
    result=container != null ? container : cp.containerInstance();
  }
 else {
    result=cp.containerInstance(fieldValues.size());
  }
  for (Enumeration stream=fieldValues.elements(); stream.hasMoreElements(); ) {
    Object element=stream.nextElement();
    XMLUnmarshaller unmarshaller=((XMLRecord)row).getUnmarshaller();
    if (element instanceof String) {
      if (this.isSwaRef() && (unmarshaller.getAttachmentUnmarshaller() != null)) {
        fieldValue=unmarshaller.getAttachmentUnmarshaller().getAttachmentAsDataHandler((String)element);
      }
 else       if (!this.isSwaRef()) {
        byte[] bytes=((XMLConversionManager)executionSession.getDatasourcePlatform().getConversionManager()).convertSchemaBase64ToByteArray(element);
        fieldValue=bytes;
      }
    }
 else {
      XMLRecord record=(XMLRecord)element;
      if (getNullPolicy().valueIsNull((Element)record.getDOM())) {
        fieldValue=null;
      }
 else {
        record.setSession(executionSession);
        if ((unmarshaller.getAttachmentUnmarshaller() != null) && unmarshaller.getAttachmentUnmarshaller().isXOPPackage() && !this.isSwaRef()&& !this.shouldInlineBinaryData()) {
          String xpath=XMLConstants.EMPTY_STRING;
          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 + XMLConstants.COLON + INCLUDE+ "String_Node_Str";
          XMLField field=new XMLField(xpath);
          field.setNamespaceResolver(tempResolver);
          String includeValue=(String)record.get(field);
          if (element != null && includeValue != null) {
            if ((getAttributeElementClass() == ClassConstants.ABYTE) || (getAttributeElementClass() == ClassConstants.APBYTE)) {
              fieldValue=unmarshaller.getAttachmentUnmarshaller().getAttachmentAsByteArray(includeValue);
            }
 else {
              fieldValue=unmarshaller.getAttachmentUnmarshaller().getAttachmentAsDataHandler(includeValue);
            }
          }
 else {
            fieldValue=record.get(XMLConstants.TEXT);
            fieldValue=((XMLConversionManager)executionSession.getDatasourcePlatform().getConversionManager()).convertSchemaBase64ToByteArray(fieldValue);
          }
        }
 else         if ((unmarshaller.getAttachmentUnmarshaller() != null) && isSwaRef()) {
          String refValue=(String)record.get(XMLConstants.TEXT);
          if (refValue != null) {
            fieldValue=unmarshaller.getAttachmentUnmarshaller().getAttachmentAsDataHandler(refValue);
          }
        }
 else {
          fieldValue=record.get(XMLConstants.TEXT);
          fieldValue=((XMLConversionManager)executionSession.getDatasourcePlatform().getConversionManager()).convertSchemaBase64ToByteArray(fieldValue);
        }
      }
    }
    Object attributeValue=fieldValue;
    if (getValueConverter() != null) {
      if (getValueConverter() instanceof XMLConverter) {
        attributeValue=((XMLConverter)getValueConverter()).convertDataValueToObjectValue(fieldValue,executionSession,unmarshaller);
      }
 else {
        attributeValue=getValueConverter().convertDataValueToObjectValue(fieldValue,executionSession);
      }
    }
    cp.addInto(attributeValue,result,query.getSession());
  }
  return result;
}