nus-yam/ex-repair huggingface dataset:
Program: 64762
Project: 64762
Buggy source:
private void addChoiceElementMapping(List<XMLField> sourceFields,String theClass,List<XMLField> targetFields){
  XMLObjectReferenceMapping xmlMapping=new XMLObjectReferenceMapping();
  xmlMapping.setReferenceClassName(theClass);
  xmlMapping.setAttributeAccessor(temporaryAccessor);
  for (int i=0; i < sourceFields.size(); i++) {
    XMLField sourceField=sourceFields.get(i);
    xmlMapping.addSourceToTargetKeyFieldAssociation(sourceField,targetFields.get(i));
    this.choiceElementMappings.put(sourceField,xmlMapping);
  }
}

Fixed version (ground truth):
private void addChoiceElementMapping(List<XMLField> sourceFields,String theClass,List<XMLField> targetFields){
  XMLObjectReferenceMapping xmlMapping=new XMLObjectReferenceMapping();
  xmlMapping.setReferenceClassName(theClass);
  xmlMapping.setAttributeAccessor(temporaryAccessor);
  for (int i=0; i < sourceFields.size(); i++) {
    XMLField sourceField=sourceFields.get(i);
    xmlMapping.addSourceToTargetKeyFieldAssociation(sourceField,targetFields.get(i));
    if (this.choiceElementMappings.get(sourceField) == null) {
      this.choiceElementMappings.put(sourceField,xmlMapping);
    }
  }
  if (this.choiceElementMappingsByClassName.get(theClass) == null) {
    this.choiceElementMappingsByClassName.put(theClass,xmlMapping);
  }
}
Program: 64763
Project: 64763
Buggy source:
public void preInitialize(AbstractSession session) throws DescriptorException {
  getAttributeAccessor().setIsWriteOnly(this.isWriteOnly());
  getAttributeAccessor().setIsReadOnly(this.isReadOnly());
  super.preInitialize(session);
  Iterator<XMLMapping> mappings=getChoiceElementMappings().values().iterator();
  while (mappings.hasNext()) {
    DatabaseMapping nextMapping=(DatabaseMapping)mappings.next();
    nextMapping.setDescriptor(getDescriptor());
    nextMapping.setAttributeName(this.getAttributeName());
    if (nextMapping.getAttributeAccessor() == temporaryAccessor) {
      nextMapping.setAttributeAccessor(getAttributeAccessor());
    }
    nextMapping.preInitialize(session);
  }
}

Fixed version (ground truth):
public void preInitialize(AbstractSession session) throws DescriptorException {
  getAttributeAccessor().setIsWriteOnly(this.isWriteOnly());
  getAttributeAccessor().setIsReadOnly(this.isReadOnly());
  super.preInitialize(session);
  ArrayList<XMLMapping> mappingsList=new ArrayList<XMLMapping>();
  mappingsList.addAll(getChoiceElementMappings().values());
  for (  XMLMapping next : getChoiceElementMappingsByClass().values()) {
    if (!(mappingsList.contains(next))) {
      mappingsList.add(next);
    }
  }
  for (  XMLMapping next : getChoiceElementMappingsByClass().values()) {
    if (!(mappingsList.contains(next))) {
      mappingsList.add(next);
    }
  }
  Iterator<XMLMapping> mappings=mappingsList.iterator();
  while (mappings.hasNext()) {
    DatabaseMapping nextMapping=(DatabaseMapping)mappings.next();
    nextMapping.setDescriptor(getDescriptor());
    nextMapping.setAttributeName(this.getAttributeName());
    if (nextMapping.getAttributeAccessor() == temporaryAccessor) {
      nextMapping.setAttributeAccessor(getAttributeAccessor());
    }
    nextMapping.preInitialize(session);
  }
}
Program: 64769
Project: 64769
Buggy source:
public void setValidationMode(int validationMode){
  try {
    this.validationMode=validationMode;
    if (null != xmlParser) {
      xmlParser.setValidationMode(validationMode);
    }
    if (null == xmlReader) {
      return;
    }
switch (validationMode) {
case XMLParser.NONVALIDATING:
{
        xmlReader.setFeature(VALIDATING,false);
        break;
      }
case XMLParser.DTD_VALIDATION:
{
      xmlReader.setFeature(VALIDATING,true);
      break;
    }
case XMLParser.SCHEMA_VALIDATION:
{
    try {
      xmlReader.setFeature(VALIDATING,true);
      saxParser.setProperty(SCHEMA_LANGUAGE,XML_SCHEMA);
      saxParser.setProperty(SCHEMA_SOURCE,schemas);
    }
 catch (    Exception e) {
      xmlReader.setFeature(VALIDATING,false);
    }
    break;
  }
}
}
 catch (Exception e) {
}
}

Fixed version (ground truth):
public void setValidationMode(XMLReader xmlReader,int validationMode){
  try {
    this.validationMode=validationMode;
    if (null != xmlParser) {
      xmlParser.setValidationMode(validationMode);
    }
    if (null == xmlReader) {
      return;
    }
switch (validationMode) {
case XMLParser.NONVALIDATING:
{
        xmlReader.setFeature(VALIDATING,false);
        break;
      }
case XMLParser.DTD_VALIDATION:
{
      xmlReader.setFeature(VALIDATING,true);
      break;
    }
case XMLParser.SCHEMA_VALIDATION:
{
    try {
      xmlReader.setFeature(VALIDATING,true);
      saxParser.setProperty(SCHEMA_LANGUAGE,XML_SCHEMA);
      saxParser.setProperty(SCHEMA_SOURCE,schemas);
    }
 catch (    Exception e) {
      xmlReader.setFeature(VALIDATING,false);
    }
    break;
  }
}
}
 catch (Exception e) {
}
}
Program: 64770
Project: 64770
Buggy source:
private XMLReader getXMLReader(Class clazz){
  if (null == xmlReader) {
    if (xmlUnmarshaller.getMediaType() == MediaType.APPLICATION_JSON) {
      xmlReader=new JSONReader(xmlUnmarshaller.getAttributePrefix(),xmlUnmarshaller.getNamespaceResolver(),xmlUnmarshaller.getNamespaceResolver() != null,xmlUnmarshaller.isIncludeRoot(),xmlUnmarshaller.getNamespaceSeparator(),xmlUnmarshaller.getErrorHandler(),xmlUnmarshaller.getValueWrapper(),clazz);
      return xmlReader;
    }
    try {
      xmlReader=new XMLReader(getSAXParser().getXMLReader());
      if (null != errorHandler) {
        xmlReader.setErrorHandler(errorHandler);
      }
      if (null != entityResolver) {
        xmlReader.setEntityResolver(entityResolver);
      }
      setValidationMode(getValidationMode());
      if (null != getSchema()) {
        xmlReader.setFeature(VALIDATING,xmlReader.getFeature(VALIDATING));
      }
      return xmlReader;
    }
 catch (    Exception e) {
      throw XMLMarshalException.errorInstantiatingSchemaPlatform(e);
    }
  }
  return xmlReader;
}

