nus-yam/ex-repair huggingface dataset:
Program: 41655
Project: 41655
Buggy source:
/** 
 * @returns a deep copy of this Message Facade including a complete copyof the byte contents of the wrapped message.
 * @throws JMSException if an error occurs while copying this message.
 */
@Override JmsMapMessageFacade copy() throws JMSException ;

Fixed version (ground truth):
/** 
 * @return a deep copy of this Message Facade including a complete copyof the byte contents of the wrapped message.
 * @throws JMSException if an error occurs while copying this message.
 */
@Override JmsMapMessageFacade copy() throws JMSException ;
Program: 41656
Project: 41656
Buggy source:
/** 
 * Remove the mapping for this key from the map if present.  If the value is not present in the map then this method should return without error or modification to the underlying map.
 * @param key the key to be removed from the map if present.
 * @returns the object previously stored in the Map or null if none present.
 */
Object remove(String key);

Fixed version (ground truth):
/** 
 * Remove the mapping for this key from the map if present.  If the value is not present in the map then this method should return without error or modification to the underlying map.
 * @param key the key to be removed from the map if present.
 * @return the object previously stored in the Map or null if none present.
 */
Object remove(String key);
Program: 41657
Project: 41657
Buggy source:
/** 
 * @returns true if the given property exists within the message.
 * @throws JMSException if an error occurs while accessing the Message properties.
 */
boolean propertyExists(String key) throws JMSException ;

Fixed version (ground truth):
/** 
 * @return true if the given property exists within the message.
 * @throws JMSException if an error occurs while accessing the Message properties.
 */
boolean propertyExists(String key) throws JMSException ;
Program: 41658
Project: 41658
Buggy source:
/** 
 * Used to quickly check if a message has been redelivered.
 * @returns true if the message was redelivered, false otherwise.
 */
boolean isRedelivered();

Fixed version (ground truth):
/** 
 * Used to quickly check if a message has been redelivered.
 * @return true if the message was redelivered, false otherwise.
 */
boolean isRedelivered();
Program: 41659
Project: 41659
Buggy source:
/** 
 * @returns a deep copy of this Message Facade including a complete copyof the byte contents of the wrapped message.
 * @throws JMSException if an error occurs while copying this message.
 */
@Override JmsObjectMessageFacade copy() throws JMSException ;

Fixed version (ground truth):
/** 
 * @return a deep copy of this Message Facade including a complete copyof the byte contents of the wrapped message.
 * @throws JMSException if an error occurs while copying this message.
 */
@Override JmsObjectMessageFacade copy() throws JMSException ;
Program: 41660
Project: 41660
Buggy source:
/** 
 * @returns true if the stream contains another element beyond the current.
 */
boolean hasNext();

Fixed version (ground truth):
/** 
 * @return true if the stream contains another element beyond the current.
 */
boolean hasNext();
Program: 41661
Project: 41661
Buggy source:
/** 
 * @returns a deep copy of this Message Facade including a complete copyof the byte contents of the wrapped message.
 */
@Override JmsStreamMessageFacade copy() throws JMSException ;

Fixed version (ground truth):
/** 
 * @return a deep copy of this Message Facade including a complete copyof the byte contents of the wrapped message.
 */
@Override JmsStreamMessageFacade copy() throws JMSException ;
Program: 41662
Project: 41662
Buggy source:
/** 
 * Peek and return the next element in the stream.  If the stream has been fully read then this method should throw a MessageEOFException.  Multiple calls to peek should return the same element.
 * @returns the next value in the stream without removing it.
 * @throws MessageEOFException if end of message stream has been reached.
 */
Object peek() throws MessageEOFException ;

Fixed version (ground truth):
/** 
 * Peek and return the next element in the stream.  If the stream has been fully read then this method should throw a MessageEOFException.  Multiple calls to peek should return the same element.
 * @return the next value in the stream without removing it.
 * @throws MessageEOFException if end of message stream has been reached.
 */
Object peek() throws MessageEOFException ;
Program: 41663
Project: 41663
Buggy source:
/** 
 * Creates a copy of this JmsTextMessageFacade and its underlying provider message instance.
 * @returns a new JmsTextMessageFacade that wraps a duplicate message.
 */
@Override JmsTextMessageFacade copy() throws JMSException ;

Fixed version (ground truth):
/** 
 * Creates a copy of this JmsTextMessageFacade and its underlying provider message instance.
 * @return a new JmsTextMessageFacade that wraps a duplicate message.
 */
@Override JmsTextMessageFacade copy() throws JMSException ;
Program: 41664
Project: 41664
Buggy source:
/** 
 * Gets the Provider specific Message factory for use in the JMS layer when a Session is asked to create a Message type.  The Provider should implement it's own internal JmsMessage core to optimize read / write and marshal operations for the connection.
 * @returns a JmsMessageFactory instance for use by the JMS layer.
 */
JmsMessageFactory getMessageFactory();

Fixed version (ground truth):
/** 
 * Gets the Provider specific Message factory for use in the JMS layer when a Session is asked to create a Message type.  The Provider should implement it's own internal JmsMessage core to optimize read / write and marshal operations for the connection.
 * @return a JmsMessageFactory instance for use by the JMS layer.
 */
JmsMessageFactory getMessageFactory();
Program: 41665
Project: 41665
Buggy source:
/** 
 * Sends the given message
 * @param envelope The envelope that contains the message and it's targeted destination.
 * @param request The AsyncRequest that will be notified on send success or failure.
 * @returns true if the producer had credit to send or false if there was no availablecredit and the send needed to be deferred.
 * @throws IOException if an error occurs sending the message
 * @throws JMSException if an error occurs while preparing the message for send.
 */
public abstract boolean send(JmsOutboundMessageDispatch envelope,AsyncResult request) throws IOException, JMSException ;

