nus-yam/ex-repair huggingface dataset:
Program: 68813
Project: 68813
Buggy source:
private void endElementProcessText(UnmarshalRecord unmarshalRecord,XPathFragment xPathFragment){
  Object value=unmarshalRecord.getStringBuffer().toString().trim();
  unmarshalRecord.resetStringBuffer();
  if (!EMPTY_STRING.equals(value)) {
    if (!xmlAnyObjectMapping.usesXMLRoot()) {
      unmarshalRecord.setAttributeValue(value,xmlAnyObjectMapping);
    }
 else {
      XMLRoot xmlRoot=new XMLRoot();
      xmlRoot.setNamespaceURI(xPathFragment.getNamespaceURI());
      xmlRoot.setLocalName(xPathFragment.getLocalName());
      xmlRoot.setObject(value);
      unmarshalRecord.setAttributeValue(xmlRoot,xmlAnyObjectMapping);
    }
  }
}

Fixed version (ground truth):
private void endElementProcessText(UnmarshalRecord unmarshalRecord,XPathFragment xPathFragment){
  Object value=unmarshalRecord.getStringBuffer().toString().trim();
  unmarshalRecord.resetStringBuffer();
  if (!EMPTY_STRING.equals(value)) {
    QName qname=unmarshalRecord.getTypeQName();
    if (qname != null) {
      XMLConversionManager xmlConversionManager=(XMLConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager();
      Class theClass=(Class)xmlConversionManager.getDefaultXMLTypes().get(qname);
      if (theClass != null) {
        value=xmlConversionManager.convertObject(value,theClass,qname);
      }
    }
    if (!xmlAnyObjectMapping.usesXMLRoot()) {
      unmarshalRecord.setAttributeValue(value,xmlAnyObjectMapping);
    }
 else {
      XMLRoot xmlRoot=new XMLRoot();
      xmlRoot.setNamespaceURI(xPathFragment.getNamespaceURI());
      xmlRoot.setSchemaType(qname);
      xmlRoot.setLocalName(xPathFragment.getLocalName());
      xmlRoot.setObject(value);
      unmarshalRecord.setAttributeValue(xmlRoot,xmlAnyObjectMapping);
    }
  }
}
Program: 68815
Project: 68815
Buggy source:
private DatabaseMapping buildXMLObjectReferenceMapping(String mappingUri){
  XMLObjectReferenceMapping mapping=new XMLObjectReferenceMapping();
  mapping.setAttributeName(getName());
  if (getType().equals(SDOConstants.SDO_DATAOBJECT)) {
    ((SDOType)getType()).setImplClassName(SDOConstants.SDO_DATA_OBJECT_IMPL_CLASS_NAME);
  }
  mapping.setReferenceClassName(((SDOType)getType()).getImplClassName());
  mapping.setReferenceClass(((SDOType)getType()).getImplClass());
  String sourcexpath=getQualifiedXPath(getContainingType().getURI(),true);
  SDOProperty targetIDProp=getIDProp(getType());
  if (targetIDProp != null) {
    String targetxpath=targetIDProp.getQualifiedXPath(getType().getURI(),true);
    ((SDOType)getType()).getXmlDescriptor().addPrimaryKeyFieldName(targetxpath);
    mapping.addSourceToTargetKeyFieldAssociation(sourcexpath,targetxpath);
  }
 else {
    throw SDOException.noTargetIdSpecified(getType().getURI(),getType().getName());
  }
  return mapping;
}

Fixed version (ground truth):
private DatabaseMapping buildXMLObjectReferenceMapping(String mappingUri){
  XMLObjectReferenceMapping mapping=new XMLObjectReferenceMapping();
  mapping.setAttributeName(getName());
  if (getType().equals(SDOConstants.SDO_DATAOBJECT)) {
    ((SDOType)getType()).setImplClassName(SDOConstants.SDO_DATA_OBJECT_IMPL_CLASS_NAME);
  }
  mapping.setReferenceClassName(((SDOType)getType()).getImplClassName());
  mapping.setReferenceClass(((SDOType)getType()).getImplClass());
  String sourcexpath=getQualifiedXPath(getContainingType().getURI(),true);
  SDOProperty targetIDProp=getIDProp(getType());
  if (targetIDProp != null) {
    String targetxpath=targetIDProp.getQualifiedXPath(getType().getURI(),true);
    mapping.addSourceToTargetKeyFieldAssociation(sourcexpath,targetxpath);
  }
 else {
    throw SDOException.noTargetIdSpecified(getType().getURI(),getType().getName());
  }
  return mapping;
}
Program: 68816
Project: 68816
Buggy source:
private DatabaseMapping buildXMLCollectionReferenceMapping(String mappingUri){
  XMLCollectionReferenceMapping mapping=new XMLCollectionReferenceMapping();
  mapping.setAttributeName(getName());
  if (getType().equals(SDOConstants.SDO_DATAOBJECT)) {
    ((SDOType)getType()).setImplClassName(SDOConstants.SDO_DATA_OBJECT_IMPL_CLASS_NAME);
  }
  mapping.setReferenceClassName(((SDOType)getType()).getImplClassName());
  mapping.setReferenceClass(((SDOType)getType()).getImplClass());
  mapping.setUsesSingleNode(true);
  mapping.useCollectionClass(ArrayList.class);
  String sourcexpath=getQualifiedXPath(getContainingType().getURI(),true);
  SDOProperty targetIDProp=getIDProp(getType());
  if (targetIDProp != null) {
    String targetxpath=targetIDProp.getQualifiedXPath(getType().getURI(),true);
    ((SDOType)getType()).getXmlDescriptor().addPrimaryKeyFieldName(targetxpath);
    mapping.addSourceToTargetKeyFieldAssociation(sourcexpath,targetxpath);
  }
 else {
    throw SDOException.noTargetIdSpecified(getType().getURI(),getType().getName());
  }
  return mapping;
}

Fixed version (ground truth):
private DatabaseMapping buildXMLCollectionReferenceMapping(String mappingUri){
  XMLCollectionReferenceMapping mapping=new XMLCollectionReferenceMapping();
  mapping.setAttributeName(getName());
  if (getType().equals(SDOConstants.SDO_DATAOBJECT)) {
    ((SDOType)getType()).setImplClassName(SDOConstants.SDO_DATA_OBJECT_IMPL_CLASS_NAME);
  }
  mapping.setReferenceClassName(((SDOType)getType()).getImplClassName());
  mapping.setReferenceClass(((SDOType)getType()).getImplClass());
  mapping.setUsesSingleNode(true);
  mapping.useCollectionClass(ArrayList.class);
  String sourcexpath=getQualifiedXPath(getContainingType().getURI(),true);
  SDOProperty targetIDProp=getIDProp(getType());
  if (targetIDProp != null) {
    String targetxpath=targetIDProp.getQualifiedXPath(getType().getURI(),true);
    mapping.addSourceToTargetKeyFieldAssociation(sourcexpath,targetxpath);
  }
 else {
    throw SDOException.noTargetIdSpecified(getType().getURI(),getType().getName());
  }
  return mapping;
}
Program: 68820
Project: 68820
Buggy source:
public MarshalRecordContentHandler(MarshalRecord record,NamespaceResolver resolver){
  marshalRecord=record;
}

Fixed version (ground truth):
public MarshalRecordContentHandler(MarshalRecord record,NamespaceResolver resolver){
  marshalRecord=record;
  this.resolver=resolver;
}
Program: 68821
Project: 68821
Buggy source:
public void node(Node node,NamespaceResolver namespaceResolver){
  if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
    Attr attr=(Attr)node;
    String resolverPfx=null;
    if (namespaceResolver != null) {
      resolverPfx=namespaceResolver.resolveNamespaceURI(attr.getNamespaceURI());
    }
    if (resolverPfx != null) {
      attribute(attr.getNamespaceURI(),"String_Node_Str",resolverPfx + "String_Node_Str" + attr.getLocalName(),attr.getNodeValue());
    }
 else {
      attribute(attr.getNamespaceURI(),"String_Node_Str",attr.getName(),attr.getNodeValue());
      if (attr.getNamespaceURI() != null) {
        attribute(XMLConstants.XMLNS_URL,"String_Node_Str",XMLConstants.XMLNS + "String_Node_Str" + attr.getPrefix(),attr.getNamespaceURI());
      }
    }
  }
 else {
    Node newnode=document.importNode(node,true);
    try {
      getNode().appendChild(newnode);
    }
 catch (    Exception e) {
    }
  }
}

