Program: 64209
Project: 64209
Buggy source:
public Object unmarshal(org.xml.sax.XMLReader xmlReader,InputSource inputSource,Class clazz){
  try {
    Context xmlContext=xmlUnmarshaller.getContext();
    if (xmlContext.hasDocumentPreservation() || (Node.class.isAssignableFrom(clazz) && xmlUnmarshaller.getMediaType().isApplicationXML())) {
      SAXDocumentBuilder saxDocumentBuilder=new SAXDocumentBuilder();
      xmlReader.setContentHandler(saxDocumentBuilder);
      xmlReader.parse(inputSource);
      return unmarshal(saxDocumentBuilder.getDocument().getDocumentElement(),clazz);
    }
    UnmarshalRecord unmarshalRecord=null;
    Descriptor xmlDescriptor=null;
    CoreAbstractSession session=null;
    boolean isPrimitiveWrapper=false;
    if (clazz == CoreClassConstants.OBJECT) {
      SAXUnmarshallerHandler saxUnmarshallerHandler=new SAXUnmarshallerHandler(xmlUnmarshaller.getContext());
      saxUnmarshallerHandler.setXMLReader((XMLReader)xmlReader);
      saxUnmarshallerHandler.setUnmarshaller(xmlUnmarshaller);
      saxUnmarshallerHandler.setKeepAsElementPolicy(KEEP_UNKNOWN_AS_ELEMENT);
      xmlReader.setContentHandler(saxUnmarshallerHandler);
      xmlReader.parse(inputSource);
      saxUnmarshallerHandler.resolveReferences();
      return saxUnmarshallerHandler.getObject();
    }
 else {
      try {
        session=xmlContext.getSession(clazz);
        xmlDescriptor=(Descriptor)session.getDescriptor(clazz);
        org.eclipse.persistence.oxm.record.UnmarshalRecord wrapper=(org.eclipse.persistence.oxm.record.UnmarshalRecord)xmlDescriptor.getObjectBuilder().createRecord((AbstractSession)session);
        unmarshalRecord=wrapper.getUnmarshalRecord();
      }
 catch (      XMLMarshalException xme) {
        if (xme.getErrorCode() == XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT) {
          isPrimitiveWrapper=isPrimitiveWrapper(clazz);
          if (isPrimitiveWrapper) {
            unmarshalRecord=new XMLRootRecord(clazz);
            unmarshalRecord.setSession((AbstractSession)xmlUnmarshaller.getContext().getSession());
          }
 else {
            throw xme;
          }
        }
 else {
          throw xme;
        }
      }
    }
    XMLReader extendedXMLReader;
    if (xmlReader instanceof XMLReader) {
      extendedXMLReader=(XMLReader)xmlReader;
    }
 else {
      extendedXMLReader=new XMLReader(xmlReader);
    }
    unmarshalRecord.setXMLReader(extendedXMLReader);
    unmarshalRecord.setUnmarshaller(xmlUnmarshaller);
    setContentHandler(extendedXMLReader,unmarshalRecord);
    extendedXMLReader.setLexicalHandler(unmarshalRecord);
    extendedXMLReader.parse(inputSource);
    unmarshalRecord.resolveReferences(session,xmlUnmarshaller.getIDResolver());
    if (isPrimitiveWrapper || clazz == CoreClassConstants.OBJECT) {
      return unmarshalRecord.getCurrentObject();
    }
    return xmlDescriptor.wrapObjectInXMLRoot(unmarshalRecord,this.isResultAlwaysXMLRoot);
  }
 catch (  IOException e) {
    throw XMLMarshalException.unmarshalException(e);
  }
catch (  SAXException e) {
    throw convertSAXException(e);
  }
 finally {
    xmlUnmarshaller.getStringBuffer().reset();
  }
}

Fixed version (ground truth):
public Object unmarshal(org.xml.sax.XMLReader xmlReader,InputSource inputSource,Class clazz){
  try {
    Context xmlContext=xmlUnmarshaller.getContext();
    if (xmlContext.hasDocumentPreservation() || (Node.class.isAssignableFrom(clazz) && xmlUnmarshaller.getMediaType().isApplicationXML())) {
      SAXDocumentBuilder saxDocumentBuilder=new SAXDocumentBuilder();
      xmlReader.setContentHandler(saxDocumentBuilder);
      xmlReader.parse(inputSource);
      return unmarshal(saxDocumentBuilder.getDocument().getDocumentElement(),clazz);
    }
    UnmarshalRecord unmarshalRecord=null;
    Descriptor xmlDescriptor=null;
    CoreAbstractSession session=null;
    boolean isPrimitiveWrapper=false;
    if (clazz == CoreClassConstants.OBJECT) {
      SAXUnmarshallerHandler saxUnmarshallerHandler=new SAXUnmarshallerHandler(xmlUnmarshaller.getContext());
      saxUnmarshallerHandler.setXMLReader((XMLReader)xmlReader);
      saxUnmarshallerHandler.setUnmarshaller(xmlUnmarshaller);
      saxUnmarshallerHandler.setKeepAsElementPolicy(KEEP_UNKNOWN_AS_ELEMENT);
      xmlReader.setContentHandler(saxUnmarshallerHandler);
      xmlReader.parse(inputSource);
      saxUnmarshallerHandler.resolveReferences();
      return saxUnmarshallerHandler.getObject();
    }
 else {
      try {
        session=xmlContext.getSession(clazz);
        xmlDescriptor=(Descriptor)session.getDescriptor(clazz);
        unmarshalRecord=xmlUnmarshaller.createUnmarshalRecord(xmlDescriptor,session);
      }
 catch (      XMLMarshalException xme) {
        if (xme.getErrorCode() == XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT) {
          isPrimitiveWrapper=isPrimitiveWrapper(clazz);
          if (isPrimitiveWrapper) {
            unmarshalRecord=xmlUnmarshaller.createRootUnmarshalRecord(clazz);
          }
 else {
            throw xme;
          }
        }
 else {
          throw xme;
        }
      }
    }
    XMLReader extendedXMLReader;
    if (xmlReader instanceof XMLReader) {
      extendedXMLReader=(XMLReader)xmlReader;
    }
 else {
      extendedXMLReader=new XMLReader(xmlReader);
    }
    unmarshalRecord.setXMLReader(extendedXMLReader);
    unmarshalRecord.setUnmarshaller(xmlUnmarshaller);
    setContentHandler(extendedXMLReader,unmarshalRecord);
    extendedXMLReader.setLexicalHandler(unmarshalRecord);
    extendedXMLReader.parse(inputSource);
    unmarshalRecord.resolveReferences(session,xmlUnmarshaller.getIDResolver());
    if (isPrimitiveWrapper || clazz == CoreClassConstants.OBJECT) {
      return unmarshalRecord.getCurrentObject();
    }
    return xmlDescriptor.wrapObjectInXMLRoot(unmarshalRecord,this.isResultAlwaysXMLRoot);
  }
 catch (  IOException e) {
    throw XMLMarshalException.unmarshalException(e);
  }
catch (  SAXException e) {
    throw convertSAXException(e);
  }
 finally {
    xmlUnmarshaller.getStringBuffer().reset();
  }
}