Fixed version (ground truth):
/** 
 * Sends the given message
 * @param envelope The envelope that contains the message and it's targeted destination.
 * @param request The AsyncRequest that will be notified on send success or failure.
 * @return true if the producer had credit to send or false if there was no availablecredit and the send needed to be deferred.
 * @throws IOException if an error occurs sending the message
 * @throws JMSException if an error occurs while preparing the message for send.
 */
public abstract boolean send(JmsOutboundMessageDispatch envelope,AsyncResult request) throws IOException, JMSException ;
Program: 41666
Project: 41666
Buggy source:
/** 
 * @returns true if the remote end has sent an error
 */
boolean hasRemoteError();

Fixed version (ground truth):
/** 
 * @return true if the remote end has sent an error
 */
boolean hasRemoteError();
Program: 41667
Project: 41667
Buggy source:
/** 
 * @returns the current size of the URI pool.
 */
public int size(){
  return uris.size();
}

Fixed version (ground truth):
/** 
 * @return the current size of the URI pool.
 */
public int size(){
  return uris.size();
}
Program: 41668
Project: 41668
Buggy source:
/** 
 * @returns true if the URI pool is empty.
 */
public boolean isEmpty(){
  return uris.isEmpty();
}

Fixed version (ground truth):
/** 
 * @return true if the URI pool is empty.
 */
public boolean isEmpty(){
  return uris.isEmpty();
}
Program: 41669
Project: 41669
Buggy source:
/** 
 * Gets the currently set TransportListener instance
 * @returns the current TransportListener or null if none set.
 */
TransportListener getTransportListener();

Fixed version (ground truth):
/** 
 * Gets the currently set TransportListener instance
 * @return the current TransportListener or null if none set.
 */
TransportListener getTransportListener();
Program: 41670
Project: 41670
Buggy source:
/** 
 * @returns the URI of the remote peer that this Transport connects to.
 */
URI getRemoteLocation();

Fixed version (ground truth):
/** 
 * @return the URI of the remote peer that this Transport connects to.
 */
URI getRemoteLocation();
Program: 41671
Project: 41671
Buggy source:
/** 
 * @returns the TransportOptions instance that holds the configuration for this Transport.
 */
TransportOptions getTransportOptions();

Fixed version (ground truth):
/** 
 * @return the TransportOptions instance that holds the configuration for this Transport.
 */
TransportOptions getTransportOptions();
Program: 41672
Project: 41672
Buggy source:
@Test(timeout=10000,expected=UnsupportedOperationException.class) public void testSetDesinationOnAnonymousProducer() throws Exception {
  JmsMessageProducer producer=(JmsMessageProducer)session.createProducer(null);
  producer.setDestination(topic);
}

Fixed version (ground truth):
@Test(timeout=10000) public void testSetDesinationOnAnonymousProducer() throws Exception {
  JmsMessageProducer producer=(JmsMessageProducer)session.createProducer(null);
  producer.setDestination(topic);
}
Program: 41673
Project: 41673
Buggy source:
/** 
 * Sets the prefix used by auto-generated JMS Client ID values which are used if the JMS client does not explicitly specify on.
 * @param clientIDPrefix
 */
public synchronized void setClientIDPrefix(String clientIDPrefix){
  this.clientIDPrefix=clientIDPrefix;
}

Fixed version (ground truth):
/** 
 * Sets the prefix used by auto-generated JMS Client ID values which are used if the JMS client does not explicitly specify one.
 * @param clientIDPrefix the value to use as a prefix on auto-generated client IDs.
 */
public synchronized void setClientIDPrefix(String clientIDPrefix){
  this.clientIDPrefix=clientIDPrefix;
}
Program: 41674
Project: 41674
Buggy source:
public synchronized String getClientIDPrefix(){
  return clientIDPrefix;
}

Fixed version (ground truth):
/** 
 * @return the currently configured client ID prefix for auto-generated client IDs.
 */
public synchronized String getClientIDPrefix(){
  return clientIDPrefix;
}
Program: 41675
Project: 41675
Buggy source:
protected void readMessagesOnBroker(int count) throws Exception {
  Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
  Queue queue=session.createQueue(getDestinationName());
  MessageConsumer consumer=session.createConsumer(queue);
  for (int i=0; i < MESSAGE_COUNT; ++i) {
    Message message=consumer.receive(RECEIVE_TIMEOUT);
    assertNotNull(message);
    LOG.info("String_Node_Str",i,message.getClass().getSimpleName());
    String gid=message.getStringProperty("String_Node_Str");
    String seq=message.getStringProperty("String_Node_Str");
    LOG.info("String_Node_Str",gid);
    LOG.info("String_Node_Str",seq);
  }
}

Fixed version (ground truth):
protected void readMessagesOnBroker(int count) throws Exception {
  Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
  Queue queue=session.createQueue(getDestinationName());
  MessageConsumer consumer=session.createConsumer(queue);
  for (int i=0; i < MESSAGE_COUNT; ++i) {
    Message message=consumer.receive(RECEIVE_TIMEOUT);
    assertNotNull(message);
    LOG.info("String_Node_Str",i,message.getClass().getSimpleName());
    String gid=message.getStringProperty("String_Node_Str");
    String seq=message.getStringProperty("String_Node_Str");
    LOG.info("String_Node_Str",gid);
    LOG.info("String_Node_Str",seq);
  }
  consumer.close();
}
Program: 41676
Project: 41676
Buggy source:
protected void sendMessagesToBroker(int count) throws Exception {
  Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
  Queue queue=session.createQueue(getDestinationName());
  MessageProducer producer=session.createProducer(queue);
  byte[] buffer=new byte[MESSAGE_SIZE];
  for (count=0; count < MESSAGE_SIZE; count++) {
    String s=String.valueOf(count % 10);
    Character c=s.charAt(0);
    int value=c.charValue();
    buffer[count]=(byte)value;
  }
  LOG.debug("String_Node_Str",MESSAGE_COUNT,queue);
  for (int i=1; i <= MESSAGE_COUNT; i++) {
    BytesMessage message=session.createBytesMessage();
    message.setJMSDeliveryMode(DeliveryMode.PERSISTENT);
    message.setStringProperty("String_Node_Str",JMSX_GROUP_ID);
    message.setIntProperty("String_Node_Str",i);
    message.writeBytes(buffer);
    producer.send(message);
  }
  producer.close();
}

