nus-yam/ex-repair huggingface dataset:
Program: 68453
Project: 68453
Buggy source:
/** 
 * Add a variable of type ValueHolderInterface to the class.  When this method has been run, the class will contain a variable declaration similar to the following: private ValueHolderInterface _persistence_variableName_vh;
 */
public void addValueHolder(AttributeDetails attributeDetails){
  String attribute=attributeDetails.getAttributeName();
  RuntimeVisibleAnnotations annotations=null;
  if (attributeDetails.getGetterMethodName() == null || attributeDetails.getGetterMethodName().equals("String_Node_Str")) {
    annotations=getTransientAnnotation();
  }
  cv.visitField(ACC_PRIVATE,"String_Node_Str" + attribute + "String_Node_Str",VHI_SIGNATURE,null,annotations);
}

Fixed version (ground truth):
/** 
 * Add a variable of type ValueHolderInterface to the class.  When this method has been run, the class will contain a variable declaration similar to the following: private ValueHolderInterface _persistence_variableName_vh;
 */
public void addValueHolder(AttributeDetails attributeDetails){
  String attribute=attributeDetails.getAttributeName();
  RuntimeVisibleAnnotations annotations=null;
  if (attributeDetails.getGetterMethodName() == null || attributeDetails.getGetterMethodName().equals("String_Node_Str")) {
    annotations=getTransientAnnotation();
  }
  cv.visitField(ACC_PROTECTED,"String_Node_Str" + attribute + "String_Node_Str",VHI_SIGNATURE,null,annotations);
}
Program: 68454
Project: 68454
Buggy source:
public int getMinOccurs(){
  return this.element.getMinOccurs();
}

Fixed version (ground truth):
public int getMinOccurs(){
  return this.minOccurs;
}
Program: 68455
Project: 68455
Buggy source:
public int getMaxOccurs(){
  return this.element.getMaxOccurs();
}

Fixed version (ground truth):
public int getMaxOccurs(){
  return this.maxOccurs;
}
Program: 68456
Project: 68456
Buggy source:
@Override protected void reloadInternal(XSObject schemaObject){
  super.reloadInternal(schemaObject);
  if (this.element != null) {
    this.element.reloadInternal(schemaObject);
  }
}

Fixed version (ground truth):
@Override protected void reloadInternal(XSObject schemaObject){
  super.reloadInternal(schemaObject);
  if (schemaObject instanceof XSParticleDecl) {
    this.minOccurs=((XSParticleDecl)schemaObject).getMinOccurs();
    this.maxOccurs=((XSParticleDecl)schemaObject).getMaxOccurs();
  }
}
Program: 68461
Project: 68461
Buggy source:
/** 
 * INTERNAL: Traverse the object to find references to objects not registered in this unit of work.
 */