Fixed version (ground truth):
public void node(Node node,NamespaceResolver namespaceResolver){
  if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
    Attr attr=(Attr)node;
    String resolverPfx=null;
    if (namespaceResolver != null) {
      resolverPfx=namespaceResolver.resolveNamespaceURI(attr.getNamespaceURI());
    }
    if (resolverPfx != null) {
      attribute(attr.getNamespaceURI(),"String_Node_Str",resolverPfx + "String_Node_Str" + attr.getLocalName(),attr.getNodeValue());
    }
 else {
      attribute(attr.getNamespaceURI(),"String_Node_Str",attr.getName(),attr.getNodeValue());
      if (attr.getNamespaceURI() != null) {
        attribute(XMLConstants.XMLNS_URL,"String_Node_Str",XMLConstants.XMLNS + "String_Node_Str" + attr.getPrefix(),attr.getNamespaceURI());
      }
    }
  }
 else   if (node.getNodeType() == Node.TEXT_NODE) {
    characters(node.getNodeValue());
  }
 else {
    NodeRecordContentHandler mrcHdlr=new NodeRecordContentHandler(this,namespaceResolver);
    XMLFragmentReader xfRdr=new XMLFragmentReader(namespaceResolver);
    xfRdr.setContentHandler(mrcHdlr);
    try {
      xfRdr.parse(node);
    }
 catch (    SAXException sex) {
    }
  }
}
Program: 68823
Project: 68823
Buggy source:
public AbstractRecord buildRow(AbstractRecord record,Object object,org.eclipse.persistence.internal.sessions.AbstractSession session,XMLMarshaller marshaller){
  if (null == getRootXPathNode().getNonAttributeChildren()) {
    return record;
  }
  XPathNode xPathNode;
  NamespaceResolver namespaceResolver;
  int size=rootXPathNode.getNonAttributeChildren().size();
  for (int x=0; x < size; x++) {
    xPathNode=(XPathNode)rootXPathNode.getNonAttributeChildren().get(x);
    namespaceResolver=((XMLDescriptor)this.getDescriptor()).getNamespaceResolver();
    xPathNode.marshal((MarshalRecord)record,object,session,namespaceResolver,marshaller);
  }
  return record;
}

Fixed version (ground truth):
public AbstractRecord buildRow(AbstractRecord record,Object object,org.eclipse.persistence.internal.sessions.AbstractSession session,XMLMarshaller marshaller){
  if (rootXPathNode.getSelfChildren() != null) {
    XPathNode childNode;
    NamespaceResolver namespaceResolver;
    for (int x=0; x < rootXPathNode.getSelfChildren().size(); x++) {
      childNode=(XPathNode)rootXPathNode.getSelfChildren().get(x);
      namespaceResolver=((XMLDescriptor)this.getDescriptor()).getNamespaceResolver();
      childNode.marshalSelfAttributes((MarshalRecord)record,object,session,namespaceResolver,marshaller);
    }
  }
  if (null == getRootXPathNode().getNonAttributeChildren()) {
    return record;
  }
  XPathNode xPathNode;
  NamespaceResolver namespaceResolver;
  int size=rootXPathNode.getNonAttributeChildren().size();
  for (int x=0; x < size; x++) {
    xPathNode=(XPathNode)rootXPathNode.getNonAttributeChildren().get(x);
    namespaceResolver=((XMLDescriptor)this.getDescriptor()).getNamespaceResolver();
    xPathNode.marshal((MarshalRecord)record,object,session,namespaceResolver,marshaller);
  }
  return record;
}
Program: 68826
Project: 68826
Buggy source:
public void writeSingleValue(Object value,Object parent,XMLRecord record,AbstractSession session){
  Object attributeValue=value;
  if (getConverter() != null) {
    if (getConverter() instanceof XMLConverter) {
      attributeValue=((XMLConverter)getConverter()).convertObjectValueToDataValue(attributeValue,session,record.getMarshaller());
    }
 else {
      attributeValue=getConverter().convertObjectValueToDataValue(attributeValue,session);
    }
  }
  if (((XMLField)getField()).isSelfField()) {
    XMLObjectBuilder objectBuilder=(XMLObjectBuilder)this.getReferenceDescriptor().getObjectBuilder();
    objectBuilder.buildIntoNestedRow(record,attributeValue,session);
  }
 else {
    Object fieldValue=null;
    if (attributeValue != null) {
      fieldValue=buildCompositeRow(attributeValue,session,record);
    }
 else     if (getNullPolicy().compositeObjectMarshal(record,parent,(XMLField)getField())) {
      return;
    }
    record.put(this.getField(),fieldValue);
  }
}