Fixed version (ground truth):
protected void sendMessagesToBroker(int count) throws Exception {
  Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
  Queue queue=session.createQueue(getDestinationName());
  MessageProducer producer=session.createProducer(queue);
  byte[] buffer=new byte[MESSAGE_SIZE];
  for (count=0; count < MESSAGE_SIZE; count++) {
    String s=String.valueOf(count % 10);
    Character c=s.charAt(0);
    int value=c.charValue();
    buffer[count]=(byte)value;
  }
  LOG.debug("String_Node_Str",MESSAGE_COUNT,queue);
  for (int i=1; i <= MESSAGE_COUNT; i++) {
    BytesMessage message=session.createBytesMessage();
    message.setJMSDeliveryMode(DeliveryMode.PERSISTENT);
    message.setStringProperty("String_Node_Str",JMSX_GROUP_ID);
    message.setIntProperty("String_Node_Str",++sequenceCount);
    message.writeBytes(buffer);
    producer.send(message);
  }
  producer.close();
}
Program: 41677
Project: 41677
Buggy source:
@Test public void testGroupSeqIsNeverLost() throws Exception {
  connection=createAmqpConnection();
  sendMessagesToBroker(MESSAGE_COUNT);
  readMessagesOnBroker(MESSAGE_COUNT);
  sendMessagesToBroker(MESSAGE_COUNT);
  readMessagesOnBroker(MESSAGE_COUNT);
}

Fixed version (ground truth):
@Test public void testGroupSeqIsNeverLost() throws Exception {
  connection=createAmqpConnection();
  connection.start();
  sendMessagesToBroker(MESSAGE_COUNT);
  readMessagesOnBroker(MESSAGE_COUNT);
  sendMessagesToBroker(MESSAGE_COUNT);
  readMessagesOnBroker(MESSAGE_COUNT);
}
Program: 41678
Project: 41678
Buggy source:
@Override public void onMessage(Message message){
  try {
    int msgNumProperty=message.getIntProperty(MESSAGE_NUMBER);
    if (complete) {
      LOG.info("String_Node_Str" + msgNumProperty);
      return;
    }
    if (msgNumProperty == 1) {
      if (!seenFirstMessage) {
        LOG.info("String_Node_Str");
        seenFirstMessage=true;
      }
 else {
        LOG.error("String_Node_Str");
        complete(true);
      }
    }
 else     if (msgNumProperty == 2) {
      if (!seenSecondMessage) {
        seenSecondMessage=true;
        LOG.info("String_Node_Str");
        session.recover();
      }
 else {
        LOG.info("String_Node_Str");
        seenSecondMessageTwice=true;
        if (message.getJMSRedelivered()) {
          LOG.info("String_Node_Str");
        }
 else {
          LOG.error("String_Node_Str");
          complete(true);
        }
      }
    }
 else {
      if (msgNumProperty != 3) {
        LOG.error("String_Node_Str" + msgNumProperty);
        complete(true);
      }
      if (!seenFirstMessage && !seenSecondMessageTwice) {
        LOG.error("String_Node_Str");
        complete(true);
      }
      if (message.getJMSRedelivered()) {
        LOG.error("String_Node_Str");
        complete(true);
      }
 else {
        LOG.info("String_Node_Str");
        complete(false);
      }
    }
  }
 catch (  JMSException e) {
    LOG.error("String_Node_Str",e);
    complete(true);
  }
}

Fixed version (ground truth):
@Override public void onMessage(Message message){
  try {
    int msgNumProperty=message.getIntProperty(MESSAGE_NUMBER);
    if (complete) {
      LOG.info("String_Node_Str" + msgNumProperty);
      return;
    }
    if (msgNumProperty == 1) {
      if (!seenFirstMessage) {
        LOG.info("String_Node_Str");
        seenFirstMessage=true;
      }
 else {
        LOG.error("String_Node_Str");
        complete(true);
      }
    }
 else     if (msgNumProperty == 2) {
      if (!seenSecondMessage) {
        seenSecondMessage=true;
        LOG.info("String_Node_Str");
        session.recover();
      }
 else {
        LOG.info("String_Node_Str");
        seenSecondMessageTwice=true;
        if (message.getJMSRedelivered()) {
          LOG.info("String_Node_Str");
        }
 else {
          LOG.error("String_Node_Str");
          complete(true);
        }
      }
    }
 else {
      if (msgNumProperty != 3) {
        LOG.error("String_Node_Str" + msgNumProperty);
        complete(true);
        return;
      }
      if (!(seenFirstMessage && seenSecondMessageTwice)) {
        LOG.error("String_Node_Str");
        complete(true);
        return;
      }
      LOG.info("String_Node_Str");
      if (message.getJMSRedelivered()) {
        LOG.error("String_Node_Str");
        complete(true);
      }
 else {
        LOG.info("String_Node_Str");
        complete(false);
      }
    }
  }
 catch (  JMSException e) {
    LOG.error("String_Node_Str",e);
    complete(true);
  }
}
Program: 41679
Project: 41679
Buggy source:
/** 
 * Test use of session recovery while using a client-ack session and a message listener. Calling recover should result in delivery of the previous messages again, followed by those that would have been received afterwards. Send three messages. Consume the first message, then recover on the second message and expect to see both again, ensure the third message is not seen until after this.
 * @throws Exception
 */
