nus-yam/ex-repair huggingface dataset:
Program: 68760
Project: 68760
Buggy source:
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord,Object collection){
  Object objectValue=unmarshalRecord.getChildRecord().getCurrentObject();
  if (xmlCompositeCollectionMapping.hasConverter()) {
    Converter converter=xmlCompositeCollectionMapping.getConverter();
    if (converter instanceof XMLConverter) {
      objectValue=((XMLConverter)converter).convertDataValueToObjectValue(objectValue,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
    }
 else {
      objectValue=converter.convertObjectValueToDataValue(objectValue,unmarshalRecord.getSession());
    }
  }
  xmlCompositeCollectionMapping.getContainerPolicy().addInto(objectValue,collection,unmarshalRecord.getSession());
  unmarshalRecord.setChildRecord(null);
}

Fixed version (ground truth):
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord,Object collection){
  Object objectValue=unmarshalRecord.getChildRecord().getCurrentObject();
  if (xmlCompositeCollectionMapping.hasConverter()) {
    Converter converter=xmlCompositeCollectionMapping.getConverter();
    if (converter instanceof XMLConverter) {
      objectValue=((XMLConverter)converter).convertDataValueToObjectValue(objectValue,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
    }
 else {
      objectValue=converter.convertObjectValueToDataValue(objectValue,unmarshalRecord.getSession());
    }
  }
  unmarshalRecord.addAttributeValue(this,objectValue,collection);
  unmarshalRecord.setChildRecord(null);
}
Program: 68761
Project: 68761
Buggy source:
private void addUnmarshalValue(UnmarshalRecord unmarshalRecord,Object value,Object collection){
  if ((null == value) || EMPTY_STRING.equals(value)) {
    return;
  }
  XMLField xmlField=(XMLField)xmlCompositeDirectCollectionMapping.getField();
  XMLConversionManager xmlConversionManager=(XMLConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager();
  if (unmarshalRecord.getTypeQName() != null) {
    Class typeClass=xmlField.getJavaClass(unmarshalRecord.getTypeQName());
    value=xmlConversionManager.convertObject(value,typeClass,unmarshalRecord.getTypeQName());
  }
 else {
    value=xmlField.convertValueBasedOnSchemaType(value,xmlConversionManager);
  }
  if (xmlCompositeDirectCollectionMapping.hasValueConverter()) {
    if (xmlCompositeDirectCollectionMapping.getValueConverter() instanceof XMLConverter) {
      value=((XMLConverter)xmlCompositeDirectCollectionMapping.getValueConverter()).convertDataValueToObjectValue(value,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
    }
 else {
      value=xmlCompositeDirectCollectionMapping.getValueConverter().convertDataValueToObjectValue(value,unmarshalRecord.getSession());
    }
  }
  xmlCompositeDirectCollectionMapping.getContainerPolicy().addInto(value,collection,unmarshalRecord.getSession());
}

Fixed version (ground truth):
private void addUnmarshalValue(UnmarshalRecord unmarshalRecord,Object value,Object collection){
  if ((null == value) || EMPTY_STRING.equals(value)) {
    return;
  }
  XMLField xmlField=(XMLField)xmlCompositeDirectCollectionMapping.getField();
  XMLConversionManager xmlConversionManager=(XMLConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager();
  if (unmarshalRecord.getTypeQName() != null) {
    Class typeClass=xmlField.getJavaClass(unmarshalRecord.getTypeQName());
    value=xmlConversionManager.convertObject(value,typeClass,unmarshalRecord.getTypeQName());
  }
 else {
    value=xmlField.convertValueBasedOnSchemaType(value,xmlConversionManager);
  }
  if (xmlCompositeDirectCollectionMapping.hasValueConverter()) {
    if (xmlCompositeDirectCollectionMapping.getValueConverter() instanceof XMLConverter) {
      value=((XMLConverter)xmlCompositeDirectCollectionMapping.getValueConverter()).convertDataValueToObjectValue(value,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
    }
 else {
      value=xmlCompositeDirectCollectionMapping.getValueConverter().convertDataValueToObjectValue(value,unmarshalRecord.getSession());
    }
  }
  unmarshalRecord.addAttributeValue(this,value,collection);
}
Program: 68762
Project: 68762
Buggy source:
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord){
  SAXFragmentBuilder builder=unmarshalRecord.getFragmentBuilder();
  Object value=builder.getNodes().pop();
  Object collection=unmarshalRecord.getContainerInstance(this);
  xmlFragmentCollectionMapping.getContainerPolicy().addInto(value,collection,unmarshalRecord.getSession());
}

Fixed version (ground truth):
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord){
  SAXFragmentBuilder builder=unmarshalRecord.getFragmentBuilder();
  Object value=builder.getNodes().pop();
  unmarshalRecord.addAttributeValue(this,value);
}
Program: 68763
Project: 68763
Buggy source:
public void addAttributeValue(UnmarshalRecord unmarshalRecord,ContainerValue containerValue,Object value){
  Object collection=unmarshalRecord.getContainerInstance(containerValue);
  containerValue.getContainerPolicy().addInto(value,collection,unmarshalRecord.getSession());
}

Fixed version (ground truth):
public void addAttributeValue(UnmarshalRecord unmarshalRecord,ContainerValue containerValue,Object value,Object collection){
  containerValue.getContainerPolicy().addInto(value,collection,unmarshalRecord.getSession());
}
Program: 68764
Project: 68764
Buggy source:
public void addAttributeValue(UnmarshalRecord unmarshalRecord,ContainerValue containerValue,Object value){
  currentSetting.setMapping(containerValue.getMapping());
  currentSetting.setObject(unmarshalRecord.getCurrentObject());
  currentSetting.addValue(value,true,unmarshalRecord.getContainerInstance(containerValue));
}

Fixed version (ground truth):
public void addAttributeValue(UnmarshalRecord unmarshalRecord,ContainerValue containerValue,Object value,Object collection){
  currentSetting.setMapping(containerValue.getMapping());
  currentSetting.setObject(unmarshalRecord.getCurrentObject());
  currentSetting.addValue(value,true,collection);
}
Program: 68765
Project: 68765
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 sequencedObject=(SequencedObject)unmarshalRecord.getCurrentObject();
    sequencedObject.getSettings().add(currentSetting);
  }
 else {
    parentSetting.addChild(currentSetting);
  }
}

Fixed version (ground truth):
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);
  }
}
Program: 68766
Project: 68766
Buggy source:
/** 
 * When a Reference is built the UnmarshalContext is given the ability to perform further processing on it. 
 * @param reference
 */