Fixed version (ground truth):
public void writeSingleValue(Object value,Object parent,XMLRecord record,AbstractSession session){
  Object attributeValue=value;
  if (getConverter() != null) {
    if (getConverter() instanceof XMLConverter) {
      attributeValue=((XMLConverter)getConverter()).convertObjectValueToDataValue(attributeValue,session,record.getMarshaller());
    }
 else {
      attributeValue=getConverter().convertObjectValueToDataValue(attributeValue,session);
    }
  }
  if (((XMLField)getField()).isSelfField()) {
    XMLObjectBuilder objectBuilder=(XMLObjectBuilder)this.getReferenceDescriptor(attributeValue.getClass(),session).getObjectBuilder();
    objectBuilder.buildIntoNestedRow(record,attributeValue,session);
  }
 else {
    Object fieldValue=null;
    if (attributeValue != null) {
      fieldValue=buildCompositeRow(attributeValue,session,record);
    }
 else     if (getNullPolicy().compositeObjectMarshal(record,parent,(XMLField)getField())) {
      return;
    }
    record.put(this.getField(),fieldValue);
  }
}
Program: 68828
Project: 68828
Buggy source:
/** 
 * Return the proc syntax for this platform.
 */
public String buildProcedureCallString(StoredProcedureCall call,AbstractSession session){
  StringWriter writer=new StringWriter();
  writer.write(call.getCallHeader(this));
  writer.write(call.getProcedureName());
  if (requiresProcedureCallBrackets()) {
    writer.write("String_Node_Str");
  }
 else {
    writer.write("String_Node_Str");
  }
  int indexFirst=call.getFirstParameterIndexForCallString();
  for (int index=indexFirst; index < call.getParameters().size(); index++) {
    String name=(String)call.getProcedureArgumentNames().elementAt(index);
    Object parameter=call.getParameters().elementAt(index);
    Integer parameterType=(Integer)call.getParameterTypes().elementAt(index);
    if (name != null) {
      writer.write(getProcedureArgumentString());
      writer.write(name);
      writer.write(getProcedureArgumentSetter());
    }
    writer.write("String_Node_Str");
    if (call.isOutputParameterType(parameterType)) {
      if (requiresProcedureCallOuputToken()) {
        writer.write("String_Node_Str");
        writer.write(getOutputProcedureToken());
      }
    }
    if ((index + 1) < call.getParameters().size()) {
      writer.write("String_Node_Str");
    }
  }
  call.setProcedureArgumentNames(null);
  if (requiresProcedureCallBrackets()) {
    writer.write("String_Node_Str");
  }
  writer.write(getProcedureCallTail());
  return writer.toString();
}

Fixed version (ground truth):
/** 
 * Return the proc syntax for this platform.
 */
public String buildProcedureCallString(StoredProcedureCall call,AbstractSession session){
  StringWriter writer=new StringWriter();
  writer.write(call.getCallHeader(this));
  writer.write(call.getProcedureName());
  if (requiresProcedureCallBrackets()) {
    writer.write("String_Node_Str");
  }
 else {
    writer.write("String_Node_Str");
  }
  int indexFirst=call.getFirstParameterIndexForCallString();
  for (int index=indexFirst; index < call.getParameters().size(); index++) {
    String name=(String)call.getProcedureArgumentNames().elementAt(index);
    Object parameter=call.getParameters().elementAt(index);
    Integer parameterType=(Integer)call.getParameterTypes().elementAt(index);
    if (name != null && shouldPrintStoredProcedureArgumentNameInCall()) {
      writer.write(getProcedureArgumentString());
      writer.write(name);
      writer.write(getProcedureArgumentSetter());
    }
    writer.write("String_Node_Str");
    if (call.isOutputParameterType(parameterType)) {
      if (requiresProcedureCallOuputToken()) {
        writer.write("String_Node_Str");
        writer.write(getOutputProcedureToken());
      }
    }
    if ((index + 1) < call.getParameters().size()) {
      writer.write("String_Node_Str");
    }
  }
  call.setProcedureArgumentNames(null);
  if (requiresProcedureCallBrackets()) {
    writer.write("String_Node_Str");
  }
  writer.write(getProcedureCallTail());
  return writer.toString();
}
Program: 68830
Project: 68830
Buggy source:
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTest(new PrimitiveArrayPKCachingJUnitTestCase("String_Node_Str"));
  return new TestSetup(suite){
    protected void setUp(){
      DatabaseSession session=JUnitTestCase.getServerSession();
      assertTrue("String_Node_Str",(session).getPlatform().isOracle());
      new PrimitiveArraysAsPrimaryKeyTableCreator().replaceTables(session);
    }
    protected void tearDown(){
      clearCache();
    }
  }
;
}

Fixed version (ground truth):
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTest(new PrimitiveArrayPKCachingJUnitTestCase("String_Node_Str"));
  return new TestSetup(suite){
    protected void setUp(){
      DatabaseSession session=JUnitTestCase.getServerSession();
      if (!(JUnitTestCase.getServerSession()).getPlatform().isOracle()) {
        session.logMessage("String_Node_Str");
        return;
      }
      new PrimitiveArraysAsPrimaryKeyTableCreator().replaceTables(session);
    }
    protected void tearDown(){
      clearCache();
    }
  }
;
}
Program: 68831
Project: 68831
Buggy source:
protected void setUp(){
  DatabaseSession session=JUnitTestCase.getServerSession();
  assertTrue("String_Node_Str",(session).getPlatform().isOracle());
  new PrimitiveArraysAsPrimaryKeyTableCreator().replaceTables(session);
}

Fixed version (ground truth):
protected void setUp(){
  DatabaseSession session=JUnitTestCase.getServerSession();
  if (!(JUnitTestCase.getServerSession()).getPlatform().isOracle()) {
    session.logMessage("String_Node_Str");
    return;
  }
  new PrimitiveArraysAsPrimaryKeyTableCreator().replaceTables(session);
}
Program: 68832
Project: 68832
Buggy source:
/** 
 * Creates a PrimByteArrayPKType instance and then verifies that the same instance is returned from the database.  
 */
public void testPrimitiveByteArrayPK(){
  EntityManager em=createEntityManager();
  java.util.UUID uuid=UUID.randomUUID();
  PrimByteArrayPKType originalEntity=new PrimByteArrayPKType(PrimByteArrayPKType.getBytes(uuid));
  try {
    em.getTransaction().begin();
    em.persist(originalEntity);
    em.flush();
    PrimByteArrayPKType objectReadIn=em.find(PrimByteArrayPKType.class,PrimByteArrayPKType.getBytes(uuid));
    em.getTransaction().rollback();
    assertTrue("String_Node_Str",originalEntity == objectReadIn);
  }
 catch (  RuntimeException e) {
    if (em.getTransaction().isActive()) {
      em.getTransaction().rollback();
    }
    em.close();
    throw e;
  }
}

Fixed version (ground truth):
/** 
 * Creates a PrimByteArrayPKType instance and then verifies that the same instance is returned from the database.  
 */