Fixed version (ground truth):
private XMLReader getXMLReader(Class clazz){
  if (null == xmlReader) {
    xmlReader=getNewXMLReader(clazz,xmlUnmarshaller.getMediaType());
  }
  return xmlReader;
}
Program: 64771
Project: 64771
Buggy source:
/** 
 * INTERNAL: This is used only in initialization.
 */
public DatabaseField buildField(DatabaseField field){
  try {
    XMLField xmlField=(XMLField)field;
    xmlField.setNamespaceResolver(this.getNamespaceResolver());
    xmlField.initialize();
  }
 catch (  ClassCastException e) {
  }
  return super.buildField(field);
}

Fixed version (ground truth):
/** 
 * INTERNAL: This is used only in initialization.
 */
public DatabaseField buildField(DatabaseField field){
  try {
    Map<DatabaseField,DatabaseField> builtFields=getObjectBuilder().getFieldsMap();
    DatabaseField builtField=builtFields.get(field);
    if (builtField == null) {
      XMLField xmlField=(XMLField)field;
      xmlField.setNamespaceResolver(this.getNamespaceResolver());
      xmlField.initialize();
      builtFields.put(xmlField,xmlField);
      return xmlField;
    }
    return builtField;
  }
 catch (  ClassCastException e) {
  }
  return super.buildField(field);
}
Program: 64774
Project: 64774
Buggy source:
public TestSuite getSessionsXMLLoadingTestSuite(){
  TestSuite suite=new TestSuite();
  suite.setName("String_Node_Str");
  suite.addTest(new JavaLogSessionsXMLTest());
  return suite;
}

Fixed version (ground truth):
public TestSuite getSessionsXMLLoadingTestSuite(){
  TestSuite suite=new TestSuite();
  suite.setName("String_Node_Str");
  suite.addTest(new JavaLogSessionsXMLTest());
  suite.addTest(new JavaLogSessionNamespaceTest());
  return suite;
}
Program: 64775
Project: 64775
Buggy source:
/** 
 * INTERNAL: Process the common elements from a SessionConfig.
 */
protected void processSessionConfig(SessionConfig sessionConfig,AbstractSession session){
  processSessionEventManagerConfig(sessionConfig.getSessionEventManagerConfig(),session);
  ((DatabaseSessionImpl)session).setServerPlatform(buildServerPlatformConfig(sessionConfig.getServerPlatformConfig(),(DatabaseSessionImpl)session));
  SessionLog log=buildSessionLog(sessionConfig.getLogConfig(),session);
  if (log != null) {
    session.setSessionLog(log);
  }
  buildRemoteCommandManagerConfig(sessionConfig.getRemoteCommandManagerConfig(),session);
  session.setName(sessionConfig.getName());
  if (sessionConfig.getProfiler() != null) {
    if (sessionConfig.getProfiler().equals("String_Node_Str")) {
      session.setProfiler(new PerformanceProfiler());
    }
  }
  String exceptionHandlerClassName=sessionConfig.getExceptionHandlerClass();
  if (exceptionHandlerClassName != null) {
    try {
      Class exceptionHandlerClass=m_classLoader.loadClass(exceptionHandlerClassName);
      if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
        session.setExceptionHandler((ExceptionHandler)AccessController.doPrivileged(new PrivilegedNewInstanceFromClass(exceptionHandlerClass)));
      }
 else {
        session.setExceptionHandler((ExceptionHandler)PrivilegedAccessHelper.newInstanceFromClass(exceptionHandlerClass));
      }
    }
 catch (    Throwable e) {
      throw SessionLoaderException.failedToLoadTag("String_Node_Str",exceptionHandlerClassName,e);
    }
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Process the common elements from a SessionConfig.
 */
protected void processSessionConfig(SessionConfig sessionConfig,AbstractSession session){
  session.setName(sessionConfig.getName());
  processSessionEventManagerConfig(sessionConfig.getSessionEventManagerConfig(),session);
  ((DatabaseSessionImpl)session).setServerPlatform(buildServerPlatformConfig(sessionConfig.getServerPlatformConfig(),(DatabaseSessionImpl)session));
  SessionLog log=buildSessionLog(sessionConfig.getLogConfig(),session);
  if (log != null) {
    session.setSessionLog(log);
  }
  buildRemoteCommandManagerConfig(sessionConfig.getRemoteCommandManagerConfig(),session);
  if (sessionConfig.getProfiler() != null) {
    if (sessionConfig.getProfiler().equals("String_Node_Str")) {
      session.setProfiler(new PerformanceProfiler());
    }
  }
  String exceptionHandlerClassName=sessionConfig.getExceptionHandlerClass();
  if (exceptionHandlerClassName != null) {
    try {
      Class exceptionHandlerClass=m_classLoader.loadClass(exceptionHandlerClassName);
      if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
        session.setExceptionHandler((ExceptionHandler)AccessController.doPrivileged(new PrivilegedNewInstanceFromClass(exceptionHandlerClass)));
      }
 else {
        session.setExceptionHandler((ExceptionHandler)PrivilegedAccessHelper.newInstanceFromClass(exceptionHandlerClass));
      }
    }
 catch (    Throwable e) {
      throw SessionLoaderException.failedToLoadTag("String_Node_Str",exceptionHandlerClassName,e);
    }
  }
}
Program: 64780
Project: 64780
Buggy source:
public void testXMLToObjectFromXMLStreamReaderEx() throws Exception {
  if (null != XML_INPUT_FACTORY && isUnmarshalTest()) {
    InputStream instream=ClassLoader.getSystemResourceAsStream(resourceName);
    XMLStreamReader xmlStreamReader=XML_INPUT_FACTORY.createXMLStreamReader(instream);
    ExtendedXMLStreamReaderReader xmlStreamReaderReaderEx=new ExtendedXMLStreamReaderReader();
    XMLStreamReaderInputSource xmlStreamReaderInputSource=new XMLStreamReaderInputSource(xmlStreamReader);
    SAXSource saxSource=new SAXSource(xmlStreamReaderReaderEx,xmlStreamReaderInputSource);
    jaxbUnmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE,"String_Node_Str");
    Object testObject=null;
    if (getUnmarshalClass() != null) {
      testObject=jaxbUnmarshaller.unmarshal(saxSource,getUnmarshalClass());
    }
 else {
      testObject=jaxbUnmarshaller.unmarshal(saxSource);
    }
    instream.close();
    xmlToObjectTest(testObject);
  }
}