public void reference(Reference reference);

Fixed version (ground truth):
public void reference(Reference reference);
Program: 68767
Project: 68767
Buggy source:
/** 
 * When a collection mapping is processed the UnmarshalContext is responsible for handling the values one at a time.
 * @param unmarshalRecord
 * @param containerValue A container object such as a java.util.ArrayList, to which the value will be added.
 * @param value The value to be added to the container,
 */
public void addAttributeValue(UnmarshalRecord unmarshalRecord,ContainerValue containerValue,Object value);

Fixed version (ground truth):
/** 
 * When a collection mapping is processed the UnmarshalContext is responsible for handling the values one at a time.
 * @param unmarshalRecord
 * @param containerValue A container object such as a java.util.ArrayList, to which the value will be added.
 * @param value The value to be added to the container,
 * @param collection
 */
public void addAttributeValue(UnmarshalRecord unmarshalRecord,ContainerValue containerValue,Object value,Object collection);
Program: 68768
Project: 68768
Buggy source:
public void addAttributeValue(ContainerValue containerValue,Object value){
  this.unmarshalContext.addAttributeValue(this,containerValue,value);
}

Fixed version (ground truth):
public void addAttributeValue(ContainerValue containerValue,Object value,Object collection){
  this.unmarshalContext.addAttributeValue(this,containerValue,value,collection);
}
Program: 68769
Project: 68769
Buggy source:
/** 
 * @param parentSetting The parent Setting or null if this setting has not parent. 
 */
protected void setParent(Setting parentSetting){
  this.parent=parentSetting;
}

Fixed version (ground truth):
/** 
 * @param parentSetting The parent Setting or null if this setting has not parent. 
 */
public void setParent(Setting parentSetting){
  this.parent=parentSetting;
}
Program: 68770
Project: 68770
Buggy source:
/** 
 * @return A copy of the Setting object and its child Setting objects.  The copycontains references to the original object, mapping, and value.
 */
public Setting copy(){
  Setting copy=new Setting();
  copy.setName(name);
  copy.setNamespaceURI(namespaceURI);
  copy.setObject(object);
  copy.setMapping(mapping);
  copy.setValue(value,false);
  if (null != children) {
    for (int index=0, size=children.size(); index < size; index++) {
      copy.addChild(children.get(index).copy());
    }
  }
  return copy;
}

Fixed version (ground truth):
public Setting copy(Object newParent,Object copyValue){
  Setting copy=new Setting();
  copy.setName(name);
  copy.setNamespaceURI(namespaceURI);
  if (getObject() != null) {
    copy.setObject(newParent);
  }
  copy.setMapping(mapping);
  copy.setValue(copyValue,false);
  if (null != children) {
    for (int index=0, size=children.size(); index < size; index++) {
      copy.addChild(children.get(index).copy(newParent,copyValue));
    }
  }
  return copy;
}
Program: 68771
Project: 68771
Buggy source:
/** 
 * Rollback the transaction on the datasource. If not using managed transaction rollback the local transaction.
 */
public void rollbackTransaction(AbstractSession session) throws DatabaseException {
  if (usesExternalTransactionController()) {
    if (!session.isSynchronized()) {
      setIsInTransaction(false);
      if (usesExternalConnectionPooling()) {
        closeConnection();
      }
    }
    return;
  }
  session.log(SessionLog.FINER,SessionLog.TRANSACTION,"String_Node_Str",(Object[])null,this);
  try {
    session.startOperationProfile(SessionProfiler.TRANSACTION);
    incrementCallCount(session);
    basicRollbackTransaction(session);
  }
  finally {
    setIsInTransaction(false);
    sequencingCallback=null;
    decrementCallCount();
    session.endOperationProfile(SessionProfiler.TRANSACTION);
  }
}

Fixed version (ground truth):
/** 
 * Rollback the transaction on the datasource. If not using managed transaction rollback the local transaction.
 */
public void rollbackTransaction(AbstractSession session) throws DatabaseException {
  if (usesExternalTransactionController()) {
    if (!session.isSynchronized()) {
      setIsInTransaction(false);
      if (usesExternalConnectionPooling()) {
        currentSession=session;
        closeConnection();
      }
    }
    return;
  }
  session.log(SessionLog.FINER,SessionLog.TRANSACTION,"String_Node_Str",(Object[])null,this);
  try {
    session.startOperationProfile(SessionProfiler.TRANSACTION);
    isCompletingTransaction=true;
    incrementCallCount(session);
    basicRollbackTransaction(session);
  }
  finally {
    setIsInTransaction(false);
    isCompletingTransaction=false;
    sequencingCallback=null;
    decrementCallCount();
    session.endOperationProfile(SessionProfiler.TRANSACTION);
  }
}
Program: 68772
Project: 68772
Buggy source:
/** 
 * Used for load balancing and external pooling.
 */