public void testPrimitiveByteArrayPK(){
  if (!(JUnitTestCase.getServerSession()).getPlatform().isOracle()) {
    JUnitTestCase.getServerSession().logMessage("String_Node_Str");
    return;
  }
  EntityManager em=createEntityManager();
  java.util.UUID uuid=UUID.randomUUID();
  PrimByteArrayPKType originalEntity=new PrimByteArrayPKType(PrimByteArrayPKType.getBytes(uuid));
  try {
    em.getTransaction().begin();
    em.persist(originalEntity);
    em.flush();
    PrimByteArrayPKType objectReadIn=em.find(PrimByteArrayPKType.class,PrimByteArrayPKType.getBytes(uuid));
    em.getTransaction().rollback();
    assertTrue("String_Node_Str",originalEntity == objectReadIn);
  }
 catch (  RuntimeException e) {
    if (em.getTransaction().isActive()) {
      em.getTransaction().rollback();
    }
    em.close();
    throw e;
  }
}
Program: 68833
Project: 68833
Buggy source:
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTest(new JPAAdvPropertiesJUnitTestCase("String_Node_Str"));
  suite.addTest(new JPAAdvPropertiesJUnitTestCase("String_Node_Str"));
  suite.addTest(new JPAAdvPropertiesJUnitTestCase("String_Node_Str"));
  suite.addTest(new JPAAdvPropertiesJUnitTestCase("String_Node_Str"));
  suite.addTest(new JPAAdvPropertiesJUnitTestCase("String_Node_Str"));
  suite.addTest(new JPAAdvPropertiesJUnitTestCase("String_Node_Str"));
  suite.addTest(new JPAAdvPropertiesJUnitTestCase("String_Node_Str"));
  suite.addTest(new JPAAdvPropertiesJUnitTestCase("String_Node_Str"));
  suite.addTest(new JPAAdvPropertiesJUnitTestCase("String_Node_Str"));
  return new TestSetup(suite){
    protected void setUp(){
      DatabaseSession session=JUnitTestCase.getServerSession(persistenceUnitName);
      JPAPropertiesRelationshipTableManager tm=new JPAPropertiesRelationshipTableManager();
      tm.replaceTables(session);
    }
    protected void tearDown(){
      clearCache();
    }
  }
;
}

Fixed version (ground truth):
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTest(new JPAAdvPropertiesJUnitTestCase("String_Node_Str"));
  suite.addTest(new JPAAdvPropertiesJUnitTestCase("String_Node_Str"));
  suite.addTest(new JPAAdvPropertiesJUnitTestCase("String_Node_Str"));
  suite.addTest(new JPAAdvPropertiesJUnitTestCase("String_Node_Str"));
  suite.addTest(new JPAAdvPropertiesJUnitTestCase("String_Node_Str"));
  suite.addTest(new JPAAdvPropertiesJUnitTestCase("String_Node_Str"));
  suite.addTest(new JPAAdvPropertiesJUnitTestCase("String_Node_Str"));
  suite.addTest(new JPAAdvPropertiesJUnitTestCase("String_Node_Str"));
  suite.addTest(new JPAAdvPropertiesJUnitTestCase("String_Node_Str"));
  return new TestSetup(suite){
    protected void setUp(){
      ServerSession session=JUnitTestCase.getServerSession(persistenceUnitName);
      session.logout();
      session.loginAndDetectDatasource();
      JPAPropertiesRelationshipTableManager tm=new JPAPropertiesRelationshipTableManager();
      tm.replaceTables(session);
    }
    protected void tearDown(){
      clearCache();
    }
  }
;
}
Program: 68834
Project: 68834
Buggy source:
protected void setUp(){
  DatabaseSession session=JUnitTestCase.getServerSession(persistenceUnitName);
  JPAPropertiesRelationshipTableManager tm=new JPAPropertiesRelationshipTableManager();
  tm.replaceTables(session);
}

Fixed version (ground truth):
protected void setUp(){
  ServerSession session=JUnitTestCase.getServerSession(persistenceUnitName);
  session.logout();
  session.loginAndDetectDatasource();
  JPAPropertiesRelationshipTableManager tm=new JPAPropertiesRelationshipTableManager();
  tm.replaceTables(session);
}
Program: 68836
Project: 68836
Buggy source:
protected void writeExtraNamespaces(List extraNamespaces,XMLRecord xmlRecord,AbstractSession session){
  if (((XMLLogin)session.getDatasourceLogin()).hasEqualNamespaceResolvers()) {
    return;
  }
 else   if (xmlRecord.getDOM().getNodeType() != Node.ELEMENT_NODE) {
    return;
  }
  for (int i=0; i < extraNamespaces.size(); i++) {
    Namespace next=(Namespace)extraNamespaces.get(i);
    ((Element)xmlRecord.getDOM()).setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS + "String_Node_Str" + next.getPrefix(),next.getNamespaceURI());
  }
}

Fixed version (ground truth):
public void writeExtraNamespaces(List extraNamespaces,XMLRecord xmlRecord,AbstractSession session){
  if (extraNamespaces == null) {
    return;
  }
  if (xmlRecord.getDOM().getNodeType() != Node.ELEMENT_NODE) {
    return;
  }
  for (int i=0; i < extraNamespaces.size(); i++) {
    Namespace next=(Namespace)extraNamespaces.get(i);
    ((Element)xmlRecord.getDOM()).setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS + "String_Node_Str" + next.getPrefix(),next.getNamespaceURI());
  }
}
Program: 68837
Project: 68837
Buggy source:
protected void removeExtraNamespacesFromNamespaceResolver(XMLRecord marshalRecord,List extraNamespaces,AbstractSession session){
  if (((XMLLogin)session.getDatasourceLogin()).hasEqualNamespaceResolvers()) {
    return;
  }
  for (int i=0; i < extraNamespaces.size(); i++) {
    Namespace nextExtraNamespace=(Namespace)extraNamespaces.get(i);
    String uri=marshalRecord.getNamespaceResolver().resolveNamespacePrefix(nextExtraNamespace.getPrefix());
    if ((uri != null) && uri.equals(nextExtraNamespace.getNamespaceURI())) {
      marshalRecord.getNamespaceResolver().removeNamespace(nextExtraNamespace.getPrefix());
    }
  }
}

Fixed version (ground truth):
public void removeExtraNamespacesFromNamespaceResolver(XMLRecord marshalRecord,List extraNamespaces,AbstractSession session){
  if (extraNamespaces == null) {
    return;
  }
  for (int i=0; i < extraNamespaces.size(); i++) {
    Namespace nextExtraNamespace=(Namespace)extraNamespaces.get(i);
    String uri=marshalRecord.getNamespaceResolver().resolveNamespacePrefix(nextExtraNamespace.getPrefix());
    if ((uri != null) && uri.equals(nextExtraNamespace.getNamespaceURI())) {
      marshalRecord.getNamespaceResolver().removeNamespace(nextExtraNamespace.getPrefix());
    }
  }
}
Program: 68842
Project: 68842
Buggy source:
/** 
 * Set all the required sytems that need to be configured even if they are already configured.
 */