Fixed version (ground truth):
public void testXMLToObjectFromXMLStreamReaderEx() throws Exception {
  if (null != XML_INPUT_FACTORY && isUnmarshalTest()) {
    InputStream instream=ClassLoader.getSystemResourceAsStream(resourceName);
    XMLStreamReader xmlStreamReader=XML_INPUT_FACTORY.createXMLStreamReader(instream);
    ExtendedXMLStreamReaderReader xmlStreamReaderReaderEx=new ExtendedXMLStreamReaderReader();
    xmlStreamReaderReaderEx.setErrorHandler(((JAXBUnmarshaller)jaxbUnmarshaller).getXMLUnmarshaller().getErrorHandler());
    XMLStreamReaderInputSource xmlStreamReaderInputSource=new XMLStreamReaderInputSource(xmlStreamReader);
    SAXSource saxSource=new SAXSource(xmlStreamReaderReaderEx,xmlStreamReaderInputSource);
    jaxbUnmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE,"String_Node_Str");
    Object testObject=null;
    if (getUnmarshalClass() != null) {
      testObject=jaxbUnmarshaller.unmarshal(saxSource,getUnmarshalClass());
    }
 else {
      testObject=jaxbUnmarshaller.unmarshal(saxSource);
    }
    instream.close();
    xmlToObjectTest(testObject);
  }
}
Program: 64781
Project: 64781
Buggy source:
private void buildFragments(String xpathString){
  StringTokenizer st=new StringTokenizer(xpathString,"String_Node_Str");
  String next;
  int i=0;
  XPathFragment currentXPathFragment=null;
  XPathFragment nextXPathFragment=null;
  if (xpathString.charAt(0) == '/') {
    next=st.nextToken();
    next='/' + next;
    currentXPathFragment=new XPathFragment(next);
    setXPathFragment(currentXPathFragment);
    currentXPathFragment.setXMLField(this);
    i++;
  }
  while (st.hasMoreTokens()) {
    next=st.nextToken().intern();
    if (null != next) {
      if (next.equals(XMLConstants.TEXT)) {
        nextXPathFragment=new XPathFragment(XMLConstants.TEXT);
      }
 else {
        nextXPathFragment=new XPathFragment(next);
      }
      if (0 == i) {
        setXPathFragment(nextXPathFragment);
      }
 else {
        currentXPathFragment.setNextFragment(nextXPathFragment);
        if (nextXPathFragment.isAttribute() || nextXPathFragment.nameIsText()) {
          currentXPathFragment.setHasText(true);
        }
      }
      nextXPathFragment.setXMLField(this);
      currentXPathFragment=nextXPathFragment;
      i++;
    }
    setLastXPathFragment(currentXPathFragment);
  }
}

Fixed version (ground truth):
private void buildFragments(String xpathString){
  StringTokenizer st=new StringTokenizer(xpathString,"String_Node_Str",true);
  String next;
  int i=0;
  XPathFragment currentXPathFragment=null;
  XPathFragment nextXPathFragment=null;
  while (st.hasMoreTokens()) {
    next=st.nextToken();
    if (null != next) {
      if ("String_Node_Str".equals(next)) {
        if (0 == i) {
          next="String_Node_Str" + st.nextToken();
        }
 else {
          continue;
        }
      }
      if (next.contains("String_Node_Str") && !next.contains("String_Node_Str")) {
        StringBuilder sb=new StringBuilder(next);
        String more;
        while (st.hasMoreTokens()) {
          more=st.nextToken();
          sb.append(more);
          if (more.contains("String_Node_Str"))           break;
        }
        next=sb.toString().intern();
      }
 else {
        next=next.intern();
      }
      nextXPathFragment=new XPathFragment(next);
      if (0 == i) {
        setXPathFragment(nextXPathFragment);
      }
 else {
        currentXPathFragment.setNextFragment(nextXPathFragment);
        if (nextXPathFragment.isAttribute() || nextXPathFragment.nameIsText()) {
          currentXPathFragment.setHasText(true);
        }
      }
      nextXPathFragment.setXMLField(this);
      currentXPathFragment=nextXPathFragment;
      i++;
    }
    setLastXPathFragment(currentXPathFragment);
  }
}
Program: 64782
Project: 64782
Buggy source:
/** 
 * INTERNAL:
 */
public void setMarshaller(XMLMarshaller marshaller){
  super.setMarshaller(marshaller);
  attributePrefix=marshaller.getAttributePrefix();
  encoder=Charset.forName(marshaller.getEncoding()).newEncoder();
  if (marshaller.getValueWrapper() != null) {
    textWrapperFragment=new XPathFragment(marshaller.getValueWrapper());
  }
  characterEscapeHandler=marshaller.getCharacterEscapeHandler();
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void setMarshaller(XMLMarshaller marshaller){
  super.setMarshaller(marshaller);
  attributePrefix=marshaller.getAttributePrefix();
  encoder=Charset.forName(marshaller.getEncoding()).newEncoder();
  if (marshaller.getValueWrapper() != null) {
    textWrapperFragment=new XPathFragment();
    textWrapperFragment.setLocalName(marshaller.getValueWrapper());
  }
  characterEscapeHandler=marshaller.getCharacterEscapeHandler();
}
Program: 64784
Project: 64784
Buggy source:
public MarshalRecord(){
  super();
}

Fixed version (ground truth):
public MarshalRecord(){
  super();
  namespaceResolver=new NamespaceResolver();
}
Program: 64785
Project: 64785
Buggy source:
public XMLRecord(){
  super(null,null);
  namespaceResolver=new NamespaceResolver();
  namespaceAware=true;
}

Fixed version (ground truth):
public XMLRecord(){
  super(null,null,0);
  namespaceAware=true;
}
Program: 64786
Project: 64786
Buggy source:
private static XmlBindings getXmlBindingsByMediaType(Unmarshaller unmarshaller,Source metadata,ClassLoader classLoader,Map<String,Object> properties,String mediaType) throws JAXBException {
  if ("String_Node_Str".equals(mediaType)) {
    unmarshaller.setEventHandler(JSON_BINDING_DOCUMENT_VEH);
  }
 else {
    unmarshaller.setEventHandler(JAXBContext.DEFAULT_VALIDATION_EVENT_HANDER);
  }
  unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE,mediaType);
  unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT,false);
  JAXBElement jbe=unmarshaller.unmarshal((Source)metadata,XmlBindings.class);
  return (XmlBindings)jbe.getValue();
}

