Program: 65687
Project: 65687
Buggy source:
/** 
 * INTERNAL: Convert the Oracle XMLDocument to the reference-class.
 */
public Object xmlToObject(DOMRecord xmlRow,Class referenceClass) throws XMLMarshalException {
  try {
    String xmlEncoding="String_Node_Str";
    String xmlVersion="String_Node_Str";
    try {
      Method getEncoding=PrivilegedAccessHelper.getMethod(xmlRow.getDocument().getClass(),"String_Node_Str",new Class[]{},true);
      Method getVersion=PrivilegedAccessHelper.getMethod(xmlRow.getDocument().getClass(),"String_Node_Str",new Class[]{},true);
      xmlEncoding=(String)PrivilegedAccessHelper.invokeMethod(getEncoding,xmlRow.getDocument(),new Object[]{});
      xmlVersion=(String)PrivilegedAccessHelper.invokeMethod(getVersion,xmlRow.getDocument(),new Object[]{});
    }
 catch (    Exception ex) {
    }
    XMLContext xmlContext=xmlUnmarshaller.getXMLContext();
    if (XMLConversionManager.getDefaultJavaTypes().get(referenceClass) != null || ClassConstants.XML_GREGORIAN_CALENDAR.isAssignableFrom(referenceClass) || ClassConstants.DURATION.isAssignableFrom(referenceClass)) {
      Object nodeVal;
      try {
        Text rootTxt=(Text)xmlRow.getDOM().getFirstChild();
        nodeVal=rootTxt.getNodeValue();
      }
 catch (      Exception ex) {
        nodeVal=null;
      }
      Object obj=((XMLConversionManager)xmlContext.getSession(0).getDatasourcePlatform().getConversionManager()).convertObject(nodeVal,referenceClass);
      XMLRoot xmlRoot=new XMLRoot();
      xmlRoot.setObject(obj);
      String lName=xmlRow.getDOM().getLocalName();
      if (lName == null) {
        lName=xmlRow.getDOM().getNodeName();
      }
      xmlRoot.setLocalName(lName);
      xmlRoot.setNamespaceURI(xmlRow.getDOM().getNamespaceURI());
      xmlRoot.setEncoding(xmlEncoding);
      xmlRoot.setVersion(xmlVersion);
      return xmlRoot;
    }
    AbstractSession readSession=xmlContext.getReadSession(referenceClass);
    XMLDescriptor descriptor=(XMLDescriptor)readSession.getDescriptor(referenceClass);
    if (descriptor == null) {
      throw XMLMarshalException.descriptorNotFoundInProject(referenceClass.getName());
    }
    Object object=null;
    if (null == xmlRow.getDOM().getAttributes().getNamedItemNS(XMLConstants.SCHEMA_INSTANCE_URL,XMLConstants.SCHEMA_NIL_ATTRIBUTE)) {
      xmlRow.setUnmarshaller(xmlUnmarshaller);
      xmlRow.setDocPresPolicy(xmlContext.getDocumentPreservationPolicy(readSession));
      XMLObjectBuilder objectBuilder=(XMLObjectBuilder)descriptor.getObjectBuilder();
      ReadObjectQuery query=new ReadObjectQuery();
      query.setReferenceClass(referenceClass);
      query.setSession(readSession);
      object=objectBuilder.buildObject(query,xmlRow,null);
      xmlUnmarshaller.resolveReferences(readSession);
    }
    String elementNamespaceUri=xmlRow.getDOM().getNamespaceURI();
    String elementLocalName=xmlRow.getDOM().getLocalName();
    if (elementLocalName == null) {
      elementLocalName=xmlRow.getDOM().getNodeName();
    }
    String elementPrefix=xmlRow.getDOM().getPrefix();
    return descriptor.wrapObjectInXMLRoot(object,elementNamespaceUri,elementLocalName,elementPrefix,xmlEncoding,xmlVersion,this.isResultAlwaysXMLRoot,xmlUnmarshaller.isNamespaceAware());
  }
  finally {
    xmlUnmarshaller.getStringBuffer().reset();
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Convert the Oracle XMLDocument to the reference-class.
 */
public Object xmlToObject(DOMRecord xmlRow,Class referenceClass) throws XMLMarshalException {
  try {
    String xmlEncoding="String_Node_Str";
    String xmlVersion="String_Node_Str";
    try {
      Method getEncoding=PrivilegedAccessHelper.getMethod(xmlRow.getDocument().getClass(),"String_Node_Str",new Class[]{},true);
      Method getVersion=PrivilegedAccessHelper.getMethod(xmlRow.getDocument().getClass(),"String_Node_Str",new Class[]{},true);
      xmlEncoding=(String)PrivilegedAccessHelper.invokeMethod(getEncoding,xmlRow.getDocument(),new Object[]{});
      xmlVersion=(String)PrivilegedAccessHelper.invokeMethod(getVersion,xmlRow.getDocument(),new Object[]{});
    }
 catch (    Exception ex) {
    }
    XMLContext xmlContext=xmlUnmarshaller.getXMLContext();
    if (XMLConversionManager.getDefaultJavaTypes().get(referenceClass) != null || ClassConstants.XML_GREGORIAN_CALENDAR.isAssignableFrom(referenceClass) || ClassConstants.DURATION.isAssignableFrom(referenceClass)) {
      Object nodeVal;
      try {
        Text rootTxt=(Text)xmlRow.getDOM().getFirstChild();
        nodeVal=rootTxt.getNodeValue();
      }
 catch (      Exception ex) {
        nodeVal=null;
      }
      Object obj=((XMLConversionManager)xmlContext.getSession(0).getDatasourcePlatform().getConversionManager()).convertObject(nodeVal,referenceClass);
      XMLRoot xmlRoot=new XMLRoot();
      xmlRoot.setObject(obj);
      String lName=xmlRow.getDOM().getLocalName();
      if (lName == null) {
        lName=xmlRow.getDOM().getNodeName();
      }
      xmlRoot.setLocalName(lName);
      xmlRoot.setNamespaceURI(xmlRow.getDOM().getNamespaceURI());
      xmlRoot.setEncoding(xmlEncoding);
      xmlRoot.setVersion(xmlVersion);
      return xmlRoot;
    }
    AbstractSession readSession=xmlContext.getReadSession(referenceClass);
    XMLDescriptor descriptor=(XMLDescriptor)readSession.getDescriptor(referenceClass);
    if (descriptor == null) {
      throw XMLMarshalException.descriptorNotFoundInProject(referenceClass.getName());
    }
    Object object=null;
    if (null == xmlRow.getDOM().getAttributes().getNamedItemNS(XMLConstants.SCHEMA_INSTANCE_URL,XMLConstants.SCHEMA_NIL_ATTRIBUTE)) {
      xmlRow.setUnmarshaller(xmlUnmarshaller);
      xmlRow.setDocPresPolicy(xmlContext.getDocumentPreservationPolicy(readSession));
      XMLObjectBuilder objectBuilder=(XMLObjectBuilder)descriptor.getObjectBuilder();
      ReadObjectQuery query=new ReadObjectQuery();
      query.setReferenceClass(referenceClass);
      query.setSession(readSession);
      object=objectBuilder.buildObject(query,xmlRow,null);
      xmlUnmarshaller.resolveReferences(readSession);
    }
    String elementNamespaceUri=xmlRow.getDOM().getNamespaceURI();
    String elementLocalName=xmlRow.getDOM().getLocalName();
    if (elementLocalName == null) {
      elementLocalName=xmlRow.getDOM().getNodeName();
    }
    String elementPrefix=xmlRow.getDOM().getPrefix();
    return descriptor.wrapObjectInXMLRoot(object,elementNamespaceUri,elementLocalName,elementPrefix,xmlEncoding,xmlVersion,this.isResultAlwaysXMLRoot,true);
  }
  finally {
    xmlUnmarshaller.getStringBuffer().reset();
  }
}