public synchronized void incrementCallCount(AbstractSession session){
  setCallCount(getCallCount() + 1);
  if (getCallCount() == 1) {
    if (getLogin() == null) {
      throw DatabaseException.databaseAccessorNotConnected();
    }
    if (getDatasourceConnection() != null) {
      if (!isConnected()) {
        if (isInTransaction()) {
          throw DatabaseException.databaseAccessorNotConnected();
        }
 else {
          reconnect(session);
        }
      }
    }
 else {
      if (usesExternalConnectionPooling()) {
        reconnect(session);
      }
 else {
        throw DatabaseException.databaseAccessorNotConnected();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Used for load balancing and external pooling.
 */
public synchronized void incrementCallCount(AbstractSession session){
  setCallCount(getCallCount() + 1);
  if (getCallCount() == 1) {
    if (getLogin() == null) {
      throw DatabaseException.databaseAccessorNotConnected();
    }
    if (getDatasourceConnection() != null) {
      if (!isConnected()) {
        if (isInTransaction()) {
          throw DatabaseException.databaseAccessorNotConnected();
        }
 else {
          reconnect(session);
        }
      }
    }
 else {
      if (usesExternalConnectionPooling()) {
        reconnect(session);
        if (isBeginningTransaction || isInTransaction() || session.isExclusiveConnectionRequired()) {
          session.postConnectExternalConnection(this);
          currentSession=session;
        }
 else         if (isCompletingTransaction) {
          currentSession=session;
        }
      }
 else {
        throw DatabaseException.databaseAccessorNotConnected();
      }
    }
  }
}
Program: 68773
Project: 68773
Buggy source:
/** 
 * Reset statment count.
 */
public void resetStatmentsCount(){
  readStatementsCount=0;
  writeStatementsCount=0;
  storedProcedureStatementsCount=0;
}

Fixed version (ground truth):
/** 
 * Reset statement count.
 */
public void resetStatmentsCount(){
  readStatementsCount=0;
  writeStatementsCount=0;
  storedProcedureStatementsCount=0;
}
Program: 68774
Project: 68774
Buggy source:
/** 
 * This should be set to false if a communication failure occurred durring a call execution.   In the case of an invalid accessor the Accessor will not be returned to the pool.
 */
public void setIsValid(boolean isValid){
  this.isValid=isValid;
}

Fixed version (ground truth):
/** 
 * This should be set to false if a communication failure occurred during a call execution.   In the case of an invalid accessor the Accessor will not be returned to the pool.
 */
public void setIsValid(boolean isValid){
  this.isValid=isValid;
}
Program: 68775
Project: 68775
Buggy source:
/** 
 * Returns true if this Accessor can continue to be used.  This will be false if a communication failure occurred durring a call execution.  In the case of an invalid accessor the Accessor will not be returned to the pool.
 */
public boolean isValid(){
  return this.isValid;
}

Fixed version (ground truth):
/** 
 * Returns true if this Accessor can continue to be used.  This will be false if a communication failure occurred during a call execution.  In the case of an invalid accessor the Accessor will not be returned to the pool.
 */
public boolean isValid(){
  return this.isValid;
}
Program: 68776
Project: 68776
Buggy source:
/** 
 * Used for load balancing and external pooling.
 */
public synchronized void decrementCallCount(){
  int count=getCallCount();
  if (count <= 0) {
    return;
  }
  setCallCount(count - 1);
  if (usesExternalConnectionPooling() && (!isInTransaction()) && (count == 1)) {
    try {
      closeConnection();
    }
 catch (    DatabaseException ignore) {
    }
  }
}

Fixed version (ground truth):
/** 
 * Used for load balancing and external pooling.
 */
public synchronized void decrementCallCount(){
  int count=getCallCount();
  if (count <= 0) {
    return;
  }
  setCallCount(count - 1);
  if (usesExternalConnectionPooling() && (!isInTransaction()) && (currentSession == null || !currentSession.isExclusiveConnectionRequired())&& (count == 1)) {
    try {
      closeConnection();
    }
 catch (    DatabaseException ignore) {
    }
  }
}
Program: 68777
Project: 68777
Buggy source:
/** 
 * Close the accessor's connection. This is used only for external connection pooling when it is intended for the connection to be reconnected in the future.
 */
public void closeConnection(){
  try {
    if (getDatasourceConnection() != null) {
      if (isDatasourceConnected()) {
        closeDatasourceConnection();
      }
      setDatasourceConnection(null);
    }
  }
 catch (  DatabaseException exception) {
    setDatasourceConnection(null);
  }
}

Fixed version (ground truth):
/** 
 * Close the accessor's connection. This is used only for external connection pooling when it is intended for the connection to be reconnected in the future.
 */
public void closeConnection(){
  try {
    if (getDatasourceConnection() != null) {
      if (isDatasourceConnected()) {
        if (currentSession != null) {
          currentSession.preDisconnectExternalConnection(this);
        }
        closeDatasourceConnection();
      }
      setDatasourceConnection(null);
    }
  }
 catch (  DatabaseException exception) {
    setDatasourceConnection(null);
  }
 finally {
    currentSession=null;
  }
}
Program: 68778
Project: 68778
Buggy source:
/** 
 * Begin a transaction on the database. If not using managed transaction begin a local transaction.
 */
public void beginTransaction(AbstractSession session) throws DatabaseException {
  if (usesExternalTransactionController()) {
    setIsInTransaction(true);
    return;
  }
  session.log(SessionLog.FINER,SessionLog.TRANSACTION,"String_Node_Str",(Object[])null,this);
  try {
    session.startOperationProfile(SessionProfiler.TRANSACTION);
    incrementCallCount(session);
    basicBeginTransaction(session);
    setIsInTransaction(true);
  }
  finally {
    decrementCallCount();
    session.endOperationProfile(SessionProfiler.TRANSACTION);
  }
}

Fixed version (ground truth):
/** 
 * Begin a transaction on the database. If not using managed transaction begin a local transaction.
 */
public void beginTransaction(AbstractSession session) throws DatabaseException {
  if (usesExternalTransactionController()) {
    if (session.isExclusiveConnectionRequired() && !isInTransaction() && usesExternalConnectionPooling()) {
      closeConnection();
    }
    setIsInTransaction(true);
    return;
  }
  session.log(SessionLog.FINER,SessionLog.TRANSACTION,"String_Node_Str",(Object[])null,this);
  try {
    session.startOperationProfile(SessionProfiler.TRANSACTION);
    isBeginningTransaction=true;
    incrementCallCount(session);
    basicBeginTransaction(session);
    setIsInTransaction(true);
  }
  finally {
    isBeginningTransaction=false;
    decrementCallCount();
    session.endOperationProfile(SessionProfiler.TRANSACTION);
  }
}
Program: 68779
Project: 68779
Buggy source:
/** 
 * Commit a transaction on the database. If using non-managed transaction commit the local transaction.
 */
public void commitTransaction(AbstractSession session) throws DatabaseException {
  if (usesExternalTransactionController()) {
    if (!session.isSynchronized()) {
      setIsInTransaction(false);
      if (usesExternalConnectionPooling()) {
        closeConnection();
      }
    }
    return;
  }
  session.log(SessionLog.FINER,SessionLog.TRANSACTION,"String_Node_Str",(Object[])null,this);
  try {
    session.startOperationProfile(SessionProfiler.TRANSACTION);
    incrementCallCount(session);
    basicCommitTransaction(session);
    if (sequencingCallback != null) {
      sequencingCallback.afterCommit(this);
    }
    setIsInTransaction(false);
  }
  finally {
    sequencingCallback=null;
    decrementCallCount();
    session.endOperationProfile(SessionProfiler.TRANSACTION);
  }
}

Fixed version (ground truth):
/** 
 * Commit a transaction on the database. If using non-managed transaction commit the local transaction.
 */
public void commitTransaction(AbstractSession session) throws DatabaseException {
  if (usesExternalTransactionController()) {
    if (!session.isSynchronized()) {
      setIsInTransaction(false);
      if (usesExternalConnectionPooling()) {
        currentSession=session;
        closeConnection();
      }
    }
    return;
  }
  session.log(SessionLog.FINER,SessionLog.TRANSACTION,"String_Node_Str",(Object[])null,this);
  try {
    session.startOperationProfile(SessionProfiler.TRANSACTION);
    isCompletingTransaction=true;
    incrementCallCount(session);
    basicCommitTransaction(session);
    if (sequencingCallback != null) {
      sequencingCallback.afterCommit(this);
    }
    setIsInTransaction(false);
  }
  finally {
    isCompletingTransaction=false;
    sequencingCallback=null;
    decrementCallCount();
    session.endOperationProfile(SessionProfiler.TRANSACTION);
  }
}
Program: 68780
Project: 68780
Buggy source:
/** 
 * INTERNAL: This method is extended from the superclass ClientSession.  This class uses only one accessor for all connections and as such does not need a seperate write connection.  The accessor will be used for all database access
 */
public void setWriteConnection(Accessor accessor){
  if (getLogin().shouldUseExternalConnectionPooling()) {
    if (accessor != null) {
      accessor.incrementCallCount(this);
    }
 else {
      this.accessor.decrementCallCount();
    }
  }
  this.accessor=accessor;
}

Fixed version (ground truth):
/** 
 * INTERNAL: This method is extended from the superclass ClientSession.  This class uses only one accessor for all connections and as such does not need a seperate write connection.  The accessor will be used for all database access
 */
public void setWriteConnection(Accessor accessor){
  this.accessor=accessor;
}
Program: 68781
Project: 68781
Buggy source:
/** 
 * INTERNAL: Release the clients connection resource.
 */
public void releaseClientSession(ClientSession clientSession) throws DatabaseException {
  if (clientSession.getConnectionPolicy().isPooled()) {
    ConnectionPool pool=(ConnectionPool)getConnectionPools().get(clientSession.getConnectionPolicy().getPoolName());
    getEventManager().preReleaseConnection(clientSession.getWriteConnection());
    pool.releaseConnection(clientSession.getWriteConnection());
    clientSession.setWriteConnection(null);
  }
 else {
    clientSession.disconnect();
    clientSession.setWriteConnection(null);
    if (this.maxNumberOfNonPooledConnections != NO_MAX) {
synchronized (this) {
        this.numberOfNonPooledConnectionsUsed--;
        notify();
      }
    }
  }
  if (clientSession.getConnectionPolicy().shouldUseExclusiveConnection()) {
    getEventManager().preReleaseExclusiveConnection(clientSession,clientSession.getWriteConnection());
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Release the clients connection resource.
 */
public void releaseClientSession(ClientSession clientSession) throws DatabaseException {
  if (clientSession.getConnectionPolicy().isPooled()) {
    ConnectionPool pool=(ConnectionPool)getConnectionPools().get(clientSession.getConnectionPolicy().getPoolName());
    if (!clientSession.getWriteConnection().usesExternalConnectionPooling()) {
      getEventManager().preReleaseConnection(clientSession.getWriteConnection());
      if (clientSession.getConnectionPolicy().shouldUseExclusiveConnection()) {
        getEventManager().preReleaseExclusiveConnection(clientSession,clientSession.getWriteConnection());
      }
    }
    pool.releaseConnection(clientSession.getWriteConnection());
    clientSession.setWriteConnection(null);
  }
 else {
    if (clientSession.getConnectionPolicy().shouldUseExclusiveConnection()) {
      if (!clientSession.getWriteConnection().usesExternalConnectionPooling()) {
        getEventManager().preReleaseExclusiveConnection(clientSession,clientSession.getWriteConnection());
      }
    }
    clientSession.disconnect();
    clientSession.setWriteConnection(null);
    if (this.maxNumberOfNonPooledConnections != NO_MAX) {
synchronized (this) {
        this.numberOfNonPooledConnectionsUsed--;
        notify();
      }
    }
  }
}
Program: 68782
Project: 68782
Buggy source:
/** 
 * INTERNAL: Allocate the client's connection resource.
 */
public void acquireClientConnection(ClientSession clientSession) throws DatabaseException, ConcurrencyException {
  if (clientSession.getConnectionPolicy().isPooled()) {
    ConnectionPool pool=(ConnectionPool)getConnectionPools().get(clientSession.getConnectionPolicy().getPoolName());
    Accessor connection=pool.acquireConnection();
    clientSession.setWriteConnection(connection);
    getEventManager().postAcquireConnection(connection);
  }
 else {
    if (this.maxNumberOfNonPooledConnections != NO_MAX) {
synchronized (this) {
        while (this.numberOfNonPooledConnectionsUsed >= this.maxNumberOfNonPooledConnections) {
          try {
            wait();
          }
 catch (          InterruptedException exception) {
            throw ConcurrencyException.waitFailureOnServerSession(exception);
          }
        }
        this.numberOfNonPooledConnectionsUsed++;
      }
    }
    clientSession.setWriteConnection(clientSession.getLogin().buildAccessor());
    clientSession.connect();
  }
  if (clientSession.getConnectionPolicy().shouldUseExclusiveConnection()) {
    getEventManager().postAcquireExclusiveConnection(clientSession,clientSession.getWriteConnection());
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Allocate the client's connection resource.
 */
public void acquireClientConnection(ClientSession clientSession) throws DatabaseException, ConcurrencyException {
  if (clientSession.getConnectionPolicy().isPooled()) {
    ConnectionPool pool=(ConnectionPool)getConnectionPools().get(clientSession.getConnectionPolicy().getPoolName());
    Accessor connection=pool.acquireConnection();
    clientSession.setWriteConnection(connection);
    if (!connection.usesExternalConnectionPooling()) {
      getEventManager().postAcquireConnection(connection);
      if (clientSession.getConnectionPolicy().shouldUseExclusiveConnection()) {
        getEventManager().postAcquireExclusiveConnection(clientSession,clientSession.getWriteConnection());
      }
    }
  }
 else {
    if (this.maxNumberOfNonPooledConnections != NO_MAX) {
synchronized (this) {
        while (this.numberOfNonPooledConnectionsUsed >= this.maxNumberOfNonPooledConnections) {
          try {
            wait();
          }
 catch (          InterruptedException exception) {
            throw ConcurrencyException.waitFailureOnServerSession(exception);
          }
        }
        this.numberOfNonPooledConnectionsUsed++;
      }
    }
    clientSession.setWriteConnection(clientSession.getLogin().buildAccessor());
    clientSession.connect();
    if (clientSession.getConnectionPolicy().shouldUseExclusiveConnection()) {
      if (!clientSession.getWriteConnection().usesExternalConnectionPooling()) {
        getEventManager().postAcquireExclusiveConnection(clientSession,clientSession.getWriteConnection());
      }
    }
  }
}
Program: 68783
Project: 68783
Buggy source:
public boolean equals(Object object){
  if (object instanceof Root) {
    Map collection1=any;
    Map collection2=((Root)object).getAny();
    if (collection1 == null && collection2 == null) {
      return true;
    }
 else     if (collection1 == null && collection2.size() == 0) {
      return true;
    }
 else     if (collection2 == null && collection1.size() == 0) {
      return true;
    }
 else     if (collection1 == null && collection2.size() > 0) {
      return false;
    }
 else     if (collection2 == null && collection1.size() > 0) {
      return false;
    }
 else     if (any.size() != ((Root)object).getAny().size()) {
      return false;
    }
 else {
      Iterator values1=any.keySet().iterator();
      Iterator values2=((Root)object).getAny().keySet().iterator();
      while (values1.hasNext()) {
        Object key1=values1.next();
        Object key2=values2.next();
        if (!(key1.equals(key2) && any.get(key1).equals(collection2.get(key2)))) {
          return false;
        }
      }
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean equals(Object object){
  if (object instanceof Root) {
    Map collection1=any;
    Map collection2=((Root)object).getAny();
    if (collection1 == null && collection2 == null) {
      return true;
    }
 else     if (collection1 == null && collection2.size() == 0) {
      return true;
    }
 else     if (collection2 == null && collection1.size() == 0) {
      return true;
    }
 else     if (collection1 == null && collection2.size() > 0) {
      return false;
    }
 else     if (collection2 == null && collection1.size() > 0) {
      return false;
    }
 else     if (any.size() != ((Root)object).getAny().size()) {
      return false;
    }
 else {
      Iterator values1=any.keySet().iterator();
      while (values1.hasNext()) {
        Object key1=values1.next();
        Object value1=collection1.get(key1);
        Object value2=collection2.get(key1);
        if (!(value1.equals(value2))) {
          return false;
        }
      }
      return true;
    }
  }
  return false;
}
Program: 68784
Project: 68784
Buggy source:
private DatabaseMapping buildXMLCompositeCollectionMapping(String mappingUri){
  XMLCompositeCollectionMapping mapping=new XMLCompositeCollectionMapping();
  mapping.setAttributeName(getName());
  String xpath=getQualifiedXPath(mappingUri,false);
  mapping.setXPath(xpath);
  if (getType() != SDOConstants.SDO_DATAOBJECT) {
    QName schemaContext=((SDOType)getType()).getXmlDescriptor().getSchemaReference().getSchemaContextAsQName(((SDOType)getType()).getXmlDescriptor().getNamespaceResolver());
    ((XMLField)mapping.getField()).setLeafElementType(schemaContext);
    mapping.setReferenceClassName(((SDOType)getType()).getImplClassName());
    mapping.setReferenceClass(((SDOType)getType()).getImplClass());
  }
  mapping.useCollectionClass(ListWrapper.class);
  return mapping;
}

Fixed version (ground truth):
private DatabaseMapping buildXMLCompositeCollectionMapping(String mappingUri){
  XMLCompositeCollectionMapping mapping=new XMLCompositeCollectionMapping();
  mapping.setAttributeName(getName());
  String xpath=getQualifiedXPath(mappingUri,false);
  mapping.setXPath(xpath);
  if (getType() != SDOConstants.SDO_DATAOBJECT) {
    QName schemaContext=((SDOType)getType()).getXmlDescriptor().getSchemaReference().getSchemaContextAsQName(((SDOType)getType()).getXmlDescriptor().getNamespaceResolver());
    ((XMLField)mapping.getField()).setLeafElementType(schemaContext);
    mapping.setReferenceClassName(((SDOType)getType()).getImplClassName());
    mapping.setReferenceClass(((SDOType)getType()).getImplClass());
  }
 else {
    if (getXsdType() != null) {
      ((XMLField)mapping.getField()).setLeafElementType(getXsdType());
    }
  }
  mapping.useCollectionClass(ListWrapper.class);
  return mapping;
}
Program: 68786
Project: 68786
Buggy source:
private DatabaseMapping buildXMLCompositeObjectMapping(String mappingUri){
  XMLCompositeObjectMapping mapping=new XMLCompositeObjectMapping();
  mapping.setAttributeName(getName());
  String xpath=getQualifiedXPath(mappingUri,false);
  mapping.setXPath(xpath);
  if (getType() != SDOConstants.SDO_DATAOBJECT) {
    QName schemaContext=((SDOType)getType()).getXmlDescriptor().getSchemaReference().getSchemaContextAsQName(((SDOType)getType()).getXmlDescriptor().getNamespaceResolver());
    ((XMLField)mapping.getField()).setLeafElementType(schemaContext);
    mapping.setReferenceClassName(((SDOType)getType()).getImplClassName());
    mapping.setReferenceClass(((SDOType)getType()).getImplClass());
  }
  if (nullable) {
    setIsSetNillablePolicyOnMapping(mapping,propertyName);
  }
 else {
    setIsSetOptionalPolicyOnMapping(mapping,propertyName);
  }
  return mapping;
}

Fixed version (ground truth):
private DatabaseMapping buildXMLCompositeObjectMapping(String mappingUri){
  XMLCompositeObjectMapping mapping=new XMLCompositeObjectMapping();
  mapping.setAttributeName(getName());
  String xpath=getQualifiedXPath(mappingUri,false);
  mapping.setXPath(xpath);
  if (getType() != SDOConstants.SDO_DATAOBJECT) {
    QName schemaContext=((SDOType)getType()).getXmlDescriptor().getSchemaReference().getSchemaContextAsQName(((SDOType)getType()).getXmlDescriptor().getNamespaceResolver());
    ((XMLField)mapping.getField()).setLeafElementType(schemaContext);
    mapping.setReferenceClassName(((SDOType)getType()).getImplClassName());
    mapping.setReferenceClass(((SDOType)getType()).getImplClass());
  }
 else {
    if (getXsdType() != null) {
      ((XMLField)mapping.getField()).setLeafElementType(getXsdType());
    }
  }
  if (nullable) {
    setIsSetNillablePolicyOnMapping(mapping,propertyName);
  }
 else {
    setIsSetOptionalPolicyOnMapping(mapping,propertyName);
  }
  return mapping;
}
Program: 68789
Project: 68789
Buggy source:
/** 
 * <p>Closes this EntityManager. <p>After invoking this method, all methods on the instance will throw an  {@link IllegalStateException} except for {@link #isOpen}, which will return <code>false</code>   .</p> <p>This should be called when a method is finished with the EntityManager in a bean-managed transaction environment or when executed outside a container. Closing of the EntityManager is handled by the container when using container-managed transactions.</p>
 */
public void close(){
  try {
    verifyOpen();
    isOpen=false;
    factory=null;
    serverSession=null;
    if (extendedPersistenceContext != null) {
      if (checkForTransaction(false) == null) {
        extendedPersistenceContext.clearForClose(false);
      }
 else {
        extendedPersistenceContext.setShouldClearForCloseInsteadOfResume(true);
      }
      extendedPersistenceContext=null;
    }
  }
 catch (  RuntimeException e) {
    this.setRollbackOnly();
    throw e;
  }
}

Fixed version (ground truth):
/** 
 * <p>Closes this EntityManager. <p>After invoking this method, all methods on the instance will throw an  {@link IllegalStateException} except for {@link #isOpen}, which will return <code>false</code>   .</p> <p>This should be called when a method is finished with the EntityManager in a bean-managed transaction environment or when executed outside a container. Closing of the EntityManager is handled by the container when using container-managed transactions.</p>
 */
public void close(){
  try {
    verifyOpen();
    isOpen=false;
    factory=null;
    serverSession=null;
    if (extendedPersistenceContext != null) {
      if (checkForTransaction(false) == null && !extendedPersistenceContext.isSynchronized()) {
        extendedPersistenceContext.clearForClose(false);
      }
 else {
        extendedPersistenceContext.setShouldClearForCloseInsteadOfResume(true);
      }
      extendedPersistenceContext=null;
    }
  }
 catch (  RuntimeException e) {
    this.setRollbackOnly();
    throw e;
  }
}
Program: 68790
Project: 68790
Buggy source:
public CloseConnAfterDatabaseSessionTxnTest(boolean hasExternalTransactionController){
  if (hasExternalTransactionController) {
    setDescription("String_Node_Str");
  }
 else {
    setDescription("String_Node_Str");
  }
  this.hasExternalTransactionController=hasExternalTransactionController;
}

Fixed version (ground truth):
public CloseConnAfterDatabaseSessionTxnTest(){
  setDescription("String_Node_Str");
}
Program: 68791
Project: 68791
Buggy source:
public void setup(){
  org.eclipse.persistence.sessions.Project project=new org.eclipse.persistence.testing.models.employee.relational.EmployeeProject();
  DatasourceLogin clonedLogin=(DatasourceLogin)((org.eclipse.persistence.sessions.DatabaseSession)getSession()).getProject().getDatasourceLogin().clone();
  project.setLogin(clonedLogin);
  clonedLogin.useExternalConnectionPooling();
  if (hasExternalTransactionController) {
    clonedLogin.useExternalTransactionController();
  }
  session=project.createDatabaseSession();
  if (hasExternalTransactionController) {
    session.setExternalTransactionController(new DummyExternalTransactionController());
  }
  session.login();
}

Fixed version (ground truth):
public void setup(){
  org.eclipse.persistence.sessions.Project project=new org.eclipse.persistence.testing.models.employee.relational.EmployeeProject();
  DatasourceLogin clonedLogin=(DatasourceLogin)((org.eclipse.persistence.sessions.DatabaseSession)getSession()).getProject().getDatasourceLogin().clone();
  project.setLogin(clonedLogin);
  clonedLogin.useExternalConnectionPooling();
  session=project.createDatabaseSession();
  session.login();
}
Program: 68792
Project: 68792
Buggy source:
public static TestSuite getConnectionCloseAfterTxnTestSuite(){
  TestSuite suite=new TestSuite();
  suite.setName("String_Node_Str");
  suite.setDescription("String_Node_Str");
  boolean hasExternalTransactionController=true;
  suite.addTest(new CloseConnAfterDatabaseSessionTxnTest(hasExternalTransactionController));
  suite.addTest(new CloseConnAfterDatabaseSessionTxnTest(!hasExternalTransactionController));
  return suite;
}

Fixed version (ground truth):
public static TestSuite getConnectionCloseAfterTxnTestSuite(){
  TestSuite suite=new TestSuite();
  suite.setName("String_Node_Str");
  suite.setDescription("String_Node_Str");
  suite.addTest(new CloseConnAfterDatabaseSessionTxnTest());
  return suite;
}
Program: 68793
Project: 68793
Buggy source:
/** 
 * This should be set to 'false' if a communication failure occurred durring a call execution. In the case of an invalid accessor the Accessor will not be returned to the Pool.
 */
public void setIsValid(boolean isValid);

Fixed version (ground truth):
/** 
 * This should be set to false if a communication failure occurred durring a call execution.   In the case of an invalid accessor the Accessor will not be returned to the pool.
 */
public void setIsValid(boolean isValid);
Program: 68794
Project: 68794
Buggy source:
/** 
 * Allow calling session to be passed.      The calling session is the session who actually invokes commit or rollback transaction,  it is used to determine whether the connection needs to be closed when using external connection pool. The connection with a externalConnectionPool used by synchronized UOW should leave open until  afterCompletion call back; the connection with a externalConnectionPool used by other type of session  should be closed after transaction was finised. Roll back a transaction on the data store.
 */
void rollbackTransaction(AbstractSession session,AbstractSession callingSession) throws DatabaseException ;

Fixed version (ground truth):
/** 
 * Roll back a transaction on the data store.
 */
void rollbackTransaction(AbstractSession session) throws DatabaseException ;
Program: 68795
Project: 68795
Buggy source:
/** 
 * Allow calling session to be passed. The calling session is the session who actually invokes commit or rollback transaction,  it is used to determine whether the connection needs to be closed when using external connection pool. The connection with a externalConnectionPool used by synchronized UOW should leave open until  afterCompletion call back; the connection with a externalConnectionPool used by other type of session  should be closed after transaction was finised. Commit a transaction on the data store 
 */
void commitTransaction(AbstractSession session,AbstractSession callingSession) throws DatabaseException ;

Fixed version (ground truth):
/** 
 * Commit a transaction on the data store.
 */
void commitTransaction(AbstractSession session) throws DatabaseException ;
Program: 68796
Project: 68796
Buggy source:
/** 
 * Allow calling session to be passed The calling session is the session who actually invokes commit or rollback transaction,  it is used to determine whether the connection needs to be closed when using external connection pool. The connection with a externalConnectionPool used by synchronized UOW should leave open until  afterCompletion call back; the connection with a externalConnectionPool used by other type of session  should be closed after transaction was finished. Rollback a transaction on the database. This means toggling the auto-commit option.
 */
public void rollbackTransaction(AbstractSession session,AbstractSession callingSession) throws DatabaseException {
  getActiveBatchWritingMechanism().clear();
  super.rollbackTransaction(session,callingSession);
}

Fixed version (ground truth):
/** 
 * Rollback a transaction on the database. This means toggling the auto-commit option.
 */
public void rollbackTransaction(AbstractSession session) throws DatabaseException {
  getActiveBatchWritingMechanism().clear();
  super.rollbackTransaction(session);
}
Program: 68797
Project: 68797
Buggy source:
/** 
 * Allow calling session to be passed.      The calling session is the session who actually invokes commit or rollback transaction,  it is used to determine whether the connection needs to be closed when using external connection pool. The connection with a externalConnectionPool used by synchronized UOW should leave open until  afterCompletion call back; the connection with a externalConnectionPool used by other type of session  should be closed after transaction was finised. Commit a transaction on the database. First flush any batched statements.
 */
public void commitTransaction(AbstractSession session,AbstractSession callingSession) throws DatabaseException {
  this.writesCompleted(session);
  super.commitTransaction(session,callingSession);
}

Fixed version (ground truth):
/** 
 * Commit a transaction on the database. First flush any batched statements.
 */
public void commitTransaction(AbstractSession session) throws DatabaseException {
  this.writesCompleted(session);
  super.commitTransaction(session);
}
Program: 68801
Project: 68801
Buggy source:
private void endElementProcessText(UnmarshalRecord unmarshalRecord,Object collection,XPathFragment xPathFragment){
  Object value=unmarshalRecord.getStringBuffer().toString().trim();
  unmarshalRecord.resetStringBuffer();
  if (!EMPTY_STRING.equals(value) && xmlAnyCollectionMapping.isMixedContent()) {
    if (!xmlAnyCollectionMapping.usesXMLRoot()) {
      unmarshalRecord.addAttributeValue(this,value);
    }
 else {
      XMLRoot xmlRoot=new XMLRoot();
      xmlRoot.setNamespaceURI(xPathFragment.getNamespaceURI());
      xmlRoot.setLocalName(xPathFragment.getLocalName());
      xmlRoot.setObject(value);
      unmarshalRecord.addAttributeValue(this,xmlRoot);
    }
  }
}

Fixed version (ground truth):
private void endElementProcessText(UnmarshalRecord unmarshalRecord,Object collection,XPathFragment xPathFragment){
  Object value=unmarshalRecord.getStringBuffer().toString().trim();
  unmarshalRecord.resetStringBuffer();
  if (!EMPTY_STRING.equals(value) && xmlAnyCollectionMapping.isMixedContent()) {
    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 (!xmlAnyCollectionMapping.usesXMLRoot()) {
      unmarshalRecord.addAttributeValue(this,value);
    }
 else {
      XMLRoot xmlRoot=new XMLRoot();
      xmlRoot.setNamespaceURI(xPathFragment.getNamespaceURI());
      xmlRoot.setLocalName(xPathFragment.getLocalName());
      xmlRoot.setSchemaType(qname);
      xmlRoot.setObject(value);
      unmarshalRecord.addAttributeValue(this,xmlRoot);
    }
  }
}
Program: 68802
Project: 68802
Buggy source:
private void writeXsiTypeAttribute(XMLDescriptor xmlDescriptor,DOMRecord row,String typeValue){
  String xsiPrefix=null;
  boolean generated=false;
  xsiPrefix=row.getNamespaceResolver().resolveNamespaceURI(XMLConstants.SCHEMA_INSTANCE_URL);
  if (xsiPrefix == null) {
    xsiPrefix=xmlDescriptor.getNonNullNamespaceResolver().generatePrefix(XMLConstants.SCHEMA_INSTANCE_PREFIX);
    generated=true;
    writeXsiNamespace((DOMRecord)row,xmlDescriptor,xsiPrefix);
  }
  XMLField xmlField=(XMLField)xmlDescriptor.buildField("String_Node_Str" + xsiPrefix + "String_Node_Str"+ XMLConstants.SCHEMA_TYPE_ATTRIBUTE);
  if (generated) {
    xmlField.getLastXPathFragment().setGeneratedPrefix(true);
  }
  xmlField.getLastXPathFragment().setNamespaceURI(XMLConstants.SCHEMA_INSTANCE_URL);
  row.add(xmlField,typeValue);
}

Fixed version (ground truth):
private void writeXsiTypeAttribute(XMLDescriptor xmlDescriptor,DOMRecord row,String typeValue){
  String xsiPrefix=null;
  boolean generated=false;
  xsiPrefix=row.getNamespaceResolver().resolveNamespaceURI(XMLConstants.SCHEMA_INSTANCE_URL);
  if (xsiPrefix == null) {
    xsiPrefix=xmlDescriptor.getNonNullNamespaceResolver().generatePrefix(XMLConstants.SCHEMA_INSTANCE_PREFIX);
    generated=true;
    writeXsiNamespace((DOMRecord)row,xsiPrefix);
  }
  XMLField xmlField=(XMLField)xmlDescriptor.buildField("String_Node_Str" + xsiPrefix + "String_Node_Str"+ XMLConstants.SCHEMA_TYPE_ATTRIBUTE);
  if (generated) {
    xmlField.getLastXPathFragment().setGeneratedPrefix(true);
  }
  xmlField.getLastXPathFragment().setNamespaceURI(XMLConstants.SCHEMA_INSTANCE_URL);
  row.add(xmlField,typeValue);
}
Program: 68803
Project: 68803
Buggy source:
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());
  }
}

Fixed version (ground truth):
public void writeExtraNamespaces(List extraNamespaces,XMLRecord xmlRecord){
  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: 68805
Project: 68805
Buggy source:
private void writeXsiNamespace(DOMRecord nestedRecord,XMLDescriptor referenceDescriptor,String xsiPrefix){
  if (nestedRecord.getDOM().getNodeType() == Node.ELEMENT_NODE) {
    ((Element)nestedRecord.getDOM()).setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS + "String_Node_Str" + xsiPrefix,XMLConstants.SCHEMA_INSTANCE_URL);
  }
}

Fixed version (ground truth):
private void writeXsiNamespace(DOMRecord nestedRecord,String xsiPrefix){
  if (nestedRecord.getDOM().getNodeType() == Node.ELEMENT_NODE) {
    ((Element)nestedRecord.getDOM()).setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS + "String_Node_Str" + xsiPrefix,XMLConstants.SCHEMA_INSTANCE_URL);
  }
}