Fixed version (ground truth):
private static XmlBindings getXmlBindingsByMediaType(Unmarshaller unmarshaller,Source metadata,ClassLoader classLoader,Map<String,Object> properties,MediaType mediaType) throws JAXBException {
  if (MediaType.APPLICATION_XML.equals(mediaType)) {
    unmarshaller.setEventHandler(JSON_BINDING_DOCUMENT_VEH);
  }
 else {
    unmarshaller.setEventHandler(JAXBContext.DEFAULT_VALIDATION_EVENT_HANDER);
  }
  unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE,mediaType);
  unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT,false);
  JAXBElement jbe=unmarshaller.unmarshal((Source)metadata,XmlBindings.class);
  return (XmlBindings)jbe.getValue();
}
Program: 64789
Project: 64789
Buggy source:
public void setDocumentLocator(Locator locator){
  if (locator instanceof Locator2) {
    this.locator=(Locator2)locator;
  }
}

Fixed version (ground truth):
public void setDocumentLocator(Locator locator){
  if (xmlReader != null && locator instanceof Locator2) {
    xmlReader.setLocator(locator);
  }
}
Program: 64790
Project: 64790
Buggy source:
private void parse(XMLEventReader xmlEventReader) throws SAXException {
  locator=new EventReaderLocator();
  try {
    contentHandler.startDocument();
    parseEvent(xmlEventReader.nextEvent());
    while (depth > 0) {
      parseEvent(xmlEventReader.nextEvent());
    }
    contentHandler.endDocument();
  }
 catch (  XMLStreamException ex) {
    throw new RuntimeException(ex);
  }
}

Fixed version (ground truth):
private void parse(XMLEventReader xmlEventReader) throws SAXException {
  try {
    contentHandler.startDocument();
    parseEvent(xmlEventReader.nextEvent());
    while (depth > 0) {
      parseEvent(xmlEventReader.nextEvent());
    }
    contentHandler.endDocument();
  }
 catch (  XMLStreamException ex) {
    throw new RuntimeException(ex);
  }
}
Program: 64792
Project: 64792
Buggy source:
public int getIndex(String uri,String localName){
  if (null == localName) {
    return -1;
  }
  int index=0;
  QName testQName=new QName(uri,localName);
  for (  Attribute attribute : attributes()) {
    if (localName.equals(attribute.getLocalName()) && uri.equals(attribute.getUri())) {
      return index;
    }
    index++;
  }
  return -1;
}

Fixed version (ground truth):
public int getIndex(String uri,String localName){
  if (null == localName) {
    return -1;
  }
  int index=0;
  for (  Attribute attribute : attributes()) {
    if (localName.equals(attribute.getLocalName()) && uri.equals(attribute.getUri())) {
      return index;
    }
    index++;
  }
  return -1;
}
Program: 64793
Project: 64793
Buggy source:
public void parse(XMLStreamReader xmlStreamReader) throws SAXException {
  unmarshalNamespaceContext.setXmlStreamReader(xmlStreamReader);
  indexedAttributeList.setXmlStreamReader(xmlStreamReader);
  locator=new StreamReaderLocator(xmlStreamReader);
  try {
    contentHandler.startDocument();
    parseEvent(xmlStreamReader,xmlStreamReader.getEventType());
    while (depth > 0) {
      int eventType=xmlStreamReader.next();
      parseEvent(xmlStreamReader,eventType);
    }
    contentHandler.endDocument();
  }
 catch (  SAXException e) {
    throw e;
  }
catch (  Exception e) {
    throw new SAXException(e);
  }
}

Fixed version (ground truth):
public void parse(XMLStreamReader xmlStreamReader) throws SAXException {
  this.xmlStreamReader=xmlStreamReader;
  unmarshalNamespaceContext.setXmlStreamReader(xmlStreamReader);
  indexedAttributeList.setXmlStreamReader(xmlStreamReader);
  try {
    contentHandler.startDocument();
    parseEvent(xmlStreamReader,xmlStreamReader.getEventType());
    while (depth > 0) {
      int eventType=xmlStreamReader.next();
      parseEvent(xmlStreamReader,eventType);
    }
    contentHandler.endDocument();
  }
 catch (  SAXException e) {
    throw e;
  }
catch (  Exception e) {
    throw new SAXException(e);
  }
}
Program: 64795
Project: 64795
Buggy source:
public Locator getDocumentLocator(){
  return this.documentLocator;
}

Fixed version (ground truth):
public Locator getDocumentLocator(){
  if (xmlReader != null) {
    return xmlReader.getLocator();
  }
  return null;
}
Program: 64796
Project: 64796
Buggy source:
public void setDocumentLocator(Locator locator){
  this.documentLocator=locator;
  if (null == rootElementName && null == rootElementLocalName && parentRecord == null && locator instanceof Locator2) {
    Locator2 loc=(Locator2)locator;
    this.setEncoding(loc.getEncoding());
    this.setVersion(loc.getXMLVersion());
  }
}

Fixed version (ground truth):
public void setDocumentLocator(Locator locator){
  if (xmlReader != null) {
    xmlReader.setLocator(locator);
    if (null == rootElementName && null == rootElementLocalName && parentRecord == null && locator instanceof Locator2) {
      Locator2 loc=(Locator2)locator;
      this.setEncoding(loc.getEncoding());
      this.setVersion(loc.getXMLVersion());
    }
  }
}
Program: 64798
Project: 64798
Buggy source:
public UnmarshalRecord getChildUnmarshalRecord(TreeObjectBuilder treeObjectBuilder){
  if (childRecord != null && !childRecord.isSelfRecord) {
    childRecord.initialize(treeObjectBuilder);
    childRecord.setParentRecord(this);
    return childRecord;
  }
 else {
    childRecord=(UnmarshalRecord)treeObjectBuilder.createRecord(session);
    childRecord.setUnmarshaller(unmarshaller);
    childRecord.setTextWrapperFragment(textWrapperFragment);
    childRecord.setXMLReader(this.xmlReader);
    childRecord.setFragmentBuilder(fragmentBuilder);
    childRecord.setUnmarshalNamespaceResolver(this.getUnmarshalNamespaceResolver());
    childRecord.setParentRecord(this);
  }
  return childRecord;
}

Fixed version (ground truth):
public UnmarshalRecord getChildUnmarshalRecord(TreeObjectBuilder treeObjectBuilder){
  if (childRecord != null && !childRecord.isSelfRecord) {
    childRecord.initialize(treeObjectBuilder);
    childRecord.setParentRecord(this);
    return childRecord;
  }
 else {
    childRecord=(UnmarshalRecord)treeObjectBuilder.createRecord(session);
    childRecord.setUnmarshaller(unmarshaller);
    childRecord.setTextWrapperFragment(textWrapperFragment);
    childRecord.setXMLReader(this.xmlReader);
    childRecord.setFragmentBuilder(fragmentBuilder);
    childRecord.setUnmarshalNamespaceResolver(unmarshalNamespaceResolver);
    childRecord.setParentRecord(this);
  }
  return childRecord;
}
Program: 64803
Project: 64803
Buggy source:
/** 
 * PUBLIC: Indicates that this mapping should collapse all string values before setting them in the object on unmarshal. Collapse removes leading and trailing whitespaces, and replaces any sequence of whitepsace characters with a single space. 
 * @param normalize
 */