@Test(timeout=60000) public void testRecoverInOnMessage() throws Exception {
  connection=createAmqpConnection();
  Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
  assertNotNull(session);
  Queue queue=session.createQueue(name.getMethodName());
  MessageConsumer consumer=session.createConsumer(queue);
  sendMessages(connection,queue,3);
  CountDownLatch latch=new CountDownLatch(1);
  ClientAckRecoverMsgListener listener=new ClientAckRecoverMsgListener(latch,session);
  consumer.setMessageListener(listener);
  connection.start();
  assertTrue("String_Node_Str",latch.await(10,TimeUnit.SECONDS));
  assertFalse("String_Node_Str",listener.getFailed());
}

Fixed version (ground truth):
/** 
 * Test use of session recovery while using a client-ack session and a message listener. Calling recover should result in delivery of the previous messages again, followed by those that would have been received afterwards. Send three messages. Consume the first message, then recover on the second message and expect to see both again, ensure the third message is not seen until after this.
 * @throws Exception
 */
@Test(timeout=60000) public void testRecoverInOnMessage() throws Exception {
  connection=createAmqpConnection();
  Session session=connection.createSession(false,Session.CLIENT_ACKNOWLEDGE);
  assertNotNull(session);
  Queue queue=session.createQueue(name.getMethodName());
  MessageConsumer consumer=session.createConsumer(queue);
  sendMessages(connection,queue,3);
  CountDownLatch latch=new CountDownLatch(1);
  ClientAckRecoverMsgListener listener=new ClientAckRecoverMsgListener(latch,session);
  consumer.setMessageListener(listener);
  connection.start();
  assertTrue("String_Node_Str",latch.await(10,TimeUnit.SECONDS));
  assertFalse("String_Node_Str",listener.getFailed());
}
Program: 41681
Project: 41681
Buggy source:
@Test(timeout=600000) public void testRecoverInOnMessage() throws Exception {
  connection=createAmqpConnection();
  Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
  assertNotNull(session);
  Queue queue=session.createQueue(name.getMethodName());
  MessageConsumer consumer=session.createConsumer(queue);
  sendMessages(connection,queue,2);
  CountDownLatch latch=new CountDownLatch(1);
  AutoAckRecoverMsgListener listener=new AutoAckRecoverMsgListener(latch,session);
  consumer.setMessageListener(listener);
  connection.start();
  assertTrue("String_Node_Str",latch.await(500,TimeUnit.SECONDS));
  assertFalse("String_Node_Str",listener.getFailed());
}

Fixed version (ground truth):
@Test(timeout=60000) public void testRecoverInOnMessage() throws Exception {
  connection=createAmqpConnection();
  Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
  assertNotNull(session);
  Queue queue=session.createQueue(name.getMethodName());
  MessageConsumer consumer=session.createConsumer(queue);
  sendMessages(connection,queue,2);
  CountDownLatch latch=new CountDownLatch(1);
  AutoAckRecoverMsgListener listener=new AutoAckRecoverMsgListener(latch,session);
  consumer.setMessageListener(listener);
  connection.start();
  assertTrue("String_Node_Str",latch.await(10,TimeUnit.SECONDS));
  assertFalse("String_Node_Str",listener.getFailed());
}
Program: 41682
Project: 41682
Buggy source:
/** 
 * @param queue
 * @return QueueSender
 * @throws JMSException
 * @see javax.jms.QueueSession#createSender(javax.jms.Queue)
 */
@Override public QueueSender createSender(Queue queue) throws JMSException {
  checkClosed();
  JmsDestination dest=JmsMessageTransformation.transformDestination(connection,queue);
  JmsQueueSender result=new JmsQueueSender(getNextProducerId(),this,dest);
  return result;
}

Fixed version (ground truth):
/** 
 * @param queue
 * @return QueueSender
 * @throws JMSException
 * @see javax.jms.QueueSession#createSender(javax.jms.Queue)
 */
@Override public QueueSender createSender(Queue queue) throws JMSException {
  checkClosed();
  JmsDestination dest=JmsMessageTransformation.transformDestination(connection,queue);
  JmsQueueSender result=new JmsQueueSender(getNextProducerId(),this,dest);
  add(result);
  return result;
}
Program: 41683
Project: 41683
Buggy source:
/** 
 * Searches for a MechanismFactory by using the scheme from the given name. The search first checks the local cache of mechanism factories before moving on to search in the classpath.
 * @param name The name of the authentication mechanism to search for..
 * @return a mechanism factory instance matching the URI's scheme.
 * @throws IOException if an error occurs while locating the factory.
 */
protected static MechanismFactory findMechanismFactory(String name) throws IOException {
  if (name == null || name.isEmpty()) {
    throw new IOException("String_Node_Str" + name + "String_Node_Str");
  }
  MechanismFactory factory=null;
  try {
    factory=MECHANISM_FACTORY_FINDER.newInstance(name);
  }
 catch (  Throwable e) {
    throw new IOException("String_Node_Str" + name + "String_Node_Str",e);
  }
  return factory;
}

Fixed version (ground truth):
/** 
 * Searches for a MechanismFactory by using the scheme from the given name. The search first checks the local cache of mechanism factories before moving on to search in the classpath.
 * @param name The name of the authentication mechanism to search for..
 * @return a mechanism factory instance matching the URI's scheme.
 * @throws IOException if an error occurs while locating the factory.
 */
protected static MechanismFactory findMechanismFactory(String name) throws IOException {
  if (name == null || name.isEmpty()) {
    throw new IOException("String_Node_Str");
  }
  MechanismFactory factory=null;
  try {
    factory=MECHANISM_FACTORY_FINDER.newInstance(name);
  }
 catch (  Throwable e) {
    throw new IOException("String_Node_Str" + name + "String_Node_Str",e);
  }
  return factory;
}
Program: 41684
Project: 41684
Buggy source:
/** 
 * Searches for a DiscoveryAgentFactory by using the scheme from the given URI. The search first checks the local cache of discovery agent factories before moving on to search in the classpath.
 * @param location The URI whose scheme will be used to locate a DiscoveryAgentFactory.
 * @return a DiscoveryAgentFactory instance matching the URI's scheme.
 * @throws IOException if an error occurs while locating the factory.
 */
