Program: 64991
Project: 64991
Buggy source:
public Object createSimpleXMLFormat(XRServiceAdapter xrService,Object value){
  XMLRoot xmlRoot=new XMLRoot();
  SimpleXMLFormat simpleXMLFormat=result.getSimpleXMLFormat();
  String tempSimpleXMLFormatTag=SimpleXMLFormat.DEFAULT_SIMPLE_XML_FORMAT_TAG;
  String simpleXMLFormatTag=simpleXMLFormat.getSimpleXMLFormatTag();
  if (simpleXMLFormatTag != null && !"String_Node_Str".equals(simpleXMLFormatTag)) {
    tempSimpleXMLFormatTag=simpleXMLFormatTag;
  }
  xmlRoot.setLocalName(tempSimpleXMLFormatTag);
  String tempXMLTag=DEFAULT_SIMPLE_XML_TAG;
  String xmlTag=simpleXMLFormat.getXMLTag();
  if (xmlTag != null && !"String_Node_Str".equals(xmlTag)) {
    tempXMLTag=xmlTag;
  }
  Vector<DatabaseRecord> records=null;
  if (value instanceof Vector) {
    records=(Vector<DatabaseRecord>)value;
  }
 else {
    records=new Vector<DatabaseRecord>();
    DatabaseRecord dr=new DatabaseRecord();
    dr.add(new DatabaseField("String_Node_Str"),value);
    records.add(dr);
  }
  SimpleXMLFormatModel simpleXMLFormatModel=new SimpleXMLFormatModel();
  XMLConversionManager conversionManager=(XMLConversionManager)xrService.getOXSession().getDatasourcePlatform().getConversionManager();
  for (  DatabaseRecord dr : records) {
    Element rowElement=TEMP_DOC.createElement(tempXMLTag);
    for (    DatabaseField field : (Vector<DatabaseField>)dr.getFields()) {
      Object fieldValue=dr.get(field);
      if (fieldValue != null) {
        if (fieldValue instanceof Calendar) {
          Calendar cValue=(Calendar)fieldValue;
          fieldValue=conversionManager.convertObject(cValue,STRING,DATE_TIME_QNAME);
        }
        if (fieldValue instanceof Date) {
          Date dValue=(Date)fieldValue;
          fieldValue=conversionManager.convertObject(dValue,STRING,DATE_QNAME);
        }
 else         if (fieldValue instanceof Time) {
          Time tValue=(Time)fieldValue;
          fieldValue=conversionManager.convertObject(tValue,STRING,TIME_QNAME);
        }
 else         if (fieldValue instanceof Timestamp) {
          Timestamp tsValue=(Timestamp)fieldValue;
          fieldValue=conversionManager.convertObject(tsValue,STRING,DATE_TIME_QNAME);
        }
        String elementName=sqlToXmlName(field.getName());
        Element columnElement=TEMP_DOC.createElement(elementName);
        rowElement.appendChild(columnElement);
        String fieldValueString=fieldValue.toString();
        if (result.getType().equals(BASE_64_BINARY_QNAME)) {
          fieldValueString=Helper.buildHexStringFromBytes(Base64.base64Encode((byte[])fieldValue));
          columnElement.setAttributeNS(XMLNS_ATTRIBUTE_NS_URI,"String_Node_Str",W3C_XML_SCHEMA_NS_URI);
          columnElement.setAttributeNS(XMLNS_ATTRIBUTE_NS_URI,"String_Node_Str",W3C_XML_SCHEMA_INSTANCE_NS_URI);
          columnElement.setAttributeNS(W3C_XML_SCHEMA_INSTANCE_NS_URI,"String_Node_Str","String_Node_Str");
        }
        columnElement.appendChild(TEMP_DOC.createTextNode(fieldValueString));
      }
    }
    simpleXMLFormatModel.simpleXML.add(rowElement);
  }
  xmlRoot.setObject(simpleXMLFormatModel);
  return xmlRoot;
}