public void setForcedRequiredSystems(Vector systems){
  this.forcedRequiredSystems=systems;
}

Fixed version (ground truth):
/** 
 * Set all the required systems that need to be configured even if they are already configured.
 */
public void setForcedRequiredSystems(Vector systems){
  this.forcedRequiredSystems=systems;
}
Program: 68843
Project: 68843
Buggy source:
/** 
 * Passed means the test was ok.
 */
public boolean hasPassed(){
  if ((getWarnings() != 0) || (getFatalErrors() != 0) || (getProblems() != 0)|| (getErrors() != 0)|| didSetupFail()|| (getSetupFailures() != 0)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Passed means the test was ok.
 */
public boolean hasPassed(){
  if ((getWarnings() != 0) || (getFatalErrors() != 0) || (getProblems() != 0)|| (getErrors() != 0)|| didSetupFail()|| (getSetupFailures() != 0)|| didSetupWarn()|| (getSetupWarnings() != 0)) {
    return false;
  }
  return true;
}
Program: 68844
Project: 68844
Buggy source:
/** 
 * Reset the totals.
 */
public void resetTotals(){
  setResults(new Vector());
  setPassed(0);
  setWarnings(0);
  setErrors(0);
  setFatalErrors(0);
  setSetupFailures(0);
  setTotalTests(0);
}

Fixed version (ground truth):
/** 
 * Reset the totals.
 */
public void resetTotals(){
  setResults(new Vector());
  setPassed(0);
  setWarnings(0);
  setErrors(0);
  setFatalErrors(0);
  setSetupFailures(0);
  setSetupWarnings(0);
  setTotalTests(0);
}
Program: 68845
Project: 68845
Buggy source:
/** 
 * Add two test summaries
 */
public void appendTestCollectionResult(TestCollection testCollection){
  TestResultsSummary testSummary=testCollection.getSummary();
  setErrors(getErrors() + testSummary.getErrors());
  setPassed(getPassed() + testSummary.getPassed());
  setWarnings(getWarnings() + testSummary.getWarnings());
  setProblems(getProblems() + testSummary.getProblems());
  setFatalErrors(getFatalErrors() + testSummary.getFatalErrors());
  setTotalTests(getTotalTests() + testSummary.getTotalTests());
  setSetupFailures(getSetupFailures() + testSummary.getSetupFailures());
  if (testSummary.didSetupFail()) {
    setSetupFailures(getSetupFailures() + 1);
  }
  testCollection.getSummary().setParent(this);
  LoadBuildSystem.loadBuild.addSummary(this);
}

Fixed version (ground truth):
/** 
 * Add two test summaries
 */
public void appendTestCollectionResult(TestCollection testCollection){
  TestResultsSummary testSummary=testCollection.getSummary();
  setErrors(getErrors() + testSummary.getErrors());
  setPassed(getPassed() + testSummary.getPassed());
  setWarnings(getWarnings() + testSummary.getWarnings());
  setProblems(getProblems() + testSummary.getProblems());
  setFatalErrors(getFatalErrors() + testSummary.getFatalErrors());
  setTotalTests(getTotalTests() + testSummary.getTotalTests());
  setSetupFailures(getSetupFailures() + testSummary.getSetupFailures());
  setSetupWarnings(getSetupWarnings() + testSummary.getSetupWarnings());
  if (testSummary.didSetupFail()) {
    setSetupFailures(getSetupFailures() + 1);
  }
 else   if (testSummary.didSetupWarn()) {
    setSetupWarnings(getSetupWarnings() + 1);
  }
  testCollection.getSummary().setParent(this);
  LoadBuildSystem.loadBuild.addSummary(this);
}
Program: 68846
Project: 68846
Buggy source:
public boolean didSetupFail(){
  return getSetupException() != null;
}

Fixed version (ground truth):
public boolean didSetupFail(){
  return getSetupException() != null && !didSetupWarn();
}
Program: 68848
Project: 68848
Buggy source:
/** 
 * Executes all the test entities in the collection.
 */
public void execute(TestExecutor executor) throws Throwable {
  setSummary(new TestResultsSummary(this));
  setExecutor(executor);
  setFinishedTests(new Vector());
  long startTime=System.currentTimeMillis();
  for (Enumeration tests=getTests().elements(); tests.hasMoreElements(); ) {
    junit.framework.Test test=(junit.framework.Test)tests.nextElement();
    if ((TestExecutor.getDefaultJUnitTestResult() != null) && TestExecutor.getDefaultJUnitTestResult().shouldStop()) {
      break;
    }
    executor.execute(test);
    getFinishedTests().addElement(test);
  }
  long endTime=System.currentTimeMillis();
  getSummary().setTotalTime(endTime - startTime);
  setFinishedTests((Vector)getTests().clone());
}

Fixed version (ground truth):
/** 
 * Executes all the test entities in the collection.
 */
public void execute(TestExecutor executor) throws Throwable {
  setSummary(new TestResultsSummary(this));
  setExecutor(executor);
  setupEntity();
  setFinishedTests(new Vector());
  long startTime=System.currentTimeMillis();
  for (Enumeration tests=getTests().elements(); tests.hasMoreElements(); ) {
    junit.framework.Test test=(junit.framework.Test)tests.nextElement();
    if ((TestExecutor.getDefaultJUnitTestResult() != null) && TestExecutor.getDefaultJUnitTestResult().shouldStop()) {
      break;
    }
    executor.execute(test);
    getFinishedTests().addElement(test);
  }
  long endTime=System.currentTimeMillis();
  getSummary().setTotalTime(endTime - startTime);
  setFinishedTests((Vector)getTests().clone());
}
Program: 68849
Project: 68849
Buggy source:
public void setupEntity(){
  ;
}

Fixed version (ground truth):
public void setupEntity() throws Throwable {
  try {
    setup();
  }
 catch (  Throwable exception) {
    getSummary().setSetupException(exception);
    throw exception;
  }
}
Program: 68850
Project: 68850
Buggy source:
protected void changeObject(){
  Employee employee=(Employee)this.workingCopy;
  employee.setNormalHours(new java.sql.Time[2]);
  employee.setStartTime(Helper.timeFromHourMinuteSecond(1,1,1));
  employee.setEndTime(Helper.timeFromHourMinuteSecond(1,1,1));
  employee.setPeriod(new EmploymentPeriod(Helper.dateFromYearMonthDate(2001,1,1),Helper.dateFromYearMonthDate(2002,2,2)));
  employee.setPhoneNumbers(new Vector());
  employee.addPhoneNumber(new PhoneNumber("String_Node_Str","String_Node_Str","String_Node_Str"));
  employee.addPhoneNumber(new PhoneNumber("String_Node_Str","String_Node_Str","String_Node_Str"));
  employee.setProjects(new Vector());
  employee.addProject((Project)getUnitOfWork().readObject(SmallProject.class));
  employee.addProject((Project)getUnitOfWork().readObject(LargeProject.class));
  employee.setResponsibilitiesList(new Vector());
  employee.addResponsibility("String_Node_Str");
  employee.addResponsibility("String_Node_Str");
  employee.setAddress(new EmployeePopulator().addressExample12());
  employee.setManager((Employee)getUnitOfWork().readObject(Employee.class));
}

Fixed version (ground truth):
protected void changeObject(){
  Employee employee=(Employee)this.workingCopy;
  employee.setNormalHours(new java.sql.Time[2]);
  employee.setStartTime(Helper.timeFromHourMinuteSecond(1,1,1));
  employee.setEndTime(Helper.timeFromHourMinuteSecond(1,1,1));
  employee.setPeriod(new EmploymentPeriod(Helper.dateFromYearMonthDate(2001,1,1),Helper.dateFromYearMonthDate(2002,2,2)));
  employee.setPhoneNumbers(new Vector());
  employee.addPhoneNumber(new PhoneNumber("String_Node_Str","String_Node_Str","String_Node_Str"));
  employee.addPhoneNumber(new PhoneNumber("String_Node_Str","String_Node_Str","String_Node_Str"));
  employee.setProjects(new Vector());
  employee.addProject((Project)getUnitOfWork().readObject(SmallProject.class));
  employee.addProject((Project)getUnitOfWork().readObject(LargeProject.class));
  employee.setResponsibilitiesList(new Vector());
  employee.addResponsibility("String_Node_Str");
  employee.addResponsibility("String_Node_Str");
  employee.setAddress(new EmployeePopulator().addressExample12());
  Vector employees=getUnitOfWork().readAllObjects(Employee.class);
  Employee manager=null;
  for (int i=0; i < employees.size(); i++) {
    manager=(Employee)employees.elementAt(i);
    if (!manager.getId().equals(employee.getId())) {
      break;
    }
  }
  employee.setManager(manager);
}
Program: 68851
Project: 68851
Buggy source:
public void addTests(){
  super.addTests();
  addTest(new RollbackObjectsTest(Employee.class,getAsOfClause()));
  addTest(EmployeeBasicTestModel.getReadObjectTestSuite());
  addTest(EmployeeBasicTestModel.getReadAllTestSuite());
  addTest(EmployeeBasicTestModel.getInsertObjectTestSuite());
  addTest(EmployeeBasicTestModel.getUpdateObjectTestSuite());
  addTest(EmployeeBasicTestModel.getDeleteObjectTestSuite());
  addTest(new IsolatedSessionHistoricalTest(getAsOfClause()));
}

Fixed version (ground truth):
public void addTests(){
  super.addTests();
  addTest(new RollbackObjectsTest(Employee.class,getAsOfClause()));
  addTest(EmployeeBasicTestModel.getReadObjectTestSuite());
  addTest(EmployeeBasicTestModel.getReadAllTestSuite());
  addTest(EmployeeBasicTestModel.getInsertObjectTestSuite());
  buildUpdateObjectTestSuite();
  addTest(EmployeeBasicTestModel.getDeleteObjectTestSuite());
  addTest(new IsolatedSessionHistoricalTest(getAsOfClause()));
}
Program: 68852
Project: 68852
Buggy source:
public void addRequiredSystems(){
  if (!(getSession().getPlatform() instanceof OraclePlatform)) {
    throw new TestProblemException("String_Node_Str");
  }
  addRequiredSystem(new IsolatedSessionSystem());
}

Fixed version (ground truth):
public void addRequiredSystems(){
  if (!(getSession().getPlatform() instanceof OraclePlatform)) {
    throw new TestWarningException("String_Node_Str");
  }
  addRequiredSystem(new IsolatedSessionSystem());
}
Program: 68853
Project: 68853
Buggy source:
public void setup(){
  Employee emp;
  Vector employees=getSomeEmployees();
  emp=(Employee)employees.firstElement();
  PhoneNumber phoneNumber=(PhoneNumber)emp.getPhoneNumbers().elementAt(0);
  String ejbqlString="String_Node_Str" + "String_Node_Str";
  setEjbqlString(ejbqlString);
  setOriginalOject(employees);
  Vector parameters=new Vector();
  parameters.add(phoneNumber);
  setArguments(parameters);
  Vector myArgumentNames=new Vector();
  myArgumentNames.add("String_Node_Str");
  setArgumentNames(myArgumentNames);
  super.setup();
}

Fixed version (ground truth):
public void setup(){
  Employee emp;
  Vector employees=getSomeEmployees();
  emp=(Employee)employees.firstElement();
  PhoneNumber phoneNumber=(PhoneNumber)emp.getPhoneNumbers().elementAt(0);
  String ejbqlString="String_Node_Str" + "String_Node_Str";
  setEjbqlString(ejbqlString);
  if (emp.getPhoneNumbers().size() == 1) {
    employees.removeElementAt(0);
  }
  setOriginalOject(employees);
  Vector parameters=new Vector();
  parameters.add(phoneNumber);
  setArguments(parameters);
  Vector myArgumentNames=new Vector();
  myArgumentNames.add("String_Node_Str");
  setArgumentNames(myArgumentNames);
  super.setup();
}
Program: 68854
Project: 68854
Buggy source:
public void setup(){
  String projectName=null;
  getAbstractSession().addAlias("String_Node_Str",getSession().getDescriptor(Project.class));
  Project project=(Project)getSomeProjects().firstElement();
  projectName=project.getName();
  ReadObjectQuery roq=new ReadObjectQuery();
  ExpressionBuilder eb=new ExpressionBuilder();
  Expression whereClause=eb.get("String_Node_Str").equal(projectName);
  roq.setSelectionCriteria(whereClause);
  roq.setReferenceClass(LargeProject.class);
  LargeProject proj=(LargeProject)getSession().executeQuery(roq);
  setOriginalOject(proj);
  String ejbql="String_Node_Str" + projectName + "String_Node_Str";
  this.setEjbqlString(ejbql);
  this.setReferenceClass(LargeProject.class);
}

Fixed version (ground truth):
public void setup(){
  String projectName=null;
  getAbstractSession().addAlias("String_Node_Str",getSession().getDescriptor(Project.class));
  Project project=null;
  Vector projects=getSomeProjects();
  for (int i=0; i < projects.size(); i++) {
    project=(Project)projects.elementAt(i);
    if (project instanceof LargeProject) {
      break;
    }
  }
  projectName=project.getName();
  ReadObjectQuery roq=new ReadObjectQuery();
  ExpressionBuilder eb=new ExpressionBuilder();
  Expression whereClause=eb.get("String_Node_Str").equal(projectName);
  roq.setSelectionCriteria(whereClause);
  roq.setReferenceClass(LargeProject.class);
  LargeProject proj=(LargeProject)getSession().executeQuery(roq);
  if (proj == null) {
    setOriginalOject(new Vector(0));
  }
 else {
    setOriginalOject(proj);
  }
  String ejbql="String_Node_Str" + projectName + "String_Node_Str";
  this.setEjbqlString(ejbql);
  this.setReferenceClass(LargeProject.class);
}
Program: 68855
Project: 68855
Buggy source:
public void setup(){
  getSession().getIdentityMapAccessor().initializeIdentityMaps();
  Project project=(Project)getSomeProjects().firstElement();
  setArgument(project.getName());
  ReadObjectQuery roq=new ReadObjectQuery();
  roq.setReferenceClass(LargeProject.class);
  ExpressionBuilder eb=new ExpressionBuilder();
  Expression whereClause=eb.get("String_Node_Str").equal(getArgument());
  roq.setSelectionCriteria(whereClause);
  Project proj=(Project)getSession().executeQuery(roq);
  setOriginalOject(proj);
  setUpSessionWithNamedQuery();
}

Fixed version (ground truth):
public void setup(){
  getSession().getIdentityMapAccessor().initializeIdentityMaps();
  Project project=null;
  Vector projects=getSomeProjects();
  for (int i=0; i < projects.size(); i++) {
    project=(Project)projects.elementAt(i);
    if (project instanceof LargeProject) {
      break;
    }
  }
  setArgument(project.getName());
  ReadObjectQuery roq=new ReadObjectQuery();
  roq.setReferenceClass(LargeProject.class);
  ExpressionBuilder eb=new ExpressionBuilder();
  Expression whereClause=eb.get("String_Node_Str").equal(getArgument());
  roq.setSelectionCriteria(whereClause);
  Project proj=(Project)getSession().executeQuery(roq);
  if (proj == null) {
    setOriginalOject(new Vector(0));
  }
 else {
    setOriginalOject(proj);
  }
  setUpSessionWithNamedQuery();
}
Program: 68856
Project: 68856
Buggy source:
public void setup(){
  Vector employees=new Vector();
  Employee emp;
  emp=(Employee)getSomeEmployees().firstElement();
  String firstName=emp.getFirstName();
  String partialFirstName=emp.getFirstName().substring(0,1);
  partialFirstName=partialFirstName + "String_Node_Str";
  partialFirstName=partialFirstName + firstName.substring(2,4);
  partialFirstName=partialFirstName + "String_Node_Str";
  ReadAllQuery raq=new ReadAllQuery();
  raq.setReferenceClass(Employee.class);
  ExpressionBuilder eb=new ExpressionBuilder();
  Expression whereClause=eb.get("String_Node_Str").like(partialFirstName);
  raq.setSelectionCriteria(whereClause);
  employees=(Vector)getSession().executeQuery(raq);
  String ejbqlString="String_Node_Str" + partialFirstName + "String_Node_Str";
  setEjbqlString(ejbqlString);
  setOriginalOject(employees);
  super.setup();
}

Fixed version (ground truth):
public void setup(){
  Vector employees=new Vector();
  Employee emp;
  emp=(Employee)getSomeEmployees().firstElement();
  String firstName=emp.getFirstName();
  String partialFirstName=emp.getFirstName().substring(0,1);
  partialFirstName=partialFirstName + "String_Node_Str";
  partialFirstName=partialFirstName + firstName.substring(2,Math.min(4,firstName.length()));
  partialFirstName=partialFirstName + "String_Node_Str";
  ReadAllQuery raq=new ReadAllQuery();
  raq.setReferenceClass(Employee.class);
  ExpressionBuilder eb=new ExpressionBuilder();
  Expression whereClause=eb.get("String_Node_Str").like(partialFirstName);
  raq.setSelectionCriteria(whereClause);
  employees=(Vector)getSession().executeQuery(raq);
  String ejbqlString="String_Node_Str" + partialFirstName + "String_Node_Str";
  setEjbqlString(ejbqlString);
  setOriginalOject(employees);
  super.setup();
}
Program: 68857
Project: 68857
Buggy source:
public void testQueryTimeoutReset(Session session){
  boolean query1TimedOut=false;
  boolean query2TimedOut=false;
  String sql;
  if (getSession().getLogin().getDatasourcePlatform().isDB2()) {
    sql="String_Node_Str";
  }
 else   if (getSession().getLogin().getDatasourcePlatform().isSybase()) {
    sql="String_Node_Str";
  }
 else {
    sql="String_Node_Str";
  }
  try {
    DataReadQuery query=new DataReadQuery();
    query.setSQLString(sql);
    query.setQueryTimeout(1);
    session.executeQuery(query);
  }
 catch (  Exception e) {
    if (e instanceof DatabaseException) {
      query1TimedOut=true;
    }
  }
  try {
    DataReadQuery query=new DataReadQuery();
    query.setSQLString(sql);
    session.executeQuery(query);
  }
 catch (  Exception e) {
    if (e instanceof DatabaseException) {
      query2TimedOut=true;
    }
  }
  if (query2TimedOut == true) {
    throw new TestErrorException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void testQueryTimeoutReset(Session session){
  boolean query1TimedOut=false;
  boolean query2TimedOut=false;
  String sql;
  if (getSession().getLogin().getDatasourcePlatform().isDB2() || getSession().getLogin().getDatasourcePlatform().isMySQL()) {
    sql="String_Node_Str";
  }
 else   if (getSession().getLogin().getDatasourcePlatform().isSybase()) {
    sql="String_Node_Str";
  }
 else {
    sql="String_Node_Str";
  }
  try {
    DataReadQuery query=new DataReadQuery();
    query.setSQLString(sql);
    query.setQueryTimeout(1);
    session.executeQuery(query);
  }
 catch (  Exception e) {
    if (e instanceof DatabaseException) {
      query1TimedOut=true;
    }
  }
  try {
    DataReadQuery query=new DataReadQuery();
    query.setSQLString(sql);
    session.executeQuery(query);
  }
 catch (  Exception e) {
    if (e instanceof DatabaseException) {
      query2TimedOut=true;
    }
  }
  if (query2TimedOut == true) {
    throw new TestErrorException("String_Node_Str");
  }
}
Program: 68858
Project: 68858
Buggy source:
protected void verify(){
  if (results.isEmpty()) {
    throw new TestErrorException("String_Node_Str");
  }
 else {
    ReportQueryResult result=results.firstElement();
    Object value;
    value=result.get("String_Node_Str");
    if (value instanceof Integer && !(getSession().getDatasourcePlatform().isDB2())) {
      throw new TestErrorException("String_Node_Str");
    }
    if (getSession().getDatasourcePlatform().isOracle()) {
      value=result.get("String_Node_Str");
      if (value instanceof Integer) {
        throw new TestErrorException("String_Node_Str");
      }
    }
    value=result.get("String_Node_Str");
    if (value instanceof Integer) {
      throw new TestErrorException("String_Node_Str");
    }
    value=result.get("String_Node_Str");
    if (!(value instanceof BigDecimal || (value instanceof Integer && getSession().getDatasourcePlatform().isDB2()))) {
      throw new TestErrorException("String_Node_Str");
    }
    value=result.get("String_Node_Str");
    if (!(value instanceof BigDecimal || (value instanceof Integer && getSession().getDatasourcePlatform().isDB2()))) {
      throw new TestErrorException("String_Node_Str");
    }
    value=result.get("String_Node_Str");
    if (!(value instanceof BigDecimal || (value instanceof Integer && getSession().getDatasourcePlatform().isDB2()))) {
      throw new TestErrorException("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
protected void verify(){
  if (results.isEmpty()) {
    throw new TestErrorException("String_Node_Str");
  }
 else {
    ReportQueryResult result=results.firstElement();
    Object value;
    value=result.get("String_Node_Str");
    if (value instanceof Integer && !(getSession().getDatasourcePlatform().isDB2())) {
      throw new TestErrorException("String_Node_Str");
    }
    if (getSession().getDatasourcePlatform().isOracle()) {
      value=result.get("String_Node_Str");
      if (value instanceof Integer) {
        throw new TestErrorException("String_Node_Str");
      }
    }
    value=result.get("String_Node_Str");
    if (value instanceof Integer) {
      throw new TestErrorException("String_Node_Str");
    }
    value=result.get("String_Node_Str");
    if (!(value instanceof BigDecimal || (value instanceof Integer && getSession().getDatasourcePlatform().isDB2()))) {
      throw new TestErrorException("String_Node_Str");
    }
    value=result.get("String_Node_Str");
    if (!(value instanceof BigDecimal || (value instanceof Integer && getSession().getDatasourcePlatform().isDB2()) || (value instanceof Long && getSession().getDatasourcePlatform().isMySQL()))) {
      throw new TestErrorException("String_Node_Str");
    }
    value=result.get("String_Node_Str");
    if (!(value instanceof BigDecimal || (value instanceof Integer && getSession().getDatasourcePlatform().isDB2()) || (value instanceof Long && getSession().getDatasourcePlatform().isMySQL()))) {
      throw new TestErrorException("String_Node_Str");
    }
  }
}
Program: 68860
Project: 68860
Buggy source:
public void testLoadFromStringSaveDocumentToWriter() throws Exception {
  List types=defineTypes();
  FileInputStream inputStream=new FileInputStream(getControlFileName());
  byte[] bytes=new byte[inputStream.available()];
  inputStream.read(bytes);
  XMLDocument document=xmlHelper.load(new String(bytes));
  verifyAfterLoad(document);
  StringWriter writer=new StringWriter();
  xmlHelper.save(document,writer,null);
  compareXML(getControlWriteFileName(),writer.toString());
}

Fixed version (ground truth):
public void testLoadFromStringSaveDocumentToWriter() throws Exception {
  defineTypes();
  FileInputStream inputStream=new FileInputStream(getControlFileName());
  byte[] bytes=new byte[inputStream.available()];
  inputStream.read(bytes);
  XMLDocument document=xmlHelper.load(new String(bytes));
  verifyAfterLoad(document);
  StringWriter writer=new StringWriter();
  xmlHelper.save(document,writer,null);
  compareXML(getControlWriteFileName(),writer.toString());
}
Program: 68861
Project: 68861
Buggy source:
public void testClassGenerationLoadAndSave() throws Exception {
  String tmpDirName=tempFileDir + "String_Node_Str";
  File f=new File(tmpDirName);
  f.mkdir();
  f.deleteOnExit();
  generateClasses(tmpDirName);
  setUp();
  compileFiles(tmpDirName,getPackages());
  URL[] urls=new URL[1];
  urls[0]=f.toURL();
  URLClassLoader myURLLoader=new URLClassLoader(urls);
  String package1=(String)getPackages().get(0);
  String className=package1 + "String_Node_Str" + getRootInterfaceName();
  className=className.replaceAll("String_Node_Str","String_Node_Str");
  Class urlLoadedClass=myURLLoader.loadClass(className);
  ((SDOXMLHelper)xmlHelper).getLoader().setDelegateLoader(myURLLoader);
  Class loadedClass2=((SDOXMLHelper)xmlHelper).getLoader().loadClass(className);
  defineTypes();
  assertEquals(urlLoadedClass,loadedClass2);
  FileInputStream inputStream=new FileInputStream(getControlFileName());
  byte[] bytes=new byte[inputStream.available()];
  inputStream.read(bytes);
  XMLDocument document=xmlHelper.load(new String(bytes));
  Class loadedClass=document.getRootObject().getType().getInstanceClass();
  assertEquals(urlLoadedClass,loadedClass);
  verifyAfterLoad(document);
  StringWriter writer=new StringWriter();
  xmlHelper.save(document,writer,null);
  compareXML(getControlWriteFileName(),writer.toString());
}

Fixed version (ground truth):
public void testClassGenerationLoadAndSave() throws Exception {
  String tmpDirName=tempFileDir + "String_Node_Str";
  File f=new File(tmpDirName);
  f.mkdir();
  f.deleteOnExit();
  generateClasses(tmpDirName);
  setUp();
  compileFiles(tmpDirName,getPackages());
  URL[] urls=new URL[1];
  urls[0]=f.toURL();
  URLClassLoader myURLLoader=new URLClassLoader(urls);
  String package1=(String)getPackages().get(0);
  String className=package1 + "String_Node_Str" + getRootInterfaceName();
  className=className.replaceAll("String_Node_Str","String_Node_Str");
  Class urlLoadedClass=myURLLoader.loadClass(className);
  ((SDOXMLHelper)xmlHelper).getLoader().setDelegateLoader(myURLLoader);
  Class loadedClass2=((SDOXMLHelper)xmlHelper).getLoader().loadClass(className);
  defineTypes();
  assertEquals(urlLoadedClass,loadedClass2);
  FileInputStream inputStream=new FileInputStream(getControlFileName());
  XMLDocument document=xmlHelper.load(inputStream);
  Class loadedClass=document.getRootObject().getType().getInstanceClass();
  assertEquals(urlLoadedClass,loadedClass);
  verifyAfterLoad(document);
  StringWriter writer=new StringWriter();
  xmlHelper.save(document,writer,null);
  compareXML(getControlWriteFileName(),writer.toString());
}