public void setCollapsingStringValues(boolean collapse){
  this.isCollapsingStringValues=collapse;
}

Fixed version (ground truth):
/** 
 * PUBLIC: Indicates that this mapping should collapse all string values before setting them in the object on unmarshal. Collapse removes leading and trailing whitespaces, and replaces any sequence of whitepsace characters with a single space. 
 * @param collapse
 */
public void setCollapsingStringValues(boolean collapse){
  this.isCollapsingStringValues=collapse;
}
Program: 64804
Project: 64804
Buggy source:
/** 
 * PUBLIC: Returns true if this mapping should collapse all string values before setting them in the object on unmarshal. Collapse removes leading and trailing whitespaces, and replaces any sequence of whitepsace characters with a single space. 
 * @param normalize
 */
public boolean isCollapsingStringValues(){
  return this.isCollapsingStringValues;
}

Fixed version (ground truth):
/** 
 * PUBLIC: Returns true if this mapping should collapse all string values before setting them in the object on unmarshal. Collapse removes leading and trailing whitespaces, and replaces any sequence of whitepsace characters with a single space. 
 */
public boolean isCollapsingStringValues(){
  return this.isCollapsingStringValues;
}
Program: 64805
Project: 64805
Buggy source:
/** 
 * INTERNAL: Convert the attribute value to a field value. Process any converter if defined, and check for null values.
 */
public Object getFieldValue(Object attributeValue,AbstractSession session,XMLRecord record){
  Object fieldValue=attributeValue;
  if ((this.nullValue != null) && (this.nullValue.equals(fieldValue)) && !((XMLField)field).isRequired()) {
    return null;
  }
  if (converter != null) {
    if (converter instanceof XMLConverter) {
      fieldValue=((XMLConverter)converter).convertObjectValueToDataValue(fieldValue,session,record.getMarshaller());
    }
 else {
      fieldValue=converter.convertObjectValueToDataValue(fieldValue,session);
    }
  }
  if (fieldValue != null) {
    Class fieldClassification=getFieldClassification(field);
    if (fieldClassification != fieldValue.getClass()) {
      try {
        fieldValue=session.getPlatform(descriptor.getJavaClass()).convertObject(fieldValue,fieldClassification);
      }
 catch (      ConversionException exception) {
        throw ConversionException.couldNotBeConverted(this,descriptor,exception);
      }
    }
  }
  return fieldValue;
}

Fixed version (ground truth):
/** 
 * INTERNAL: Convert the attribute value to a field value. Process any converter if defined, and check for null values.
 */
public Object getFieldValue(Object attributeValue,AbstractSession session,XMLRecord record){
  Object fieldValue=attributeValue;
  if ((this.nullValue != null) && (this.nullValue.equals(fieldValue)) && !this.isNullValueMarshalled&& !((XMLField)field).isRequired()) {
    return null;
  }
  if (converter != null) {
    if (converter instanceof XMLConverter) {
      fieldValue=((XMLConverter)converter).convertObjectValueToDataValue(fieldValue,session,record.getMarshaller());
    }
 else {
      fieldValue=converter.convertObjectValueToDataValue(fieldValue,session);
    }
  }
  if (fieldValue != null) {
    Class fieldClassification=getFieldClassification(field);
    if (fieldClassification != fieldValue.getClass()) {
      try {
        fieldValue=session.getPlatform(descriptor.getJavaClass()).convertObject(fieldValue,fieldClassification);
      }
 catch (      ConversionException exception) {
        throw ConversionException.couldNotBeConverted(this,descriptor,exception);
      }
    }
  }
  return fieldValue;
}
Program: 64806
Project: 64806
Buggy source:
public UnmarshalRecord getChildUnmarshalRecord(TreeObjectBuilder treeObjectBuilder){
  if (childRecord != null && !childRecord.isSelfRecord) {
    childRecord.initialize(treeObjectBuilder);
    childRecord.setParentRecord(this);
    return childRecord;
  }
 else {
    childRecord=(UnmarshalRecord)treeObjectBuilder.createRecord(session);
    childRecord.setUnmarshaller(unmarshaller);
    childRecord.session=this.session;
    childRecord.setTextWrapperFragment(textWrapperFragment);
    childRecord.setXMLReader(this.xmlReader);
    childRecord.setFragmentBuilder(fragmentBuilder);
    childRecord.setUnmarshalNamespaceResolver(this.getUnmarshalNamespaceResolver());
    childRecord.setParentRecord(this);
  }
  return childRecord;
}

Fixed version (ground truth):
public UnmarshalRecord getChildUnmarshalRecord(TreeObjectBuilder treeObjectBuilder){
  if (childRecord != null && !childRecord.isSelfRecord) {
    childRecord.initialize(treeObjectBuilder);
    childRecord.setParentRecord(this);
    return childRecord;
  }
 else {
    childRecord=(UnmarshalRecord)treeObjectBuilder.createRecord(session);
    childRecord.setUnmarshaller(unmarshaller);
    childRecord.setTextWrapperFragment(textWrapperFragment);
    childRecord.setXMLReader(this.xmlReader);
    childRecord.setFragmentBuilder(fragmentBuilder);
    childRecord.setUnmarshalNamespaceResolver(this.getUnmarshalNamespaceResolver());
    childRecord.setParentRecord(this);
  }
  return childRecord;
}
Program: 64807
Project: 64807
Buggy source:
public DatabaseMapping generateCollectionMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  JavaClass javaClass=property.getActualType();
  if (property.isMixedContent()) {
    return generateAnyCollectionMapping(property,descriptor,namespaceInfo,true);
  }
  if (property.isXmlIdRef() || property.isSetXmlJoinNodes()) {
    return generateXMLCollectionReferenceMapping(property,descriptor,namespaceInfo,javaClass);
  }
  if (javaClass != null && typeInfo.get(javaClass.getQualifiedName()) != null) {
    TypeInfo referenceInfo=typeInfo.get(javaClass.getQualifiedName());
    if (referenceInfo.isEnumerationType()) {
      return generateEnumCollectionMapping(property,descriptor,namespaceInfo,(EnumTypeInfo)referenceInfo);
    }
    return generateCompositeCollectionMapping(property,descriptor,namespaceInfo,javaClass.getQualifiedName());
  }
  if (!property.isAttribute() && javaClass != null && javaClass.getQualifiedName().equals(OBJECT_CLASS_NAME)) {
    XMLCompositeCollectionMapping ccMapping=generateCompositeCollectionMapping(property,descriptor,namespaceInfo,null);
    ccMapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT);
    return ccMapping;
  }
  if (isBinaryData(javaClass)) {
    return generateBinaryDataCollectionMapping(property,descriptor,namespaceInfo);
  }
  return generateDirectCollectionMapping(property,descriptor,namespaceInfo);
}