public void discoverUnregisteredNewObjects(Map clones,final Map knownNewObjects,final Map unregisteredExistingObjects,Map visitedObjects){
  DescriptorIterator iterator=new DescriptorIterator(){
    public void iterate(    Object object){
      if (isClassReadOnly(object.getClass(),this.getCurrentDescriptor())) {
        this.setShouldBreak(true);
        return;
      }
      if (isSmartMerge() && isOriginalNewObject(object)) {
        return;
      }
 else       if (!isObjectRegistered(object)) {
        if ((shouldPerformNoValidation()) && (shouldValidateExistence() && checkForUnregisteredExistingObject(object))) {
          unregisteredExistingObjects.put(object,object);
          this.setShouldBreak(true);
          return;
        }
        knownNewObjects.put(object,object);
      }
    }
  }
;
  setUnregisteredExistingObjects(unregisteredExistingObjects);
  iterator.setVisitedObjects(visitedObjects);
  iterator.setResult(knownNewObjects);
  iterator.setSession(this);
  iterator.setShouldIterateOverWrappedObjects(false);
  for (Iterator clonesEnum=clones.keySet().iterator(); clonesEnum.hasNext(); ) {
    iterator.startIterationOn(clonesEnum.next());
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Traverse the object to find references to objects not registered in this unit of work.
 */
public void discoverUnregisteredNewObjects(Map clones,final Map knownNewObjects,final Map unregisteredExistingObjects,Map visitedObjects){
  DescriptorIterator iterator=new DescriptorIterator(){
    public void iterate(    Object object){
      if (isClassReadOnly(object.getClass(),this.getCurrentDescriptor())) {
        this.setShouldBreak(true);
        return;
      }
      if (isSmartMerge() && isOriginalNewObject(object)) {
        return;
      }
 else       if (!isObjectRegistered(object)) {
        if ((shouldPerformNoValidation()) && (!shouldValidateExistence() || checkForUnregisteredExistingObject(object))) {
          unregisteredExistingObjects.put(object,object);
          this.setShouldBreak(true);
          return;
        }
        knownNewObjects.put(object,object);
      }
    }
  }
;
  setUnregisteredExistingObjects(unregisteredExistingObjects);
  iterator.setVisitedObjects(visitedObjects);
  iterator.setResult(knownNewObjects);
  iterator.setSession(this);
  iterator.setShouldIterateOverWrappedObjects(false);
  for (Iterator clonesEnum=clones.keySet().iterator(); clonesEnum.hasNext(); ) {
    iterator.startIterationOn(clonesEnum.next());
  }
}
Program: 68462
Project: 68462
Buggy source:
public void testDatabaseSyncNewObject(){
  EntityManager em=createEntityManager();
  beginTransaction(em);
  try {
    Project project=new LargeProject();
    em.persist(project);
    project.setName("String_Node_Str");
    project.setTeamLeader(new Employee());
    project.getTeamLeader().addProject(project);
    em.flush();
  }
 catch (  IllegalStateException ex) {
    rollbackTransaction(em);
    return;
  }
  fail("String_Node_Str");
}

Fixed version (ground truth):
public void testDatabaseSyncNewObject(){
  EntityManager em=createEntityManager();
  beginTransaction(em);
  try {
    Project project=new LargeProject();
    em.persist(project);
    project.setName("String_Node_Str");
    project.setTeamLeader(new Employee());
    project.getTeamLeader().addProject(project);
    em.flush();
  }
 catch (  PersistenceException ex) {
    rollbackTransaction(em);
    if (ex.getCause() instanceof IllegalStateException)     return;
  }
  fail("String_Node_Str");
}
Program: 68464
Project: 68464
Buggy source:
public void testDatabaseSyncNewObject(){
  EntityManager em=createEntityManager("String_Node_Str");
  beginTransaction(em);
  try {
    Project project=new LargeProject();
    em.persist(project);
    project.setName("String_Node_Str");
    project.setTeamLeader(new Employee());
    project.getTeamLeader().addProject(project);
    em.flush();
  }
 catch (  IllegalStateException ex) {
    rollbackTransaction(em);
    return;
  }
  fail("String_Node_Str");
}

Fixed version (ground truth):
public void testDatabaseSyncNewObject(){
  EntityManager em=createEntityManager("String_Node_Str");
  beginTransaction(em);
  try {
    Project project=new LargeProject();
    em.persist(project);
    project.setName("String_Node_Str");
    project.setTeamLeader(new Employee());
    project.getTeamLeader().addProject(project);
    em.flush();
  }
 catch (  PersistenceException ex) {
    rollbackTransaction(em);
    if (ex.getCause() instanceof IllegalStateException)     return;
  }
  fail("String_Node_Str");
}
Program: 68466
Project: 68466
Buggy source:
/** 
 * For this test you need to add a persistence unit named default1 in the persistence.xml file in essentials_testmodels.jar.
 */
public void flushOptimisticLockExceptionTest(){
  EntityManager firstEm=createEntityManager();
  EntityManager secondEm=createAlternateEntityManager();
  String ejbqlString="String_Node_Str";
  secondEm.getTransaction().begin();
  try {
    firstEm.getTransaction().begin();
    try {
      Employee firstEmployee=(Employee)firstEm.createQuery(ejbqlString).getSingleResult();
      firstEmployee.setLastName("String_Node_Str");
      Employee secondEmployee=(Employee)secondEm.createQuery(ejbqlString).getSingleResult();
      secondEmployee.setLastName("String_Node_Str");
      firstEm.flush();
      firstEm.getTransaction().commit();
    }
 catch (    RuntimeException ex) {
      if (firstEm.getTransaction().isActive()) {
        firstEm.getTransaction().rollback();
      }
      firstEm.close();
      throw ex;
    }
    secondEm.flush();
    fail("String_Node_Str");
  }
 catch (  RuntimeException e) {
    if (secondEm.getTransaction().isActive()) {
      secondEm.getTransaction().rollback();
    }
    secondEm.close();
    undoEmployeeChanges();
    System.out.println("String_Node_Str");
    e.printStackTrace();
    if (isKnownMySQLIssue(e)) {
      warning("String_Node_Str");
    }
 else {
      Assert.assertTrue(e instanceof javax.persistence.OptimisticLockException);
    }
  }
}

Fixed version (ground truth):
/** 
 * For this test you need to add a persistence unit named default1 in the persistence.xml file in essentials_testmodels.jar.
 */
public void flushOptimisticLockExceptionTest(){
  EntityManager firstEm=createEntityManager();
  EntityManager secondEm=createAlternateEntityManager();
  String ejbqlString="String_Node_Str";
  secondEm.getTransaction().begin();
  try {
    firstEm.getTransaction().begin();
    try {
      Employee firstEmployee=(Employee)firstEm.createQuery(ejbqlString).getSingleResult();
      firstEmployee.setLastName("String_Node_Str");
      Employee secondEmployee=(Employee)secondEm.createQuery(ejbqlString).getSingleResult();
      secondEmployee.setLastName("String_Node_Str");
      firstEm.flush();
      firstEm.getTransaction().commit();
    }
 catch (    RuntimeException ex) {
      if (firstEm.getTransaction().isActive()) {
        firstEm.getTransaction().rollback();
      }
      firstEm.close();
      throw ex;
    }
    secondEm.flush();
    fail("String_Node_Str");
  }
 catch (  PersistenceException e) {
    if (secondEm.getTransaction().isActive()) {
      secondEm.getTransaction().rollback();
    }
    secondEm.close();
    undoEmployeeChanges();
    System.out.println("String_Node_Str");
    e.printStackTrace();
    if (isKnownMySQLIssue(e.getCause())) {
      warning("String_Node_Str");
    }
 else {
      Assert.assertTrue(e.getCause() instanceof javax.persistence.OptimisticLockException);
    }
  }
}
Program: 68467
Project: 68467
Buggy source:
protected void buildConfigs(){
  this.addConfig(NO_SERVER_ID,"String_Node_Str");
  this.addConfig(OC4J_11_1_1_ID,"String_Node_Str");
  this.addConfig(OC4J_10_1_3_ID,"String_Node_Str");
  this.addConfig(WEBLOGIC_9_ID,"String_Node_Str");
  this.addConfig(WEBLOGIC_10_ID,"String_Node_Str");
  this.addConfig(WEBSPHERE_6_1_ID,"String_Node_Str");
  this.addConfig(JBOSS_ID,"String_Node_Str");
  this.addConfig(SUNAS_ID,"String_Node_Str");
  this.addConfig(CUSTOM_SERVER_ID,"String_Node_Str");
}

Fixed version (ground truth):
protected void buildConfigs(){
  this.addConfig(NO_SERVER_ID,"String_Node_Str");
  this.addConfig(OC4J__ID,"String_Node_Str");
  this.addConfig(OC4J_11_1_1_ID,"String_Node_Str");
  this.addConfig(OC4J_10_1_3_ID,"String_Node_Str");
  this.addConfig(WEBLOGIC_9_ID,"String_Node_Str");
  this.addConfig(WEBLOGIC_10_ID,"String_Node_Str");
  this.addConfig(WEBSPHERE_6_1_ID,"String_Node_Str");
  this.addConfig(JBOSS_ID,"String_Node_Str");
  this.addConfig(SUNAS_ID,"String_Node_Str");
  this.addConfig(CUSTOM_SERVER_ID,"String_Node_Str");
}
Program: 68468
Project: 68468
Buggy source:
protected void buidPlatforms(){
  this.addPlatform(NO_SERVER_ID,"String_Node_Str");
  this.addPlatform(OC4J_11_1_1_ID,"String_Node_Str");
  this.addPlatform(OC4J_10_1_3_ID,"String_Node_Str");
  this.addPlatform(WEBLOGIC_9_ID,"String_Node_Str");
  this.addPlatform(WEBLOGIC_10_ID,"String_Node_Str");
  this.addPlatform(WEBSPHERE_6_1_ID,"String_Node_Str");
  this.addPlatform(JBOSS_ID,"String_Node_Str");
  this.addPlatform(SUNAS_ID,"String_Node_Str");
  this.addPlatform(CUSTOM_SERVER_ID,"String_Node_Str");
}

Fixed version (ground truth):
protected void buidPlatforms(){
  this.addPlatform(NO_SERVER_ID,"String_Node_Str");
  this.addPlatform(OC4J_11_1_1_ID,"String_Node_Str");
  this.addPlatform(OC4J_10_1_3_ID,"String_Node_Str");
  this.addPlatform(OC4J__ID,"String_Node_Str");
  this.addPlatform(WEBLOGIC_9_ID,"String_Node_Str");
  this.addPlatform(WEBLOGIC_10_ID,"String_Node_Str");
  this.addPlatform(WEBSPHERE_6_1_ID,"String_Node_Str");
  this.addPlatform(JBOSS_ID,"String_Node_Str");
  this.addPlatform(SUNAS_ID,"String_Node_Str");
  this.addPlatform(CUSTOM_SERVER_ID,"String_Node_Str");
}
Program: 68469
Project: 68469
Buggy source:
protected void addProblemsTo(List currentProblems){
  super.addProblemsTo(currentProblems);
  this.checkGetMethod(currentProblems);
  this.checkSetMethod(currentProblems);
  this.checkMethods(currentProblems);
  this.checkWriteLockField(currentProblems);
}

Fixed version (ground truth):
protected void addProblemsTo(List currentProblems){
  super.addProblemsTo(currentProblems);
  this.checkGetMethod(currentProblems);
  this.checkSetMethod(currentProblems);
  this.checkMethods(currentProblems);
  this.checkWriteLockField(currentProblems);
  this.checkMappableAttribute(currentProblems);
}
Program: 68470
Project: 68470
Buggy source:
private void addUnmappedMappingNodeFor(MWClassAttribute attribute){
  if (attribute.isMappable()) {
    this.unmappedMappingNodesHolder.addItem(this.buildUnmappedMappingNode(attribute));
  }
}

Fixed version (ground truth):
private void addUnmappedMappingNodeFor(MWClassAttribute attribute){
  this.unmappedMappingNodesHolder.addItem(this.buildUnmappedMappingNode(attribute));
}
Program: 68471
Project: 68471
Buggy source:
public UnmappedMappingNode(MWClassAttribute classAttribute,ApplicationContext context,SelectionActionsPolicy mappingNodeTypePolicy,MappingDescriptorNode parent){
  super(null,context,mappingNodeTypePolicy,parent);
  if (!classAttribute.isMappable()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.classAttribute=classAttribute;
}

Fixed version (ground truth):
public UnmappedMappingNode(MWClassAttribute classAttribute,ApplicationContext context,SelectionActionsPolicy mappingNodeTypePolicy,MappingDescriptorNode parent){
  super(null,context,mappingNodeTypePolicy,parent);
  this.classAttribute=classAttribute;
}
Program: 68472
Project: 68472
Buggy source:
private void setDefaultLoginPlatform(){
  DataSource ds=null;
  if (this.login.platformIsRdbms())   ds=buildDefaultRdbmsDataSource();
 else   if (this.login.platformIsEis())   ds=buildDefaultEisDataSource();
 else   throw new IllegalStateException();
  login.setPlatformClass(ds.getPlatformClassName());
}

Fixed version (ground truth):
private void setDefaultLoginPlatform(){
  DataSource ds=null;
  if (this.login.platformIsRdbms())   ds=buildDefaultRdbmsDataSource();
 else   if (this.login.platformIsEis())   ds=buildDefaultEisDataSource();
 else   if (this.login.platformIsXml())   ds=buildDefaultXmlDataSource();
 else   throw new IllegalStateException();
  login.setPlatformClass(ds.getPlatformClassName());
}
Program: 68473
Project: 68473
Buggy source:
public void initializeNamespaceMaps(){
  Stack records=new Stack();
  UnmarshalRecord next=owningRecord;
  while (next != null) {
    records.push(next);
    next=next.getParentRecord();
  }
  for (int i=0; i < records.size(); i++) {
    next=(UnmarshalRecord)records.pop();
    if (next.getNamespaceMap() != null) {
      java.util.Iterator prefixes=next.getNamespaceMap().keySet().iterator();
      while (prefixes.hasNext()) {
        String prefix=(String)prefixes.next();
        this.resolver.put(prefix,(String)next.getNamespaceMap().get(prefix));
      }
    }
  }
}

Fixed version (ground truth):
public void initializeNamespaceMaps(){
  Stack records=new Stack();
  UnmarshalRecord next=owningRecord;
  while (next != null) {
    records.push(next);
    next=next.getParentRecord();
  }
  for (int i=0; i < records.size(); i++) {
    next=(UnmarshalRecord)records.pop();
    if (next.getNamespaceMap() != null) {
      java.util.Iterator prefixes=next.getNamespaceMap().keySet().iterator();
      while (prefixes.hasNext()) {
        String prefix=(String)prefixes.next();
        Stack uriStack=(Stack)next.getNamespaceMap().get(prefix);
        if (uriStack.size() > 0) {
          this.resolver.put(prefix,(String)uriStack.peek());
        }
      }
    }
  }
}
Program: 68475
Project: 68475
Buggy source:
public void addAddressDescriptor(){
  XMLDescriptor descriptor=new XMLDescriptor();
  descriptor.setJavaClass(Address.class);
  descriptor.setDefaultRootElement("String_Node_Str");
  XMLDirectMapping street=new XMLDirectMapping();
  street.setAttributeName("String_Node_Str");
  street.setXPath("String_Node_Str");
  descriptor.addMapping(street);
  this.addDescriptor(descriptor);
}

Fixed version (ground truth):
public XMLDescriptor addAddressDescriptor(){
  XMLDescriptor descriptor=new XMLDescriptor();
  descriptor.setJavaClass(Address.class);
  descriptor.setDefaultRootElement("String_Node_Str");
  XMLDirectMapping street=new XMLDirectMapping();
  street.setAttributeName("String_Node_Str");
  street.setXPath("String_Node_Str");
  descriptor.addMapping(street);
  this.addDescriptor(descriptor);
  return descriptor;
}
Program: 68476
Project: 68476
Buggy source:
public void addEmployeeDescriptor(){
  XMLDescriptor descriptor=new XMLDescriptor();
  descriptor.setJavaClass(Employee.class);
  descriptor.setDefaultRootElement("String_Node_Str");
  XMLCompositeObjectMapping addr=new XMLCompositeObjectMapping();
  addr.setAttributeName("String_Node_Str");
  addr.setXPath("String_Node_Str");
  addr.setReferenceClass(Address.class);
  descriptor.addMapping(addr);
  XMLCompositeCollectionMapping phone=new XMLCompositeCollectionMapping();
  phone.setAttributeName("String_Node_Str");
  phone.setXPath("String_Node_Str");
  phone.setReferenceClass(PhoneNumber.class);
  phone.useCollectionClass(ArrayList.class);
  descriptor.addMapping(phone);
  XMLAnyObjectMapping object=new XMLAnyObjectMapping();
  object.setAttributeName("String_Node_Str");
  object.setXPath("String_Node_Str");
  descriptor.addMapping(object);
  XMLAnyCollectionMapping anyCollection=new XMLAnyCollectionMapping();
  anyCollection.setAttributeName("String_Node_Str");
  anyCollection.setXPath("String_Node_Str");
  anyCollection.useCollectionClass(ArrayList.class);
  descriptor.addMapping(anyCollection);
  this.addDescriptor(descriptor);
}

Fixed version (ground truth):
public XMLDescriptor addEmployeeDescriptor(){
  XMLDescriptor descriptor=new XMLDescriptor();
  descriptor.setJavaClass(Employee.class);
  descriptor.setDefaultRootElement("String_Node_Str");
  XMLCompositeObjectMapping addr=new XMLCompositeObjectMapping();
  addr.setAttributeName("String_Node_Str");
  addr.setXPath("String_Node_Str");
  addr.setReferenceClass(Address.class);
  descriptor.addMapping(addr);
  XMLCompositeCollectionMapping phone=new XMLCompositeCollectionMapping();
  phone.setAttributeName("String_Node_Str");
  phone.setXPath("String_Node_Str");
  phone.setReferenceClass(PhoneNumber.class);
  phone.useCollectionClass(ArrayList.class);
  descriptor.addMapping(phone);
  XMLAnyObjectMapping object=new XMLAnyObjectMapping();
  object.setAttributeName("String_Node_Str");
  object.setXPath("String_Node_Str");
  descriptor.addMapping(object);
  XMLAnyCollectionMapping anyCollection=new XMLAnyCollectionMapping();
  anyCollection.setAttributeName("String_Node_Str");
  anyCollection.setXPath("String_Node_Str");
  anyCollection.useCollectionClass(ArrayList.class);
  descriptor.addMapping(anyCollection);
  this.addDescriptor(descriptor);
  return descriptor;
}
Program: 68477
Project: 68477
Buggy source:
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTestSuite(RootWithCompositeObjectTestCases.class);
  suite.addTestSuite(RootWithCompositeCollectionTestCases.class);
  suite.addTestSuite(RootWithAnyObjectTestCases.class);
  suite.addTestSuite(RootWithAnyCollectionTestCases.class);
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTestSuite(RootWithCompositeObjectTestCases.class);
  suite.addTestSuite(RootWithCompositeCollectionTestCases.class);
  suite.addTestSuite(RootWithAnyObjectTestCases.class);
  suite.addTestSuite(RootWithAnyCollectionTestCases.class);
  suite.addTestSuite(PostBuildEventTestCases.class);
  return suite;
}
Program: 68479
Project: 68479
Buggy source:
protected IndexedAttributeList buildAttributeList(Element elem) throws SAXException {
  IndexedAttributeList attributes=new IndexedAttributeList();
  NamedNodeMap attrs=elem.getAttributes();
  for (int i=0; i < attrs.getLength(); i++) {
    Attr next=(Attr)attrs.item(i);
    String attrPrefix=next.getPrefix();
    if (attrPrefix != null && attrPrefix.equals(XMLConstants.XMLNS)) {
      getContentHandler().startPrefixMapping(next.getLocalName(),next.getValue());
      handleXMLNSPrefixedAttribute(elem,next);
    }
    attributes.addAttribute(next);
  }
  return attributes;
}

Fixed version (ground truth):
protected IndexedAttributeList buildAttributeList(Element elem) throws SAXException {
  IndexedAttributeList attributes=new IndexedAttributeList();
  NamedNodeMap attrs=elem.getAttributes();
  for (int i=0; i < attrs.getLength(); i++) {
    Attr next=(Attr)attrs.item(i);
    String attrPrefix=next.getPrefix();
    if (attrPrefix != null && attrPrefix.equals(XMLConstants.XMLNS)) {
      getContentHandler().startPrefixMapping(next.getLocalName(),next.getValue());
      handleXMLNSPrefixedAttribute(elem,next);
    }
 else     if (attrPrefix == null) {
      String name=next.getLocalName();
      if (name == null) {
        name=next.getNodeName();
      }
      if (name != null && name.equals("String_Node_Str")) {
        getContentHandler().startPrefixMapping("String_Node_Str",next.getValue());
      }
    }
    attributes.addAttribute(next);
  }
  return attributes;
}
Program: 68480
Project: 68480
Buggy source:
protected void endPrefixMappings(Element elem) throws SAXException {
  NamedNodeMap attrs=elem.getAttributes();
  for (int i=0; i < attrs.getLength(); i++) {
    Attr next=(Attr)attrs.item(i);
    String attrPrefix=next.getPrefix();
    if (attrPrefix != null && attrPrefix.equals(XMLConstants.XMLNS)) {
      getContentHandler().endPrefixMapping(next.getLocalName());
    }
  }
}

Fixed version (ground truth):
protected void endPrefixMappings(Element elem) throws SAXException {
  NamedNodeMap attrs=elem.getAttributes();
  for (int i=0; i < attrs.getLength(); i++) {
    Attr next=(Attr)attrs.item(i);
    String attrPrefix=next.getPrefix();
    if (attrPrefix != null && attrPrefix.equals(XMLConstants.XMLNS)) {
      getContentHandler().endPrefixMapping(next.getLocalName());
    }
 else     if (attrPrefix == null) {
      String name=next.getLocalName();
      if (name == null) {
        name=next.getNodeName();
      }
      if (name != null) {
        getContentHandler().endPrefixMapping("String_Node_Str");
      }
    }
  }
}
Program: 68481
Project: 68481
Buggy source:
public void endPrefixMapping(String prefix) throws SAXException {
  if (null == namespaceMap) {
    return;
  }
  if (uriToPrefixMap != null) {
    String uri=(String)namespaceMap.get(prefix);
    uriToPrefixMap.remove(uri);
  }
  namespaceMap.remove(prefix);
}

Fixed version (ground truth):
public void endPrefixMapping(String prefix) throws SAXException {
  if (null == namespaceMap) {
    return;
  }
  Stack uriStack=(Stack)namespaceMap.get(prefix);
  String uri=null;
  if (uriStack.size() > 0) {
    uri=(String)uriStack.pop();
  }
  if (uri != null && uriToPrefixMap != null) {
    Stack prefixStack=(Stack)uriToPrefixMap.get(uri);
    if (prefixStack != null && prefixStack.size() > 0) {
      prefixStack.pop();
    }
  }
}
Program: 68483
Project: 68483
Buggy source:
public void startPrefixMapping(String prefix,String uri) throws SAXException {
  if (null == namespaceMap) {
    namespaceMap=new HashMap();
  }
  namespaceMap.put(prefix,uri);
  if (uriToPrefixMap == null) {
    uriToPrefixMap=new HashMap();
  }
  uriToPrefixMap.put(uri,prefix);
}

Fixed version (ground truth):
public void startPrefixMapping(String prefix,String uri) throws SAXException {
  if (null == namespaceMap) {
    namespaceMap=new HashMap();
  }
  if (uriToPrefixMap == null) {
    uriToPrefixMap=new HashMap();
  }
  Stack uriStack=(Stack)namespaceMap.get(prefix);
  if (uriStack == null) {
    uriStack=new Stack();
    namespaceMap.put(prefix,uriStack);
  }
  uriStack.push(uri);
  Stack prefixStack=(Stack)uriToPrefixMap.get(uri);
  if (prefixStack == null) {
    prefixStack=new Stack();
    uriToPrefixMap.put(uri,prefixStack);
  }
  prefixStack.push(prefix);
}
Program: 68484
Project: 68484
Buggy source:
public void endPrefixMapping(String prefix) throws SAXException {
  this.unmappedContentHandler.endPrefixMapping(prefix);
}

Fixed version (ground truth):
public void endPrefixMapping(String prefix) throws SAXException {
  if (getParentRecord() != null) {
    getParentRecord().endPrefixMapping(prefix);
  }
  this.unmappedContentHandler.endPrefixMapping(prefix);
}
Program: 68485
Project: 68485
Buggy source:
public void endPrefixMapping(String prefix) throws SAXException {
  if (null == namespaceMap) {
    return;
  }
  if (uriToPrefixMap != null) {
    String uri=(String)namespaceMap.get(prefix);
    uriToPrefixMap.remove(uri);
  }
  namespaceMap.remove(prefix);
}

Fixed version (ground truth):
public void endPrefixMapping(String prefix) throws SAXException {
  if (null == namespaceMap) {
    return;
  }
  Stack uriStack=(Stack)namespaceMap.get(prefix);
  String uri=null;
  if (uriStack != null && uriStack.size() > 0) {
    uri=(String)uriStack.pop();
  }
  if (uri != null && uriToPrefixMap != null) {
    Stack prefixStack=(Stack)uriToPrefixMap.get(uri);
    if (prefixStack != null && prefixStack.size() > 0) {
      prefixStack.pop();
    }
  }
}
Program: 68486
Project: 68486
Buggy source:
public String resolveNamespacePrefix(String prefix){
  String namespaceURI=null;
  if (null != namespaceMap) {
    namespaceURI=(String)namespaceMap.get(prefix);
  }
  if (null == namespaceURI) {
    if (null != getParentRecord()) {
      namespaceURI=getParentRecord().resolveNamespacePrefix(prefix);
    }
  }
  return namespaceURI;
}

Fixed version (ground truth):
public String resolveNamespacePrefix(String prefix){
  String namespaceURI=null;
  if (prefix == null) {
    prefix="String_Node_Str";
  }
  if (null != namespaceMap) {
    Stack uriStack=(Stack)namespaceMap.get(prefix);
    if (uriStack != null && uriStack.size() > 0) {
      namespaceURI=(String)uriStack.peek();
    }
  }
  if (null == namespaceURI) {
    if (null != getParentRecord()) {
      namespaceURI=getParentRecord().resolveNamespacePrefix(prefix);
    }
  }
  return namespaceURI;
}
Program: 68487
Project: 68487
Buggy source:
public String resolveNamespaceUri(String uri){
  String prefix=null;
  if (null != uriToPrefixMap) {
    prefix=(String)uriToPrefixMap.get(uri);
  }
  if (null == prefix) {
    if (null != getParentRecord()) {
      prefix=getParentRecord().resolveNamespaceUri(uri);
    }
  }
  return prefix;
}

Fixed version (ground truth):
public String resolveNamespaceUri(String uri){
  String prefix=null;
  if (null != uriToPrefixMap) {
    Stack prefixStack=(Stack)uriToPrefixMap.get(uri);
    if (prefixStack != null && prefixStack.size() > 0) {
      prefix=(String)prefixStack.peek();
    }
  }
  if (null == prefix) {
    if (null != getParentRecord()) {
      prefix=getParentRecord().resolveNamespaceUri(uri);
    }
  }
  return prefix;
}
Program: 68488
Project: 68488
Buggy source:
public void startPrefixMapping(String prefix,String uri) throws SAXException {
  if (null == namespaceMap) {
    namespaceMap=new HashMap();
  }
  if (uriToPrefixMap == null) {
    uriToPrefixMap=new HashMap();
  }
  namespaceMap.put(prefix,uri);
  uriToPrefixMap.put(uri,prefix);
}

Fixed version (ground truth):
public void startPrefixMapping(String prefix,String uri) throws SAXException {
  if (null == namespaceMap) {
    namespaceMap=new HashMap();
  }
  if (uriToPrefixMap == null) {
    uriToPrefixMap=new HashMap();
  }
  Stack uriStack=(Stack)namespaceMap.get(prefix);
  if (uriStack == null) {
    uriStack=new Stack();
    namespaceMap.put(prefix,uriStack);
  }
  uriStack.push(uri);
  Stack prefixStack=(Stack)uriToPrefixMap.get(uri);
  if (prefixStack == null) {
    prefixStack=new Stack();
    uriToPrefixMap.put(uri,prefixStack);
  }
  prefixStack.push(prefix);
}
Program: 68489
Project: 68489
Buggy source:
protected void handleAttributes(Attributes atts){
  for (int i=0; i < atts.getLength(); i++) {
    if ((atts.getQName(i) != null && atts.getQName(i).startsWith(XMLConstants.XMLNS + "String_Node_Str"))) {
      continue;
    }
    attribute(atts.getURI(i),atts.getLocalName(i),atts.getQName(i),atts.getValue(i));
  }
}

Fixed version (ground truth):
protected void handleAttributes(Attributes atts){
  for (int i=0; i < atts.getLength(); i++) {
    if ((atts.getQName(i) != null && (atts.getQName(i).startsWith(XMLConstants.XMLNS + "String_Node_Str") || atts.getQName(i).equals(XMLConstants.XMLNS)))) {
      continue;
    }
    attribute(atts.getURI(i),atts.getLocalName(i),atts.getQName(i),atts.getValue(i));
  }
}
Program: 68490
Project: 68490
Buggy source:
protected void writePrefixMappings(){
  try {
    if (!prefixMappings.isEmpty()) {
      for (java.util.Iterator<String> keys=prefixMappings.keySet().iterator(); keys.hasNext(); ) {
        String prefix=keys.next();
        getWriter().write(' ');
        getWriter().write(XMLConstants.XMLNS);
        getWriter().write("String_Node_Str");
        getWriter().write(prefix);
        getWriter().write('=');
        getWriter().write('"');
        getWriter().write(prefixMappings.get(prefix));
        getWriter().write('"');
      }
      prefixMappings.clear();
    }
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
protected void writePrefixMappings(){
  try {
    if (!prefixMappings.isEmpty()) {
      for (java.util.Iterator<String> keys=prefixMappings.keySet().iterator(); keys.hasNext(); ) {
        String prefix=keys.next();
        getWriter().write(' ');
        getWriter().write(XMLConstants.XMLNS);
        if (!prefix.equals("String_Node_Str")) {
          getWriter().write("String_Node_Str");
          getWriter().write(prefix);
        }
        getWriter().write('=');
        getWriter().write('"');
        getWriter().write(prefixMappings.get(prefix));
        getWriter().write('"');
      }
      prefixMappings.clear();
    }
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 68491
Project: 68491
Buggy source:
public String resolveNamespacePrefix(Node contextNode,String namespacePrefix) throws XMLPlatformException {
  if (null == namespacePrefix) {
    if (null == contextNode.getPrefix()) {
      return contextNode.getNamespaceURI();
    }
  }
 else   if (namespacePrefix.equals(contextNode.getPrefix())) {
    return contextNode.getNamespaceURI();
  }
  if (contextNode.getNodeType() == Node.ELEMENT_NODE) {
    Element contextElement=(Element)contextNode;
    Attr namespaceDeclaration=contextElement.getAttributeNode("String_Node_Str" + namespacePrefix);
    if (null != namespaceDeclaration) {
      return namespaceDeclaration.getValue();
    }
  }
  Node parentNode=contextNode.getParentNode();
  if (parentNode != null && parentNode.getNodeType() == Node.ELEMENT_NODE) {
    return resolveNamespacePrefix(parentNode,namespacePrefix);
  }
  return null;
}

Fixed version (ground truth):
public String resolveNamespacePrefix(Node contextNode,String namespacePrefix) throws XMLPlatformException {
  if (null == namespacePrefix) {
    if (null == contextNode.getPrefix()) {
      return contextNode.getNamespaceURI();
    }
  }
 else   if (namespacePrefix.equals(contextNode.getPrefix())) {
    return contextNode.getNamespaceURI();
  }
  if (contextNode.getNodeType() == Node.ELEMENT_NODE) {
    Element contextElement=(Element)contextNode;
    Attr namespaceDeclaration=null;
    if (namespacePrefix != null) {
      namespaceDeclaration=contextElement.getAttributeNode("String_Node_Str" + namespacePrefix);
    }
 else {
      namespaceDeclaration=contextElement.getAttributeNode("String_Node_Str");
    }
    if (null != namespaceDeclaration) {
      return namespaceDeclaration.getValue();
    }
  }
  Node parentNode=contextNode.getParentNode();
  if (parentNode != null && parentNode.getNodeType() == Node.ELEMENT_NODE) {
    return resolveNamespacePrefix(parentNode,namespacePrefix);
  }
  return null;
}
Program: 68492
Project: 68492
Buggy source:
/** 
 * Returns true if sessions.xml version is previous to 10g.
 */
protected final boolean configVersionIsPre10g(){
  String versionString=this.getConfigFileVersion();
  int version=0;
  for (int i=0; i < versionString.length(); i++) {
    char c=versionString.charAt(i);
    if (Character.isDigit(c))     version*=10;
 else     break;
    version+=Character.digit(c,10);
  }
  return (version < 10);
}

Fixed version (ground truth):
/** 
 * Returns true if sessions.xml version is previous to 10g.   For EL added the version > 3 clause since the version number has reset.   When EL Workbench surpasses 3.0 this will need to be revisited, but perhaps we  won't be supporting opening older TL sessions files and this method can be removed.
 */
protected final boolean configVersionIsPre10g(){
  String versionString=this.getConfigFileVersion();
  int version=0;
  for (int i=0; i < versionString.length(); i++) {
    char c=versionString.charAt(i);
    if (Character.isDigit(c))     version*=10;
 else     break;
    version+=Character.digit(c,10);
  }
  return (version > 3 && version < 10);
}
Program: 68494
Project: 68494
Buggy source:
public void setXPath(String xpathString){
  xpath=xpathString;
  if ((xpath.indexOf("String_Node_Str") != -1) && (xpath.indexOf("String_Node_Str") == -1)) {
    setShouldExecuteSelectNodes(true);
    return;
  }
  if (xpath.indexOf("String_Node_Str") != -1) {
    setShouldExecuteSelectNodes(true);
    return;
  }
  shortName=xpathString;
  int attrindex=xpathString.indexOf('@');
  if (attrindex == 0) {
    hasAttribute=true;
    shortName=xpathString.substring(attrindex + 1);
    indexValue=hasIndex(xpathString);
    setupNamespaceInformation(shortName);
    return;
  }
  if (xpathString.startsWith("String_Node_Str")) {
    setShouldExecuteSelectNodes(true);
    shortName=xpathString;
    indexValue=hasIndex(xpathString);
    setupNamespaceInformation(shortName);
    return;
  }
  if (xpathString.equals("String_Node_Str")) {
    nameIsText=true;
    shortName=xpathString;
    return;
  }
  if (xpathString.equals("String_Node_Str")) {
    isSelfFragment=true;
    shortName=xpathString;
    return;
  }
  indexValue=hasIndex(xpathString);
  setupNamespaceInformation(shortName);
}

Fixed version (ground truth):
public void setXPath(String xpathString){
  xpath=xpathString;
  if ((xpath.indexOf("String_Node_Str") != -1) && (xpath.indexOf("String_Node_Str") == -1)) {
    setShouldExecuteSelectNodes(true);
    return;
  }
  if (xpath.indexOf("String_Node_Str") != -1) {
    setShouldExecuteSelectNodes(true);
    return;
  }
  shortName=xpathString;
  int attrindex=xpathString.indexOf('@');
  if (attrindex == 0) {
    hasAttribute=true;
    shortName=xpathString.substring(attrindex + 1);
    indexValue=hasIndex(xpathString);
    setupNamespaceInformation(shortName);
    return;
  }
  if (xpathString.startsWith("String_Node_Str")) {
    setShouldExecuteSelectNodes(true);
    shortName=xpathString;
    indexValue=hasIndex(xpathString);
    setupNamespaceInformation(shortName);
    return;
  }
  if (xpathString.equals("String_Node_Str")) {
    nameIsText=true;
    shortName=xpathString;
    return;
  }
 else {
    nameIsText=false;
  }
  if (xpathString.equals("String_Node_Str")) {
    isSelfFragment=true;
    shortName=xpathString;
    return;
  }
  indexValue=hasIndex(xpathString);
  setupNamespaceInformation(shortName);
}
Program: 68495
Project: 68495
Buggy source:
public Object getNonAttributeChild(int index,XPathNode xPathNode){
  Setting setting=settings.get(index);
  if (null == setting.getName()) {
    return xPathNode.getNonAttributeChildrenMap().get(null);
  }
 else {
    indexFragment.setXPath(setting.getName());
    indexFragment.setNamespaceURI(setting.getNamespaceURI());
    return xPathNode.getNonAttributeChildrenMap().get(indexFragment);
  }
}

Fixed version (ground truth):
public Object getNonAttributeChild(int index,XPathNode xPathNode){
  Setting setting=settings.get(index);
  if (null == setting.getName()) {
    return xPathNode.getNonAttributeChildrenMap().get(null);
  }
 else {
    indexFragment.setLocalName(null);
    indexFragment.setXPath(setting.getName());
    indexFragment.setNamespaceURI(setting.getNamespaceURI());
    return xPathNode.getNonAttributeChildrenMap().get(indexFragment);
  }
}
Program: 68496
Project: 68496
Buggy source:
public void characters(UnmarshalRecord unmarshalRecord){
  if (!TEXT_XPATH.equals(currentSetting.getName())) {
    Setting parentSetting=currentSetting;
    currentSetting=new Setting(null,TEXT_XPATH);
    if (null != parentSetting) {
      parentSetting.addChild(currentSetting);
    }
  }
}

Fixed version (ground truth):
public void characters(UnmarshalRecord unmarshalRecord){
  if (null == currentSetting || null == currentSetting.getName()) {
    currentSetting=new Setting(null,TEXT_XPATH);
    ((SequencedObject)unmarshalRecord.getCurrentObject()).getSettings().add(currentSetting);
  }
 else   if (!TEXT_XPATH.equals(currentSetting.getName())) {
    Setting parentSetting=currentSetting;
    currentSetting=new Setting(null,TEXT_XPATH);
    if (null != parentSetting) {
      parentSetting.addChild(currentSetting);
    }
  }
}
Program: 68497
Project: 68497
Buggy source:
public void endElement(UnmarshalRecord unmarshalRecord){
  if (null == currentSetting) {
    return;
  }
  if (TEXT_XPATH.equals(currentSetting.getName())) {
    currentSetting=currentSetting.getParent().getParent();
  }
 else {
    currentSetting=currentSetting.getParent();
  }
}

Fixed version (ground truth):
public void endElement(UnmarshalRecord unmarshalRecord){
  if (null == currentSetting) {
    return;
  }
  if (TEXT_XPATH.equals(currentSetting.getName())) {
    if (null == currentSetting.getParent()) {
      currentSetting=null;
    }
 else {
      currentSetting=currentSetting.getParent().getParent();
    }
  }
 else {
    currentSetting=currentSetting.getParent();
  }
}
Program: 68498
Project: 68498
Buggy source:
public void startElement(UnmarshalRecord unmarshalRecord){
  Setting parentSetting=currentSetting;
  XPathFragment xPathFragment=unmarshalRecord.getXPathNode().getXPathFragment();
  if (null != xPathFragment) {
    currentSetting=new Setting(xPathFragment.getNamespaceURI(),xPathFragment.getLocalName());
  }
 else {
    currentSetting=new Setting();
  }
  int levelIndex=unmarshalRecord.getLevelIndex();
  if (0 == levelIndex) {
  }
 else   if (1 == levelIndex) {
    ((SequencedObject)unmarshalRecord.getCurrentObject()).getSettings().add(currentSetting);
  }
 else {
    parentSetting.addChild(currentSetting);
  }
}

Fixed version (ground truth):
public void startElement(UnmarshalRecord unmarshalRecord){
  Setting parentSetting;
  if (null == currentSetting) {
    parentSetting=null;
  }
 else   if (TEXT_XPATH.equals(currentSetting.getName())) {
    parentSetting=null;
  }
 else {
    parentSetting=currentSetting;
  }
  XPathFragment xPathFragment=unmarshalRecord.getXPathNode().getXPathFragment();
  if (null != xPathFragment) {
    currentSetting=new Setting(xPathFragment.getNamespaceURI(),xPathFragment.getLocalName());
  }
 else {
    currentSetting=new Setting();
  }
  int levelIndex=unmarshalRecord.getLevelIndex();
  if (0 == levelIndex) {
  }
 else   if (1 == levelIndex) {
    ((SequencedObject)unmarshalRecord.getCurrentObject()).getSettings().add(currentSetting);
  }
 else {
    parentSetting.addChild(currentSetting);
  }
}
Program: 68503
Project: 68503
Buggy source:
/** 
 * INTERNAL: Update the row, object and change set with the version value. This handles the version being mapped in nested aggregates, writable or read-only.
 */
protected void updateWriteLockValueForWrite(ObjectLevelModifyQuery query,Object lockValue){
  query.getModifyRow().put(this.writeLockField,lockValue);
  AbstractSession session=query.getSession();
  Object object=query.getObject();
  ObjectChangeSet objectChangeSet=query.getObjectChangeSet();
  if (objectChangeSet == null) {
    if (session.isUnitOfWork() && (((UnitOfWorkImpl)session).getUnitOfWorkChangeSet() != null)) {
      objectChangeSet=(ObjectChangeSet)((UnitOfWorkImpl)session).getUnitOfWorkChangeSet().getObjectChangeSetForClone(object);
    }
  }
  if (this.lockMapping != null) {
    this.lockMapping.setAttributeValueInObject(object,this.lockMapping.getAttributeValue(lockValue,session));
    if (objectChangeSet != null) {
      objectChangeSet.setWriteLockValue(lockValue);
      objectChangeSet.updateChangeRecordForAttribute(this.lockMapping,lockValue,session);
    }
  }
 else {
    ObjectBuilder objectBuilder=this.descriptor.getObjectBuilder();
    AbstractRecord record=objectBuilder.createRecord(1);
    record.put(this.writeLockField,lockValue);
    objectBuilder.assignReturnRow(object,session,record);
    if (objectChangeSet != null) {
      objectChangeSet.setWriteLockValue(lockValue);
      query.getQueryMechanism().updateChangeSet(this.descriptor,objectChangeSet,record,object);
    }
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Update the row, object and change set with the version value. This handles the version being mapped in nested aggregates, writable or read-only.
 */
protected void updateWriteLockValueForWrite(ObjectLevelModifyQuery query,Object lockValue){
  query.getModifyRow().put(this.writeLockField,lockValue);
  AbstractSession session=query.getSession();
  Object object=query.getObject();
  ObjectChangeSet objectChangeSet=query.getObjectChangeSet();
  if (objectChangeSet == null) {
    if (session.isUnitOfWork() && (((UnitOfWorkImpl)session).getUnitOfWorkChangeSet() != null)) {
      objectChangeSet=(ObjectChangeSet)((UnitOfWorkImpl)session).getUnitOfWorkChangeSet().getObjectChangeSetForClone(object);
    }
  }
  if (this.lockMapping != null) {
    this.lockMapping.setAttributeValueInObject(object,this.lockMapping.getAttributeValue(lockValue,session));
    if (objectChangeSet != null) {
      objectChangeSet.setWriteLockValue(lockValue);
      objectChangeSet.updateChangeRecordForAttribute(this.lockMapping,lockValue,session);
    }
  }
 else {
    ObjectBuilder objectBuilder=this.descriptor.getObjectBuilder();
    AbstractRecord record=objectBuilder.createRecord(1,session);
    record.put(this.writeLockField,lockValue);
    objectBuilder.assignReturnRow(object,session,record);
    if (objectChangeSet != null) {
      objectChangeSet.setWriteLockValue(lockValue);
      query.getQueryMechanism().updateChangeSet(this.descriptor,objectChangeSet,record,object);
    }
  }
}
Program: 68504
Project: 68504
Buggy source:
/** 
 * Set the JCA adapter record.
 */
public void setRecord(Record record){
  this.record=record;
  this.recordName=record.getRecordName();
  this.recordShortDescription=record.getRecordShortDescription();
}

Fixed version (ground truth):
/** 
 * Set the JCA adapter record.
 */
public void setRecord(Record record){
  this.record=record;
  this.recordName=record.getRecordName();
  this.recordShortDescription=record.getRecordShortDescription();
  if (record instanceof XMLRecord) {
    this.session=((XMLRecord)record).getSession();
  }
}
Program: 68506
Project: 68506
Buggy source:
/** 
 * INTERNAL: Build the nested row.
 */
public AbstractRecord buildNestedRowFromFieldValue(Object fieldValue){
  if (!getDataFormat().equals(XML)) {
    if (!(fieldValue instanceof List)) {
      return new DatabaseRecord(1);
    }
    List nestedRows=((List)fieldValue);
    if (nestedRows.isEmpty()) {
      return new DatabaseRecord(1);
    }
 else {
      if (!(nestedRows.get(0) instanceof AbstractRecord)) {
        return new DatabaseRecord(1);
      }
      return (AbstractRecord)nestedRows.get(0);
    }
  }
  if (fieldValue instanceof XMLRecord) {
    return (XMLRecord)fieldValue;
  }
  if (!(fieldValue instanceof Vector)) {
    return getObjectBuilder().createRecord();
  }
  Vector nestedRows=(Vector)fieldValue;
  if (nestedRows.isEmpty()) {
    return getObjectBuilder().createRecord();
  }
 else {
    if (!(nestedRows.firstElement() instanceof XMLRecord)) {
      return getObjectBuilder().createRecord();
    }
    return (XMLRecord)nestedRows.firstElement();
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Build the nested row.
 */
public AbstractRecord buildNestedRowFromFieldValue(Object fieldValue){
  if (!getDataFormat().equals(XML)) {
    if (!(fieldValue instanceof List)) {
      return new DatabaseRecord(1);
    }
    List nestedRows=((List)fieldValue);
    if (nestedRows.isEmpty()) {
      return new DatabaseRecord(1);
    }
 else {
      if (!(nestedRows.get(0) instanceof AbstractRecord)) {
        return new DatabaseRecord(1);
      }
      return (AbstractRecord)nestedRows.get(0);
    }
  }
  if (fieldValue instanceof XMLRecord) {
    return (XMLRecord)fieldValue;
  }
  if (!(fieldValue instanceof Vector)) {
    return getObjectBuilder().createRecord(null);
  }
  Vector nestedRows=(Vector)fieldValue;
  if (nestedRows.isEmpty()) {
    return getObjectBuilder().createRecord(null);
  }
 else {
    if (!(nestedRows.firstElement() instanceof XMLRecord)) {
      return getObjectBuilder().createRecord(null);
    }
    return (XMLRecord)nestedRows.firstElement();
  }
}
Program: 68507
Project: 68507
Buggy source:
/** 
 * Create a DOM input record for this interaction. Convet the database row or arguments into an XML DOM tree.
 */
public Record createInputRecord(EISAccessor accessor){
  Record record=accessor.getEISPlatform().createDOMRecord(getInputRecordName(),accessor);
  Element dom=createInputDOM(accessor);
  accessor.getEISPlatform().setDOMInRecord(dom,record,this,accessor);
  return record;
}

Fixed version (ground truth):
/** 
 * Create a DOM input record for this interaction. Convert the database row or arguments into an XML DOM tree.
 */
public Record createInputRecord(EISAccessor accessor){
  Record record=accessor.getEISPlatform().createDOMRecord(getInputRecordName(),accessor);
  Element dom=createInputDOM(accessor);
  accessor.getEISPlatform().setDOMInRecord(dom,record,this,accessor);
  if (record instanceof XMLRecord) {
    ((XMLRecord)record).setSession(this.getQuery().getSession());
  }
  return record;
}
Program: 68508
Project: 68508
Buggy source:
/** 
 * INTERNAL: Use the createRecord method on ObjectBuilder in case the root element is namespace qualified
 */
protected XMLRecord createXMLRecord(String rootName){
  if (getQuery().getDescriptor() instanceof EISDescriptor && (getQuery().getDescriptor() != null)) {
    XMLRecord record=(XMLRecord)((XMLObjectBuilder)this.getQuery().getDescriptor().getObjectBuilder()).createRecord(getInputRootElementName());
    record.setSession(getQuery().getSession());
    return record;
  }
 else {
    return new org.eclipse.persistence.oxm.record.DOMRecord(getInputRootElementName());
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Use the createRecord method on ObjectBuilder in case the root element is namespace qualified
 */
protected XMLRecord createXMLRecord(String rootName){
  XMLRecord xmlRec;
  if (getQuery().getDescriptor() != null && getQuery().getDescriptor() instanceof EISDescriptor) {
    xmlRec=(XMLRecord)((XMLObjectBuilder)this.getQuery().getDescriptor().getObjectBuilder()).createRecord(getInputRootElementName(),getQuery().getSession());
  }
 else {
    xmlRec=new org.eclipse.persistence.oxm.record.DOMRecord(getInputRootElementName());
    xmlRec.setSession(getQuery().getSession());
  }
  return xmlRec;
}