protected static DiscoveryAgentFactory findAgentFactory(URI location) throws IOException {
  String scheme=location.getScheme();
  if (scheme == null) {
    throw new IOException("String_Node_Str" + location + "String_Node_Str");
  }
  DiscoveryAgentFactory factory=null;
  if (factory == null) {
    try {
      factory=AGENT_FACTORY_FINDER.newInstance(scheme);
    }
 catch (    Throwable e) {
      throw new IOException("String_Node_Str" + scheme + "String_Node_Str",e);
    }
  }
  return factory;
}

Fixed version (ground truth):
/** 
 * Searches for a DiscoveryAgentFactory by using the scheme from the given URI. The search first checks the local cache of discovery agent factories before moving on to search in the classpath.
 * @param location The URI whose scheme will be used to locate a DiscoveryAgentFactory.
 * @return a DiscoveryAgentFactory instance matching the URI's scheme.
 * @throws IOException if an error occurs while locating the factory.
 */
protected static DiscoveryAgentFactory findAgentFactory(URI location) throws IOException {
  String scheme=location.getScheme();
  if (scheme == null || scheme.isEmpty()) {
    throw new IOException("String_Node_Str");
  }
  DiscoveryAgentFactory factory=null;
  if (factory == null) {
    try {
      factory=AGENT_FACTORY_FINDER.newInstance(scheme);
    }
 catch (    Throwable e) {
      throw new IOException("String_Node_Str" + scheme + "String_Node_Str",e);
    }
  }
  return factory;
}
Program: 41689
Project: 41689
Buggy source:
@Test(timeout=10000) public void testCreateAndCloseConnection() throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(IntegrationTestFixture.PORT)){
    Connection connection=testFixture.establishConnecton(testPeer);
    testPeer.expectClose();
    connection.close();
  }
 }

Fixed version (ground truth):
@Test(timeout=10000) public void testCreateAndCloseConnection() throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(testFixture.getAvailablePort())){
    Connection connection=testFixture.establishConnecton(testPeer);
    testPeer.expectClose();
    connection.close();
  }
 }
Program: 41690
Project: 41690
Buggy source:
@Test(timeout=5000) public void testCreateTransactedSession() throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(IntegrationTestFixture.PORT)){
    Connection connection=testFixture.establishConnecton(testPeer);
    testPeer.expectBegin(true);
    CoordinatorMatcher txCoordinatorMatcher=new CoordinatorMatcher();
    txCoordinatorMatcher.withCapabilities(arrayContaining(TxnCapability.LOCAL_TXN));
    testPeer.expectSenderAttach(txCoordinatorMatcher,false,false);
    Session session=connection.createSession(true,Session.SESSION_TRANSACTED);
    assertNotNull("String_Node_Str",session);
  }
 }

Fixed version (ground truth):
@Test(timeout=5000) public void testCreateTransactedSession() throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(testFixture.getAvailablePort())){
    Connection connection=testFixture.establishConnecton(testPeer);
    testPeer.expectBegin(true);
    CoordinatorMatcher txCoordinatorMatcher=new CoordinatorMatcher();
    txCoordinatorMatcher.withCapabilities(arrayContaining(TxnCapability.LOCAL_TXN));
    testPeer.expectSenderAttach(txCoordinatorMatcher,false,false);
    Session session=connection.createSession(true,Session.SESSION_TRANSACTED);
    assertNotNull("String_Node_Str",session);
  }
 }
Program: 41691
Project: 41691
Buggy source:
@Test(timeout=5000) public void testConnectionMetaDataVersion() throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(IntegrationTestFixture.PORT)){
    Connection connection=testFixture.establishConnecton(testPeer);
    ConnectionMetaData meta=connection.getMetaData();
    assertTrue("String_Node_Str",meta.getProviderMajorVersion() != 0);
  }
 }

Fixed version (ground truth):
@Test(timeout=5000) public void testConnectionMetaDataVersion() throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(testFixture.getAvailablePort())){
    Connection connection=testFixture.establishConnecton(testPeer);
    ConnectionMetaData meta=connection.getMetaData();
    assertTrue("String_Node_Str",meta.getProviderMajorVersion() != 0);
  }
 }
Program: 41692
Project: 41692
Buggy source:
@Test(timeout=10000) public void testCreateAutoAckSession() throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(IntegrationTestFixture.PORT)){
    Connection connection=testFixture.establishConnecton(testPeer);
    testPeer.expectBegin(true);
    Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
    assertNotNull("String_Node_Str",session);
  }
 }

Fixed version (ground truth):
@Test(timeout=10000) public void testCreateAutoAckSession() throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(testFixture.getAvailablePort())){
    Connection connection=testFixture.establishConnecton(testPeer);
    testPeer.expectBegin(true);
    Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
    assertNotNull("String_Node_Str",session);
  }
 }
Program: 41693
Project: 41693
Buggy source:
Connection establishConnecton(TestAmqpPeer testPeer,String optionsString,Symbol[] serverCapabilities,Map<Symbol,Object> serverProperties) throws JMSException {
  testPeer.expectPlainConnect("String_Node_Str","String_Node_Str",serverCapabilities,serverProperties);
  testPeer.expectBegin(true);
  final String baseURI="String_Node_Str" + PORT;
  String brokerURI=baseURI;
  if (optionsString != null) {
    brokerURI=baseURI + optionsString;
  }
  ConnectionFactory factory=new JmsConnectionFactory(brokerURI);
  Connection connection=factory.createConnection("String_Node_Str","String_Node_Str");
  connection.setClientID("String_Node_Str");
  assertNull(testPeer.getThrowable());
  return connection;
}