Fixed version (ground truth):
public Object createSimpleXMLFormat(XRServiceAdapter xrService,Object value){
  XMLRoot xmlRoot=new XMLRoot();
  SimpleXMLFormat simpleXMLFormat=result.getSimpleXMLFormat();
  String tempSimpleXMLFormatTag=SimpleXMLFormat.DEFAULT_SIMPLE_XML_FORMAT_TAG;
  String simpleXMLFormatTag=simpleXMLFormat.getSimpleXMLFormatTag();
  if (simpleXMLFormatTag != null && !"String_Node_Str".equals(simpleXMLFormatTag)) {
    tempSimpleXMLFormatTag=simpleXMLFormatTag;
  }
  xmlRoot.setLocalName(tempSimpleXMLFormatTag);
  String tempXMLTag=DEFAULT_SIMPLE_XML_TAG;
  String xmlTag=simpleXMLFormat.getXMLTag();
  if (xmlTag != null && !"String_Node_Str".equals(xmlTag)) {
    tempXMLTag=xmlTag;
  }
  Vector<DatabaseRecord> records=null;
  if (value instanceof Vector) {
    records=(Vector<DatabaseRecord>)value;
  }
 else {
    records=new Vector<DatabaseRecord>();
    DatabaseRecord dr=new DatabaseRecord();
    dr.add(new DatabaseField("String_Node_Str"),value);
    records.add(dr);
  }
  SimpleXMLFormatModel simpleXMLFormatModel=new SimpleXMLFormatModel();
  XMLConversionManager conversionManager=(XMLConversionManager)xrService.getOXSession().getDatasourcePlatform().getConversionManager();
  for (  DatabaseRecord dr : records) {
    Element rowElement=TEMP_DOC.createElement(tempXMLTag);
    for (    DatabaseField field : (Vector<DatabaseField>)dr.getFields()) {
      Object fieldValue=dr.get(field);
      if (fieldValue != null) {
        if (fieldValue instanceof Calendar) {
          Calendar cValue=(Calendar)fieldValue;
          fieldValue=conversionManager.convertObject(cValue,STRING,DATE_TIME_QNAME);
        }
        if (fieldValue instanceof Date) {
          Date dValue=(Date)fieldValue;
          fieldValue=conversionManager.convertObject(dValue,STRING,DATE_QNAME);
        }
 else         if (fieldValue instanceof Time) {
          Time tValue=(Time)fieldValue;
          fieldValue=conversionManager.convertObject(tValue,STRING,TIME_QNAME);
        }
 else         if (fieldValue instanceof Timestamp) {
          Timestamp tsValue=(Timestamp)fieldValue;
          fieldValue=conversionManager.convertObject(tsValue,STRING,DATE_TIME_QNAME);
        }
 else         if (fieldValue instanceof Blob) {
          fieldValue=conversionManager.convertObject((Blob)fieldValue,ClassConstants.APBYTE);
        }
        String elementName=sqlToXmlName(field.getName());
        Element columnElement=TEMP_DOC.createElement(elementName);
        rowElement.appendChild(columnElement);
        String fieldValueString=fieldValue.toString();
        if (result.getType().equals(BASE_64_BINARY_QNAME)) {
          fieldValueString=Helper.buildHexStringFromBytes(Base64.base64Encode((byte[])fieldValue));
          columnElement.setAttributeNS(XMLNS_ATTRIBUTE_NS_URI,"String_Node_Str",W3C_XML_SCHEMA_NS_URI);
          columnElement.setAttributeNS(XMLNS_ATTRIBUTE_NS_URI,"String_Node_Str",W3C_XML_SCHEMA_INSTANCE_NS_URI);
          columnElement.setAttributeNS(W3C_XML_SCHEMA_INSTANCE_NS_URI,"String_Node_Str","String_Node_Str");
        }
        columnElement.appendChild(TEMP_DOC.createTextNode(fieldValueString));
      }
    }
    simpleXMLFormatModel.simpleXML.add(rowElement);
  }
  xmlRoot.setObject(simpleXMLFormatModel);
  return xmlRoot;
}