Fixed version (ground truth):
public DatabaseMapping generateCollectionMapping(Property property,XMLDescriptor descriptor,JavaClass descriptorJavaClass,NamespaceInfo namespaceInfo){
  JavaClass javaClass=property.getActualType();
  if (property.isMixedContent()) {
    return generateAnyCollectionMapping(property,descriptor,namespaceInfo,true);
  }
  if (property.isXmlIdRef() || property.isSetXmlJoinNodes()) {
    return generateXMLCollectionReferenceMapping(property,descriptor,namespaceInfo,javaClass);
  }
  if (javaClass != null && typeInfo.get(javaClass.getQualifiedName()) != null) {
    TypeInfo referenceInfo=typeInfo.get(javaClass.getQualifiedName());
    if (referenceInfo.isEnumerationType()) {
      return generateEnumCollectionMapping(property,descriptor,namespaceInfo,(EnumTypeInfo)referenceInfo);
    }
    return generateCompositeCollectionMapping(property,descriptor,descriptorJavaClass,namespaceInfo,javaClass.getQualifiedName());
  }
  if (!property.isAttribute() && javaClass != null && javaClass.getQualifiedName().equals(OBJECT_CLASS_NAME)) {
    XMLCompositeCollectionMapping ccMapping=generateCompositeCollectionMapping(property,descriptor,descriptorJavaClass,namespaceInfo,null);
    ccMapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT);
    return ccMapping;
  }
  if (isBinaryData(javaClass)) {
    return generateBinaryDataCollectionMapping(property,descriptor,namespaceInfo);
  }
  return generateDirectCollectionMapping(property,descriptor,namespaceInfo);
}
Program: 64811
Project: 64811
Buggy source:
private void generateInheritedMappingsForAnonymousType(TypeInfo info,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  List<TypeInfo> mappedParents=new ArrayList<TypeInfo>();
  JavaClass next=CompilerHelper.getNextMappedSuperClass(helper.getJavaClass(info.getJavaClassName()),typeInfo,helper);
  while (next != null) {
    TypeInfo nextInfo=this.typeInfo.get(next.getName());
    mappedParents.add(0,nextInfo);
    next=CompilerHelper.getNextMappedSuperClass(helper.getJavaClass(nextInfo.getJavaClassName()),typeInfo,helper);
  }
  for (  TypeInfo nextInfo : mappedParents) {
    List<Property> propertiesInOrder=nextInfo.getNonTransientPropertiesInPropOrder();
    for (int i=0; i < propertiesInOrder.size(); i++) {
      Property nextProp=propertiesInOrder.get(i);
      if (nextProp != null) {
        DatabaseMapping mapping=generateMapping(nextProp,descriptor,namespaceInfo);
        descriptor.addMapping(mapping);
        if (nextProp.isSetUserProperties()) {
          mapping.setProperties(nextProp.getUserProperties());
        }
      }
    }
  }
}

Fixed version (ground truth):
private void generateInheritedMappingsForAnonymousType(TypeInfo info,XMLDescriptor descriptor,JavaClass descriptorJavaClass,NamespaceInfo namespaceInfo){
  List<TypeInfo> mappedParents=new ArrayList<TypeInfo>();
  JavaClass next=CompilerHelper.getNextMappedSuperClass(descriptorJavaClass,typeInfo,helper);
  while (next != null) {
    TypeInfo nextInfo=this.typeInfo.get(next.getName());
    mappedParents.add(0,nextInfo);
    next=CompilerHelper.getNextMappedSuperClass(helper.getJavaClass(nextInfo.getJavaClassName()),typeInfo,helper);
  }
  for (  TypeInfo nextInfo : mappedParents) {
    List<Property> propertiesInOrder=nextInfo.getNonTransientPropertiesInPropOrder();
    for (int i=0; i < propertiesInOrder.size(); i++) {
      Property nextProp=propertiesInOrder.get(i);
      if (nextProp != null) {
        DatabaseMapping mapping=generateMapping(nextProp,descriptor,descriptorJavaClass,namespaceInfo);
        descriptor.addMapping(mapping);
        if (nextProp.isSetUserProperties()) {
          mapping.setProperties(nextProp.getUserProperties());
        }
      }
    }
  }
}
Program: 64812
Project: 64812
Buggy source:
public XMLCompositeCollectionMapping generateMapMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  XMLCompositeCollectionMapping mapping=new XMLCompositeCollectionMapping();
  mapping.setAttributeName(property.getPropertyName());
  initializeXMLContainerMapping(mapping);
  XMLField field=getXPathForField(property,namespaceInfo,false);
  JavaClass descriptorClass=helper.getJavaClass(descriptor.getJavaClassName());
  JavaClass mapValueClass=helper.getJavaClass(MapValue.class);
  if (mapValueClass.isAssignableFrom(descriptorClass)) {
    mapping.setXPath("String_Node_Str");
  }
 else {
    mapping.setXPath(field.getXPath() + "String_Node_Str");
  }
  Class generatedClass=generateMapEntryClassAndDescriptor(property,descriptor.getNonNullNamespaceResolver());
  mapping.setReferenceClass(generatedClass);
  String mapClassName=property.getType().getRawName();
  mapping.useCollectionClass(ArrayList.class);
  mapping.setAttributeAccessor(new MapValueAttributeAccessor(mapping.getAttributeAccessor(),mapping.getContainerPolicy(),generatedClass,mapClassName,helper.getClassLoader()));
  return mapping;
}

Fixed version (ground truth):
public XMLCompositeCollectionMapping generateMapMapping(Property property,XMLDescriptor descriptor,JavaClass descriptorClass,NamespaceInfo namespaceInfo){
  XMLCompositeCollectionMapping mapping=new XMLCompositeCollectionMapping();
  mapping.setAttributeName(property.getPropertyName());
  initializeXMLContainerMapping(mapping);
  XMLField field=getXPathForField(property,namespaceInfo,false);
  JavaClass mapValueClass=helper.getJavaClass(MapValue.class);
  if (mapValueClass.isAssignableFrom(descriptorClass)) {
    mapping.setXPath("String_Node_Str");
  }
 else {
    mapping.setXPath(field.getXPath() + "String_Node_Str");
  }
  Class generatedClass=generateMapEntryClassAndDescriptor(property,descriptor.getNonNullNamespaceResolver());
  mapping.setReferenceClass(generatedClass);
  String mapClassName=property.getType().getRawName();
  mapping.useCollectionClass(ArrayList.class);
  mapping.setAttributeAccessor(new MapValueAttributeAccessor(mapping.getAttributeAccessor(),mapping.getContainerPolicy(),generatedClass,mapClassName,helper.getClassLoader()));
  return mapping;
}
Program: 64813
Project: 64813
Buggy source:
/** 
 * PUBLIC: Returns if this should marshal to a fragment.  If true an XML header string is not written out.
 * @return if this should marshal to a fragment or not
 */