Fixed version (ground truth):
Connection establishConnecton(TestAmqpPeer testPeer,String optionsString,Symbol[] serverCapabilities,Map<Symbol,Object> serverProperties) throws JMSException {
  testPeer.expectPlainConnect("String_Node_Str","String_Node_Str",serverCapabilities,serverProperties);
  testPeer.expectBegin(true);
  final String baseURI="String_Node_Str" + getAvailablePort();
  String brokerURI=baseURI;
  if (optionsString != null) {
    brokerURI=baseURI + optionsString;
  }
  ConnectionFactory factory=new JmsConnectionFactory(brokerURI);
  Connection connection=factory.createConnection("String_Node_Str","String_Node_Str");
  connection.setClientID("String_Node_Str");
  assertNull(testPeer.getThrowable());
  return connection;
}
Program: 41702
Project: 41702
Buggy source:
private void receivedMessageWithMessageIdTestImpl(Object underlyingAmqpMessageId) throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(IntegrationTestFixture.PORT)){
    Connection connection=testFixture.establishConnecton(testPeer);
    connection.start();
    testPeer.expectBegin(true);
    Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
    Queue queue=session.createQueue("String_Node_Str");
    PropertiesDescribedType props=new PropertiesDescribedType();
    props.setMessageId(underlyingAmqpMessageId);
    DescribedType amqpValueNullContent=new AmqpValueDescribedType(null);
    testPeer.expectReceiverAttach();
    testPeer.expectLinkFlowRespondWithTransfer(null,null,props,null,amqpValueNullContent);
    testPeer.expectDispositionThatIsAcceptedAndSettled();
    MessageConsumer messageConsumer=session.createConsumer(queue);
    Message receivedMessage=messageConsumer.receive(1000);
    testPeer.waitForAllHandlersToComplete(3000);
    assertNotNull(receivedMessage);
    String expectedBaseIdString=new AmqpMessageIdHelper().toBaseMessageIdString(underlyingAmqpMessageId);
    assertEquals("String_Node_Str" + expectedBaseIdString,receivedMessage.getJMSMessageID());
  }
 }

Fixed version (ground truth):
private void receivedMessageWithMessageIdTestImpl(Object underlyingAmqpMessageId) throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(testFixture.getAvailablePort())){
    Connection connection=testFixture.establishConnecton(testPeer);
    connection.start();
    testPeer.expectBegin(true);
    Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
    Queue queue=session.createQueue("String_Node_Str");
    PropertiesDescribedType props=new PropertiesDescribedType();
    props.setMessageId(underlyingAmqpMessageId);
    DescribedType amqpValueNullContent=new AmqpValueDescribedType(null);
    testPeer.expectReceiverAttach();
    testPeer.expectLinkFlowRespondWithTransfer(null,null,props,null,amqpValueNullContent);
    testPeer.expectDispositionThatIsAcceptedAndSettled();
    MessageConsumer messageConsumer=session.createConsumer(queue);
    Message receivedMessage=messageConsumer.receive(1000);
    testPeer.waitForAllHandlersToComplete(3000);
    assertNotNull(receivedMessage);
    String expectedBaseIdString=new AmqpMessageIdHelper().toBaseMessageIdString(underlyingAmqpMessageId);
    assertEquals("String_Node_Str" + expectedBaseIdString,receivedMessage.getJMSMessageID());
  }
 }
Program: 41709
Project: 41709
Buggy source:
/** 
 * Tests that lack of the absolute-expiry-time and ttl fields on a message results in it returning 0 for for JMSExpiration
 */
@Test(timeout=2000) public void testReceivedMessageFromQueueWithNoAbsoluteExpiryOrTtlReturnsJMSExpirationZero() throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(IntegrationTestFixture.PORT)){
    Connection connection=testFixture.establishConnecton(testPeer);
    connection.start();
    testPeer.expectBegin(true);
    Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
    Queue queue=session.createQueue("String_Node_Str");
    PropertiesDescribedType props=new PropertiesDescribedType();
    props.setMessageId("String_Node_Str");
    DescribedType amqpValueNullContent=new AmqpValueDescribedType(null);
    testPeer.expectReceiverAttach();
    testPeer.expectLinkFlowRespondWithTransfer(null,null,props,null,amqpValueNullContent);
    testPeer.expectDispositionThatIsAcceptedAndSettled();
    MessageConsumer messageConsumer=session.createConsumer(queue);
    Message receivedMessage=messageConsumer.receive(1000);
    testPeer.waitForAllHandlersToComplete(3000);
    assertNotNull(receivedMessage);
    assertEquals(0L,receivedMessage.getJMSExpiration());
  }
 }

Fixed version (ground truth):
/** 
 * Tests that lack of the absolute-expiry-time and ttl fields on a message results in it returning 0 for for JMSExpiration
 */
@Test(timeout=2000) public void testReceivedMessageFromQueueWithNoAbsoluteExpiryOrTtlReturnsJMSExpirationZero() throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(testFixture.getAvailablePort())){
    Connection connection=testFixture.establishConnecton(testPeer);
    connection.start();
    testPeer.expectBegin(true);
    Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
    Queue queue=session.createQueue("String_Node_Str");
    PropertiesDescribedType props=new PropertiesDescribedType();
    props.setMessageId("String_Node_Str");
    DescribedType amqpValueNullContent=new AmqpValueDescribedType(null);
    testPeer.expectReceiverAttach();
    testPeer.expectLinkFlowRespondWithTransfer(null,null,props,null,amqpValueNullContent);
    testPeer.expectDispositionThatIsAcceptedAndSettled();
    MessageConsumer messageConsumer=session.createConsumer(queue);
    Message receivedMessage=messageConsumer.receive(1000);
    testPeer.waitForAllHandlersToComplete(3000);
    assertNotNull(receivedMessage);
    assertEquals(0L,receivedMessage.getJMSExpiration());
  }
 }
Program: 41711
Project: 41711
Buggy source:
/** 
 * Tests that setting a non-zero value in the absolute-expiry-time field on a message results in it returning this value for JMSExpiration
 */
@Test(timeout=2000) public void testReceivedMessageFromQueueWithAbsoluteExpiryReturnsJMSExpirationNonZero() throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(IntegrationTestFixture.PORT)){
    Connection connection=testFixture.establishConnecton(testPeer);
    connection.start();
    testPeer.expectBegin(true);
    Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
    Queue queue=session.createQueue("String_Node_Str");
    long timestamp=System.currentTimeMillis();
    PropertiesDescribedType props=new PropertiesDescribedType();
    props.setAbsoluteExpiryTime(new Date(timestamp));
    props.setMessageId("String_Node_Str");
    DescribedType amqpValueNullContent=new AmqpValueDescribedType(null);
    testPeer.expectReceiverAttach();
    testPeer.expectLinkFlowRespondWithTransfer(null,null,props,null,amqpValueNullContent);
    testPeer.expectDispositionThatIsAcceptedAndSettled();
    MessageConsumer messageConsumer=session.createConsumer(queue);
    Message receivedMessage=messageConsumer.receive(1000);
    testPeer.waitForAllHandlersToComplete(3000);
    assertNotNull(receivedMessage);
    assertEquals(timestamp,receivedMessage.getJMSExpiration());
  }
 }

Fixed version (ground truth):
/** 
 * Tests that setting a non-zero value in the absolute-expiry-time field on a message results in it returning this value for JMSExpiration
 */
@Test(timeout=2000) public void testReceivedMessageFromQueueWithAbsoluteExpiryReturnsJMSExpirationNonZero() throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(testFixture.getAvailablePort())){
    Connection connection=testFixture.establishConnecton(testPeer);
    connection.start();
    testPeer.expectBegin(true);
    Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
    Queue queue=session.createQueue("String_Node_Str");
    long timestamp=System.currentTimeMillis();
    PropertiesDescribedType props=new PropertiesDescribedType();
    props.setAbsoluteExpiryTime(new Date(timestamp));
    props.setMessageId("String_Node_Str");
    DescribedType amqpValueNullContent=new AmqpValueDescribedType(null);
    testPeer.expectReceiverAttach();
    testPeer.expectLinkFlowRespondWithTransfer(null,null,props,null,amqpValueNullContent);
    testPeer.expectDispositionThatIsAcceptedAndSettled();
    MessageConsumer messageConsumer=session.createConsumer(queue);
    Message receivedMessage=messageConsumer.receive(1000);
    testPeer.waitForAllHandlersToComplete(3000);
    assertNotNull(receivedMessage);
    assertEquals(timestamp,receivedMessage.getJMSExpiration());
  }
 }
Program: 41713
Project: 41713
Buggy source:
/** 
 * Tests that lack of the reply-to set on a message results in it returning null for JMSReplyTo and not the consumer destination as happens for JMSDestination.
 */
@Test(timeout=2000) public void testReceivedMessageFromQueueWithNoReplyToReturnsNull() throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(IntegrationTestFixture.PORT)){
    Connection connection=testFixture.establishConnecton(testPeer);
    connection.start();
    testPeer.expectBegin(true);
    Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
    Queue queue=session.createQueue("String_Node_Str");
    PropertiesDescribedType props=new PropertiesDescribedType();
    props.setMessageId("String_Node_Str");
    DescribedType amqpValueNullContent=new AmqpValueDescribedType(null);
    testPeer.expectReceiverAttach();
    testPeer.expectLinkFlowRespondWithTransfer(null,null,props,null,amqpValueNullContent);
    testPeer.expectDispositionThatIsAcceptedAndSettled();
    MessageConsumer messageConsumer=session.createConsumer(queue);
    Message receivedMessage=messageConsumer.receive(1000);
    testPeer.waitForAllHandlersToComplete(3000);
    assertNotNull(receivedMessage);
    assertNull(receivedMessage.getJMSReplyTo());
  }
 }

Fixed version (ground truth):
/** 
 * Tests that lack of the reply-to set on a message results in it returning null for JMSReplyTo and not the consumer destination as happens for JMSDestination.
 */
@Test(timeout=2000) public void testReceivedMessageFromQueueWithNoReplyToReturnsNull() throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(testFixture.getAvailablePort())){
    Connection connection=testFixture.establishConnecton(testPeer);
    connection.start();
    testPeer.expectBegin(true);
    Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
    Queue queue=session.createQueue("String_Node_Str");
    PropertiesDescribedType props=new PropertiesDescribedType();
    props.setMessageId("String_Node_Str");
    DescribedType amqpValueNullContent=new AmqpValueDescribedType(null);
    testPeer.expectReceiverAttach();
    testPeer.expectLinkFlowRespondWithTransfer(null,null,props,null,amqpValueNullContent);
    testPeer.expectDispositionThatIsAcceptedAndSettled();
    MessageConsumer messageConsumer=session.createConsumer(queue);
    Message receivedMessage=messageConsumer.receive(1000);
    testPeer.waitForAllHandlersToComplete(3000);
    assertNotNull(receivedMessage);
    assertNull(receivedMessage.getJMSReplyTo());
  }
 }
Program: 41716
Project: 41716
Buggy source:
@Test(timeout=2000) public void testReceiveMessageWithoutMessageId() throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(IntegrationTestFixture.PORT)){
    Connection connection=testFixture.establishConnecton(testPeer);
    connection.start();
    testPeer.expectBegin(true);
    Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
    Queue queue=session.createQueue("String_Node_Str");
    DescribedType amqpValueNullContent=new AmqpValueDescribedType(null);
    testPeer.expectReceiverAttach();
    testPeer.expectLinkFlowRespondWithTransfer(null,null,null,null,amqpValueNullContent);
    testPeer.expectDispositionThatIsAcceptedAndSettled();
    MessageConsumer messageConsumer=session.createConsumer(queue);
    Message receivedMessage=messageConsumer.receive(1000);
    testPeer.waitForAllHandlersToComplete(2000);
    assertNull(receivedMessage.getJMSMessageID());
  }
 }