public boolean isFragment(){
  return transformer.isFragment();
}

Fixed version (ground truth):
/** 
 * PUBLIC: Returns if this should marshal to a fragment.  If true an XML header string is not written out.
 * @return if this should marshal to a fragment or not
 */
public boolean isFragment(){
  return mediaType == MediaType.APPLICATION_XML && transformer.isFragment();
}
Program: 64814
Project: 64814
Buggy source:
@Override public XMLMarshaller clone(){
  XMLMarshaller clone=new XMLMarshaller(xmlContext);
  clone.setAttachmentMarshaller(attachmentMarshaller);
  clone.setEncoding(getEncoding());
  clone.setFormattedOutput(isFormattedOutput());
  clone.setFragment(isFragment());
  clone.setMarshalListener(marshalListener);
  clone.setNoNamespaceSchemaLocation(noNamespaceSchemaLocation);
  for (  Entry entry : marshalProperties.entrySet()) {
    clone.getProperties().put(entry.getKey(),entry.getValue());
  }
  if (null != schema) {
    clone.setSchema(schema);
  }
  clone.setSchemaLocation(schemaLocation);
  return clone;
}

Fixed version (ground truth):
@Override public XMLMarshaller clone(){
  XMLMarshaller clone=new XMLMarshaller(xmlContext);
  clone.setAttachmentMarshaller(attachmentMarshaller);
  clone.setEncoding(getEncoding());
  clone.setFormattedOutput(isFormattedOutput());
  clone.setFragment(transformer.isFragment());
  clone.setMediaType(getMediaType());
  clone.setMarshalListener(marshalListener);
  clone.setNoNamespaceSchemaLocation(noNamespaceSchemaLocation);
  clone.setAttributePrefix(getAttributePrefix());
  clone.setCharacterEscapeHandler(getCharacterEscapeHandler());
  clone.setIncludeRoot(isIncludeRoot());
  clone.setIndentString(getIndentString());
  clone.setMarshalEmptyCollections(isMarshalEmptyCollections());
  clone.setNamespacePrefixMapper(getNamespacePrefixMapper());
  clone.setNamespaceSeparator(getNamespaceSeparator());
  clone.setValueWrapper(getValueWrapper());
  for (  Entry entry : marshalProperties.entrySet()) {
    clone.getProperties().put(entry.getKey(),entry.getValue());
  }
  if (null != schema) {
    clone.setSchema(schema);
  }
  clone.setSchemaLocation(schemaLocation);
  return clone;
}
Program: 64816
Project: 64816
Buggy source:
private XMLReader getXMLReader(Class clazz){
  if (null == xmlReader) {
    if (xmlUnmarshaller.getMediaType() == MediaType.APPLICATION_JSON) {
      return new JSONReader(xmlUnmarshaller.getAttributePrefix(),xmlUnmarshaller.getNamespaceResolver(),xmlUnmarshaller.getNamespaceResolver() != null,xmlUnmarshaller.isIncludeRoot(),xmlUnmarshaller.getNamespaceSeparator(),xmlUnmarshaller.getErrorHandler(),xmlUnmarshaller.getValueWrapper(),clazz);
    }
    try {
      xmlReader=new XMLReader(getSAXParser().getXMLReader());
      if (null != errorHandler) {
        xmlReader.setErrorHandler(errorHandler);
      }
      if (null != entityResolver) {
        xmlReader.setEntityResolver(entityResolver);
      }
      setValidationMode(getValidationMode());
      if (null != getSchema()) {
        xmlReader.setFeature(VALIDATING,xmlReader.getFeature(VALIDATING));
      }
      return xmlReader;
    }
 catch (    Exception e) {
      throw XMLMarshalException.errorInstantiatingSchemaPlatform(e);
    }
  }
  return xmlReader;
}

Fixed version (ground truth):
private XMLReader getXMLReader(Class clazz){
  if (null == xmlReader) {
    if (xmlUnmarshaller.getMediaType() == MediaType.APPLICATION_JSON) {
      xmlReader=new JSONReader(xmlUnmarshaller.getAttributePrefix(),xmlUnmarshaller.getNamespaceResolver(),xmlUnmarshaller.getNamespaceResolver() != null,xmlUnmarshaller.isIncludeRoot(),xmlUnmarshaller.getNamespaceSeparator(),xmlUnmarshaller.getErrorHandler(),xmlUnmarshaller.getValueWrapper(),clazz);
      return xmlReader;
    }
    try {
      xmlReader=new XMLReader(getSAXParser().getXMLReader());
      if (null != errorHandler) {
        xmlReader.setErrorHandler(errorHandler);
      }
      if (null != entityResolver) {
        xmlReader.setEntityResolver(entityResolver);
      }
      setValidationMode(getValidationMode());
      if (null != getSchema()) {
        xmlReader.setFeature(VALIDATING,xmlReader.getFeature(VALIDATING));
      }
      return xmlReader;
    }
 catch (    Exception e) {
      throw XMLMarshalException.errorInstantiatingSchemaPlatform(e);
    }
  }
  return xmlReader;
}
Program: 64817
Project: 64817
Buggy source:
/** 
 * Set the MediaType for this xmlUnmarshaller. See org.eclipse.persistence.oxm.MediaType for the media types supported by EclipseLink MOXy
 * @since 2.4
 * @param mediaType
 */
public void setMediaType(MediaType mediaType){
  this.mediaType=mediaType;
}

Fixed version (ground truth):
/** 
 * Set the MediaType for this xmlUnmarshaller. See org.eclipse.persistence.oxm.MediaType for the media types supported by EclipseLink MOXy
 * @since 2.4
 * @param mediaType
 */