Fixed version (ground truth):
@Test(timeout=2000) public void testReceiveMessageWithoutMessageId() throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(testFixture.getAvailablePort())){
    Connection connection=testFixture.establishConnecton(testPeer);
    connection.start();
    testPeer.expectBegin(true);
    Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
    Queue queue=session.createQueue("String_Node_Str");
    DescribedType amqpValueNullContent=new AmqpValueDescribedType(null);
    testPeer.expectReceiverAttach();
    testPeer.expectLinkFlowRespondWithTransfer(null,null,null,null,amqpValueNullContent);
    testPeer.expectDispositionThatIsAcceptedAndSettled();
    MessageConsumer messageConsumer=session.createConsumer(queue);
    Message receivedMessage=messageConsumer.receive(1000);
    testPeer.waitForAllHandlersToComplete(2000);
    assertNull(receivedMessage.getJMSMessageID());
  }
 }
Program: 41718
Project: 41718
Buggy source:
/** 
 * @param userName
 * @param password
 * @return a QueueConnection
 * @throws JMSException
 * @see javax.jms.QueueConnectionFactory#createQueueConnection(java.lang.String,java.lang.String)
 */
@Override public QueueConnection createQueueConnection(String username,String password) throws JMSException {
  try {
    String connectionId=getConnectionIdGenerator().generateId();
    Provider provider=createProvider(brokerURI);
    JmsQueueConnection result=new JmsQueueConnection(connectionId,provider,getClientIdGenerator());
    return configureConnection(result,username,password);
  }
 catch (  Exception e) {
    throw JmsExceptionSupport.create(e);
  }
}

Fixed version (ground truth):
/** 
 * @param username
 * @param password
 * @return a QueueConnection
 * @throws JMSException
 * @see javax.jms.QueueConnectionFactory#createQueueConnection(java.lang.String,java.lang.String)
 */
@Override public QueueConnection createQueueConnection(String username,String password) throws JMSException {
  try {
    String connectionId=getConnectionIdGenerator().generateId();
    Provider provider=createProvider(brokerURI);
    JmsQueueConnection result=new JmsQueueConnection(connectionId,provider,getClientIdGenerator());
    return configureConnection(result,username,password);
  }
 catch (  Exception e) {
    throw JmsExceptionSupport.create(e);
  }
}
Program: 41719
Project: 41719
Buggy source:
/** 
 * @param userName
 * @param password
 * @return a TopicConnection
 * @throws JMSException
 * @see javax.jms.TopicConnectionFactory#createTopicConnection(java.lang.String,java.lang.String)
 */
@Override public TopicConnection createTopicConnection(String username,String password) throws JMSException {
  try {
    String connectionId=getConnectionIdGenerator().generateId();
    Provider provider=createProvider(brokerURI);
    JmsTopicConnection result=new JmsTopicConnection(connectionId,provider,getClientIdGenerator());
    return configureConnection(result,username,password);
  }
 catch (  Exception e) {
    throw JmsExceptionSupport.create(e);
  }
}

Fixed version (ground truth):
/** 
 * @param username
 * @param password
 * @return a TopicConnection
 * @throws JMSException
 * @see javax.jms.TopicConnectionFactory#createTopicConnection(java.lang.String,java.lang.String)
 */
@Override public TopicConnection createTopicConnection(String username,String password) throws JMSException {
  try {
    String connectionId=getConnectionIdGenerator().generateId();
    Provider provider=createProvider(brokerURI);
    JmsTopicConnection result=new JmsTopicConnection(connectionId,provider,getClientIdGenerator());
    return configureConnection(result,username,password);
  }
 catch (  Exception e) {
    throw JmsExceptionSupport.create(e);
  }
}
Program: 41720
Project: 41720
Buggy source:
/** 
 * @param userName
 * @param password
 * @return Connection
 * @throws JMSException
 * @see javax.jms.ConnectionFactory#createConnection(java.lang.String,java.lang.String)
 */
@Override public Connection createConnection(String username,String password) throws JMSException {
  try {
    String connectionId=getConnectionIdGenerator().generateId();
    Provider provider=createProvider(brokerURI);
    JmsConnection result=new JmsConnection(connectionId,provider,getClientIdGenerator());
    return configureConnection(result,username,password);
  }
 catch (  Exception e) {
    throw JmsExceptionSupport.create(e);
  }
}

Fixed version (ground truth):
/** 
 * @param username
 * @param password
 * @return Connection
 * @throws JMSException
 * @see javax.jms.ConnectionFactory#createConnection(java.lang.String,java.lang.String)
 */
@Override public Connection createConnection(String username,String password) throws JMSException {
  try {
    String connectionId=getConnectionIdGenerator().generateId();
    Provider provider=createProvider(brokerURI);
    JmsConnection result=new JmsConnection(connectionId,provider,getClientIdGenerator());
    return configureConnection(result,username,password);
  }
 catch (  Exception e) {
    throw JmsExceptionSupport.create(e);
  }
}
Program: 41721
Project: 41721
Buggy source:
/** 
 * Adds the given Transaction synchronization to the current list.
 * @param synchronization the transaction synchronization to add.
 */
public void addSynchronization(JmsTxSynchronization s){
  if (synchronizations == null) {
    synchronizations=new ArrayList<JmsTxSynchronization>(10);
  }
  synchronizations.add(s);
}

Fixed version (ground truth):
/** 
 * Adds the given Transaction synchronization to the current list.
 * @param s the transaction synchronization to add.
 */
public void addSynchronization(JmsTxSynchronization s){
  if (synchronizations == null) {
    synchronizations=new ArrayList<JmsTxSynchronization>(10);
  }
  synchronizations.add(s);
}