public void setMediaType(MediaType mediaType){
  if (this.mediaType != mediaType) {
    this.mediaType=mediaType;
    if (platformUnmarshaller != null) {
      platformUnmarshaller.mediaTypeChanged();
    }
  }
}
Program: 64818
Project: 64818
Buggy source:
private NodeList selectTextNodes(Node contextNode,AbstractNullPolicy nullPolicy){
  Node n=selectSingleText(contextNode);
  XMLNodeList xmlNodeList=new XMLNodeList();
  if (n == null && nullPolicy != null) {
    if (nullPolicy.valueIsNull((Element)contextNode)) {
      if (nullPolicy.getMarshalNullRepresentation() != XMLNullRepresentationType.ABSENT_NODE) {
        xmlNodeList.add(n);
      }
    }
 else {
      xmlNodeList.add(contextNode.getOwnerDocument().createTextNode(XMLConstants.EMPTY_STRING));
    }
  }
 else {
    if (n != null) {
      xmlNodeList.add(n);
    }
  }
  return xmlNodeList;
}

Fixed version (ground truth):
private NodeList selectTextNodes(Node contextNode,AbstractNullPolicy nullPolicy){
  Node n=selectSingleText(contextNode);
  XMLNodeList xmlNodeList=new XMLNodeList();
  if (n == null && nullPolicy != null) {
    if (nullPolicy.valueIsNull((Element)contextNode)) {
      if (nullPolicy.getMarshalNullRepresentation() != XMLNullRepresentationType.ABSENT_NODE) {
        xmlNodeList.add(n);
      }
    }
 else {
      xmlNodeList.add(contextNode.getOwnerDocument().createTextNode(XMLConstants.EMPTY_STRING));
    }
  }
 else {
    if (nullPolicy != null && nullPolicy.isNullRepresentedByXsiNil() && nullPolicy.valueIsNull((Element)contextNode)) {
      xmlNodeList.add(null);
    }
 else     if (n != null) {
      xmlNodeList.add(n);
    }
  }
  return xmlNodeList;
}
Program: 64819
Project: 64819
Buggy source:
private Object selectSingleNode(Node contextNode,XPathFragment xPathFragment,XMLNamespaceResolver xmlNamespaceResolver,boolean checkForXsiNil){
  Node resultNode=getSingleNode(contextNode,xPathFragment,xmlNamespaceResolver);
  if (resultNode == null) {
    if (checkForXsiNil) {
      String nil=((Element)contextNode).getAttributeNS(XMLConstants.SCHEMA_INSTANCE_URL,XMLConstants.SCHEMA_NIL_ATTRIBUTE);
      if (nil.equals(XMLConstants.BOOLEAN_STRING_TRUE)) {
        return XMLRecord.NIL;
      }
    }
    if (!xPathFragment.nameIsText()) {
      return XMLRecord.noEntry;
    }
    return null;
  }
  if (xPathFragment.getNextFragment() == null) {
    return resultNode;
  }
  return selectSingleNode(resultNode,xPathFragment.getNextFragment(),xmlNamespaceResolver,checkForXsiNil);
}

Fixed version (ground truth):
private Object selectSingleNode(Node contextNode,XPathFragment xPathFragment,XMLNamespaceResolver xmlNamespaceResolver,boolean checkForXsiNil){
  Node resultNode=getSingleNode(contextNode,xPathFragment,xmlNamespaceResolver);
  if (checkForXsiNil) {
    String nil=((Element)contextNode).getAttributeNS(XMLConstants.SCHEMA_INSTANCE_URL,XMLConstants.SCHEMA_NIL_ATTRIBUTE);
    if (nil.equals(XMLConstants.BOOLEAN_STRING_TRUE)) {
      return XMLRecord.NIL;
    }
  }
  if (resultNode == null) {
    if (!xPathFragment.nameIsText()) {
      return XMLRecord.noEntry;
    }
    return null;
  }
  if (xPathFragment.getNextFragment() == null) {
    return resultNode;
  }
  return selectSingleNode(resultNode,xPathFragment.getNextFragment(),xmlNamespaceResolver,checkForXsiNil);
}
Program: 64822
Project: 64822
Buggy source:
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord){
  unmarshalRecord.removeNullCapableValue(this);
  XMLField xmlField=(XMLField)xmlDirectMapping.getField();
  if (!xmlField.getLastXPathFragment().nameIsText) {
    return;
  }
  Object value;
  CharSequence unmarshalRecordCharacters=unmarshalRecord.getCharacters();
  if (unmarshalRecordCharacters.length() == 0) {
    value=xmlDirectMapping.getNullValue();
  }
 else {
    value=unmarshalRecordCharacters.toString();
  }
  unmarshalRecord.resetStringBuffer();
  AbstractSession session=unmarshalRecord.getSession();
  XMLConversionManager xmlConversionManager=(XMLConversionManager)session.getDatasourcePlatform().getConversionManager();
  QName typeQName=unmarshalRecord.getTypeQName();
  if (typeQName != null) {
    Class typeClass=xmlField.getJavaClass(typeQName);
    value=xmlConversionManager.convertObject(value,typeClass,typeQName);
  }
 else {
    value=unmarshalRecord.getXMLReader().convertValueBasedOnSchemaType(xmlField,value,xmlConversionManager,unmarshalRecord);
  }
  Object convertedValue=xmlDirectMapping.getAttributeValue(value,session,unmarshalRecord);
  unmarshalRecord.setAttributeValue(convertedValue,xmlDirectMapping);
}

Fixed version (ground truth):
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord){
  if (unmarshalRecord.isNil() && xmlDirectMapping.getNullPolicy().isNullRepresentedByXsiNil()) {
    unmarshalRecord.resetStringBuffer();
    return;
  }
  unmarshalRecord.removeNullCapableValue(this);
  XMLField xmlField=(XMLField)xmlDirectMapping.getField();
  if (!xmlField.getLastXPathFragment().nameIsText) {
    return;
  }
  Object value;
  CharSequence unmarshalRecordCharacters=unmarshalRecord.getCharacters();
  if (unmarshalRecordCharacters.length() == 0) {
    value=xmlDirectMapping.getNullValue();
  }
 else {
    value=unmarshalRecordCharacters.toString();
  }
  unmarshalRecord.resetStringBuffer();
  AbstractSession session=unmarshalRecord.getSession();
  XMLConversionManager xmlConversionManager=(XMLConversionManager)session.getDatasourcePlatform().getConversionManager();
  QName typeQName=unmarshalRecord.getTypeQName();
  if (typeQName != null) {
    Class typeClass=xmlField.getJavaClass(typeQName);
    value=xmlConversionManager.convertObject(value,typeClass,typeQName);
  }
 else {
    value=unmarshalRecord.getXMLReader().convertValueBasedOnSchemaType(xmlField,value,xmlConversionManager,unmarshalRecord);
  }
  Object convertedValue=xmlDirectMapping.getAttributeValue(value,session,unmarshalRecord);
  unmarshalRecord.setAttributeValue(convertedValue,xmlDirectMapping);
}