nus-yam/ex-repair huggingface dataset:
Program: 41722
Project: 41722
Buggy source:
/** 
 * Called from the session when a new Message has been dispatched to this Consumer from the connection.
 * @param facade the newly arrived message.
 */
@Override public void onMessage(final JmsInboundMessageDispatch envelope){
  lock.lock();
  try {
    if (acknowledgementMode == Session.CLIENT_ACKNOWLEDGE) {
      envelope.getMessage().setAcknowledgeCallback(new Callable<Void>(){
        @Override public Void call() throws Exception {
          if (session.isClosed()) {
            throw new javax.jms.IllegalStateException("String_Node_Str");
          }
          session.acknowledge();
          return null;
        }
      }
);
    }
    this.messageQueue.enqueue(envelope);
  }
  finally {
    lock.unlock();
  }
  if (this.messageListener != null && this.started) {
    session.getExecutor().execute(new Runnable(){
      @Override public void run(){
        JmsInboundMessageDispatch envelope;
        while (session.isStarted() && (envelope=messageQueue.dequeueNoWait()) != null) {
          try {
            messageListener.onMessage(copy(ack(envelope)));
          }
 catch (          Exception e) {
            session.getConnection().onException(e);
          }
        }
      }
    }
);
  }
 else {
    if (availableListener != null) {
      availableListener.onMessageAvailable(this);
    }
  }
}

Fixed version (ground truth):
/** 
 * Called from the session when a new Message has been dispatched to this Consumer from the connection.
 * @param envelope the newly arrived message.
 */
@Override public void onMessage(final JmsInboundMessageDispatch envelope){
  lock.lock();
  try {
    if (acknowledgementMode == Session.CLIENT_ACKNOWLEDGE) {
      envelope.getMessage().setAcknowledgeCallback(new Callable<Void>(){
        @Override public Void call() throws Exception {
          if (session.isClosed()) {
            throw new javax.jms.IllegalStateException("String_Node_Str");
          }
          session.acknowledge();
          return null;
        }
      }
);
    }
    this.messageQueue.enqueue(envelope);
  }
  finally {
    lock.unlock();
  }
  if (this.messageListener != null && this.started) {
    session.getExecutor().execute(new Runnable(){
      @Override public void run(){
        JmsInboundMessageDispatch envelope;
        while (session.isStarted() && (envelope=messageQueue.dequeueNoWait()) != null) {
          try {
            messageListener.onMessage(copy(ack(envelope)));
          }
 catch (          Exception e) {
            session.getConnection().onException(e);
          }
        }
      }
    }
);
  }
 else {
    if (availableListener != null) {
      availableListener.onMessageAvailable(this);
    }
  }
}
Program: 41723
Project: 41723
Buggy source:
/** 
 * Waits for a response to some Provider requested operation.
 * @return the response from the Provider for this operation.
 * @throws IOException if an error occurs while waiting for the response.
 */
public void sync() throws IOException {
  try {
    latch.await();
  }
 catch (  InterruptedException e) {
    Thread.interrupted();
    throw IOExceptionSupport.create(e);
  }
  failOnError();
}

Fixed version (ground truth):
/** 
 * Waits for a response to some Provider requested operation.
 * @throws IOException if an error occurs while waiting for the response.
 */
public void sync() throws IOException {
  try {
    latch.await();
  }
 catch (  InterruptedException e) {
    Thread.interrupted();
    throw IOExceptionSupport.create(e);
  }
  failOnError();
}
Program: 41724
Project: 41724
Buggy source:
/** 
 * Creates a new AmqpTransaction instance.
 * @param session The session that owns this transaction
 * @param resource The JmsTransactionInfo that defines this Transaction.
 */
public AmqpTransactionContext(AmqpSession session){
  super(session.getJmsResource());
  this.session=session;
}

Fixed version (ground truth):
/** 
 * Creates a new AmqpTransaction instance.
 * @param session The session that owns this transaction
 */
public AmqpTransactionContext(AmqpSession session){
  super(session.getJmsResource());
  this.session=session;
}
Program: 41725
Project: 41725
Buggy source:
/** 
 * When used as a pooled cache of tags the unused tags should always be returned once the transfer has been settled.
 * @param tag a previously borrowed tag that is no longer in use.
 */
public void returnTag(byte[] data){
  if (tagPool != null && tagPool.size() < maxPoolSize) {
    tagPool.add(data);
  }
}

Fixed version (ground truth):
/** 
 * When used as a pooled cache of tags the unused tags should always be returned once the transfer has been settled.
 * @param data a previously borrowed tag that is no longer in use.
 */
public void returnTag(byte[] data){
  if (tagPool != null && tagPool.size() < maxPoolSize) {
    tagPool.add(data);
  }
}
Program: 41726
Project: 41726
Buggy source:
/** 
 * The AmqpConnection instance that is associated with this Message.
 * @return
 */
public AmqpConnection getConnection(){
  return connection;
}

Fixed version (ground truth):
/** 
 * The AmqpConnection instance that is associated with this Message.
 * @return the connection
 */
public AmqpConnection getConnection(){
  return connection;
}
Program: 41727
Project: 41727
Buggy source:
/** 
 * Returns the suffix of the given string after removing the first "ID:" prefix (if present).
 * @param string the string to process
 * @return the suffix, or the original String if the "ID:" prefix is not present
 */
public String stripMessageIdPrefix(String id){
  if (hasMessageIdPrefix(id)) {
    return strip(id,JMS_ID_PREFIX_LENGTH);
  }
 else {
    return id;
  }
}

Fixed version (ground truth):
/** 
 * Returns the suffix of the given string after removing the first "ID:" prefix (if present).
 * @param id the string to process
 * @return the suffix, or the original String if the "ID:" prefix is not present
 */
public String stripMessageIdPrefix(String id){
  if (hasMessageIdPrefix(id)) {
    return strip(id,JMS_ID_PREFIX_LENGTH);
  }
 else {
    return id;
  }
}
Program: 41728
Project: 41728
Buggy source:
/** 
 * Create an instance of the SSL transport
 * @param listener The TransportListener that will handle events from this Transport instance.
 * @param remoteLocation The location that is being connected to.
 * @param JmsSslContext The JMS Framework SslContext to use for this SSL connection.
 */
public SslTransport(TransportListener listener,URI remoteLocation,JmsSslContext context){
  super(listener,remoteLocation);
  this.context=context;
}

Fixed version (ground truth):
/** 
 * Create an instance of the SSL transport
 * @param listener The TransportListener that will handle events from this Transport instance.
 * @param remoteLocation The location that is being connected to.
 * @param context The JMS Framework SslContext to use for this SSL connection.
 */
public SslTransport(TransportListener listener,URI remoteLocation,JmsSslContext context){
  super(listener,remoteLocation);
  this.context=context;
}
Program: 41729
Project: 41729
Buggy source:
/** 
 * Given a map of properties, filter out only those prefixed with the given value, the values filtered are returned in a new Map instance.
 * @param properties The map of properties to filter.
 * @param optionPrefix The prefix value to use when filtering.
 * @return a filter map with only values that match the given prefix.
 */
public static Map<String,String> filterProperties(Map<String,String> props,String optionPrefix){
  if (props == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  HashMap<String,String> rc=new HashMap<String,String>(props.size());
  for (Iterator<Entry<String,String>> iter=props.entrySet().iterator(); iter.hasNext(); ) {
    Entry<String,String> entry=iter.next();
    if (entry.getKey().startsWith(optionPrefix)) {
      String name=entry.getKey().substring(optionPrefix.length());
      rc.put(name,entry.getValue());
      iter.remove();
    }
  }
  return rc;
}

Fixed version (ground truth):
/** 
 * Given a map of properties, filter out only those prefixed with the given value, the values filtered are returned in a new Map instance.
 * @param props The map of properties to filter.
 * @param optionPrefix The prefix value to use when filtering.
 * @return a filter map with only values that match the given prefix.
 */
public static Map<String,String> filterProperties(Map<String,String> props,String optionPrefix){
  if (props == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  HashMap<String,String> rc=new HashMap<String,String>(props.size());
  for (Iterator<Entry<String,String>> iter=props.entrySet().iterator(); iter.hasNext(); ) {
    Entry<String,String> entry=iter.next();
    if (entry.getKey().startsWith(optionPrefix)) {
      String name=entry.getKey().substring(optionPrefix.length());
      rc.put(name,entry.getValue());
      iter.remove();
    }
  }
  return rc;
}
Program: 41730
Project: 41730
Buggy source:
/** 
 * Creates a URI with the given query, removing an previous query value from the given URI.
 * @param uri The source URI whose existing query is replaced with the newly supplied one.
 * @param query The new URI query string that should be appended to the given URI.
 * @return a new URI that is a combination of the original URI and the given query string.
 * @throws URISyntaxException
 */
public static URI eraseQuery(URI uri) throws URISyntaxException {
  return replaceQuery(uri,(String)null);
}

Fixed version (ground truth):
/** 
 * Creates a URI with the given query, removing an previous query value from the given URI.
 * @param uri The source URI whose existing query is replaced with the newly supplied one.
 * @return a new URI that is a combination of the original URI and the given query string.
 * @throws URISyntaxException
 */
public static URI eraseQuery(URI uri) throws URISyntaxException {
  return replaceQuery(uri,(String)null);
}
Program: 41732
Project: 41732
Buggy source:
/** 
 * Verify that when   {@link BytesMessage#readBytes(byte[], int))} is calledwith a length that is greater than the size of the provided array, an  {@link IndexOutOfBoundsException} is thrown.
 */
@Test(expected=IndexOutOfBoundsException.class) public void testReadBytesWithLengthGreatThanArraySizeThrowsIOOBE() throws Exception {
  JmsBytesMessage bytesMessage=factory.createBytesMessage();
  bytesMessage.reset();
  bytesMessage.readBytes(new byte[1],2);
}

Fixed version (ground truth):
/** 
 * Verify that when   {@link BytesMessage#readBytes(byte[],int)} is calledwith a length that is greater than the size of the provided array, an  {@link IndexOutOfBoundsException} is thrown.
 */
@Test(expected=IndexOutOfBoundsException.class) public void testReadBytesWithLengthGreatThanArraySizeThrowsIOOBE() throws Exception {
  JmsBytesMessage bytesMessage=factory.createBytesMessage();
  bytesMessage.reset();
  bytesMessage.readBytes(new byte[1],2);
}
Program: 41733
Project: 41733
Buggy source:
/** 
 * Verify that when   {@link BytesMessage#readBytes(byte[], int))} is calledwith a negative length that an  {@link IndexOutOfBoundsException} is thrown.
 */
@Test(expected=IndexOutOfBoundsException.class) public void testReadBytesWithNegativeLengthThrowsIOOBE() throws Exception {
  JmsBytesMessage bytesMessage=factory.createBytesMessage();
  bytesMessage.reset();
  bytesMessage.readBytes(new byte[0],-1);
}

Fixed version (ground truth):
/** 
 * Verify that when   {@link BytesMessage#readBytes(byte[],int)} is calledwith a negative length that an  {@link IndexOutOfBoundsException} is thrown.
 */
@Test(expected=IndexOutOfBoundsException.class) public void testReadBytesWithNegativeLengthThrowsIOOBE() throws Exception {
  JmsBytesMessage bytesMessage=factory.createBytesMessage();
  bytesMessage.reset();
  bytesMessage.readBytes(new byte[0],-1);
}
Program: 41734
Project: 41734
Buggy source:
/** 
 * Test that calling   {@link ObjectMessage#clearBody()} of a received messagecauses the body of the underlying  {@link AmqpObjectMessage} to be emptied.
 */
@Test public void testClearBodyOnReceivedObjectMessageClearsUnderlyingMessageBody() throws Exception {
  String content="String_Node_Str";
  JmsDefaultObjectMessageFacade facade=new JmsDefaultObjectMessageFacade();
  facade.setObject(content);
  JmsObjectMessage objectMessage=new JmsObjectMessage(facade);
  objectMessage.onDispatch();
  assertNotNull("String_Node_Str",facade.getSerializedObject());
  objectMessage.clearBody();
  assertNull("String_Node_Str",objectMessage.getObject());
  assertNull("String_Node_Str",facade.getSerializedObject());
}

Fixed version (ground truth):
/** 
 * Test that calling   {@link ObjectMessage#clearBody()} of a received messagecauses the body of the underlying message facade to be emptied.
 */
@Test public void testClearBodyOnReceivedObjectMessageClearsUnderlyingMessageBody() throws Exception {
  String content="String_Node_Str";
  JmsDefaultObjectMessageFacade facade=new JmsDefaultObjectMessageFacade();
  facade.setObject(content);
  JmsObjectMessage objectMessage=new JmsObjectMessage(facade);
  objectMessage.onDispatch();
  assertNotNull("String_Node_Str",facade.getSerializedObject());
  objectMessage.clearBody();
  assertNull("String_Node_Str",objectMessage.getObject());
  assertNull("String_Node_Str",facade.getSerializedObject());
}
Program: 41735
Project: 41735
Buggy source:
/** 
 * Test that a message with the   {@value AmqpMessageSupport#JMS_MSG_TYPE}annotation set to    {@value AmqpMessageSupport#JMS_OBJECT_MESSAGE} andcontent-type set to  {@value AmqpMessageSupport.OCTET_STREAM_CONTENT_TYPE} istreated as a  {@link JmsObjectMessage} with {@link AmqpJmsObjectMessageFacade}containing a   {@link AmqpSerializedObjectDelegate}.
 */
@Test public void testCreateObjectMessageFromMessageTypeAnnotation() throws Exception {
  createObjectMessageFromMessageTypeAnnotationTestImpl(true);
}

Fixed version (ground truth):
/** 
 * Test that a message with the   {@value AmqpMessageSupport#JMS_MSG_TYPE}annotation set to    {@value AmqpMessageSupport#JMS_OBJECT_MESSAGE} andcontent-type set to  {@value AmqpMessageSupport#OCTET_STREAM_CONTENT_TYPE} istreated as a  {@link JmsObjectMessage} with {@link AmqpJmsObjectMessageFacade}containing a   {@link AmqpSerializedObjectDelegate}.
 */
@Test public void testCreateObjectMessageFromMessageTypeAnnotation() throws Exception {
  createObjectMessageFromMessageTypeAnnotationTestImpl(true);
}
Program: 41736
Project: 41736
Buggy source:
/** 
 * Test that   {@link MessageImpl#getJMSType()} returns the expected value for a messagereceived with the  {@link ClientProperties#X_OPT_JMS_TYPE} message annotation set.
 */
@Test public void testGetJMSTypeWithReceivedMessage() throws Exception {
  String myJMSType="String_Node_Str";
  Message message=Proton.message();
  Map<Symbol,Object> annotationsMap=new HashMap<Symbol,Object>();
  annotationsMap.put(Symbol.valueOf(AmqpMessageSupport.JMS_TYPE),myJMSType);
  message.setMessageAnnotations(new MessageAnnotations(annotationsMap));
  AmqpJmsMessageFacade amqpMessageFacade=createReceivedMessageFacade(createMockAmqpConsumer(),message);
  assertEquals("String_Node_Str",myJMSType,amqpMessageFacade.getType());
}

Fixed version (ground truth):
/** 
 * Test that   {@link AmqpJmsMessageFacade#getType()} returns the expected value for a messagereceived with the  {@link AmqpMessageSupport#JMS_TYPE} message annotation set.
 */
@Test public void testGetJMSTypeWithReceivedMessage() throws Exception {
  String myJMSType="String_Node_Str";
  Message message=Proton.message();
  Map<Symbol,Object> annotationsMap=new HashMap<Symbol,Object>();
  annotationsMap.put(Symbol.valueOf(AmqpMessageSupport.JMS_TYPE),myJMSType);
  message.setMessageAnnotations(new MessageAnnotations(annotationsMap));
  AmqpJmsMessageFacade amqpMessageFacade=createReceivedMessageFacade(createMockAmqpConsumer(),message);
  assertEquals("String_Node_Str",myJMSType,amqpMessageFacade.getType());
}
Program: 41737
Project: 41737
Buggy source:
/** 
 * Test that   {@link AmqpMessageIdHelper#toBaseMessageIdString(String)} returns a stringindicating an AMQP encoded binary when given a Binary object.
 */
@Test public void testToBaseMessageIdStringWithBinary(){
  byte[] bytes=new byte[]{(byte)0x00,(byte)0xAB,(byte)0x09,(byte)0xFF};
  Binary binary=new Binary(bytes);
  String expected=AmqpMessageIdHelper.AMQP_BINARY_PREFIX + "String_Node_Str";
  String baseMessageIdString=_messageIdHelper.toBaseMessageIdString(binary);
  assertNotNull("String_Node_Str",baseMessageIdString);
  assertEquals("String_Node_Str",expected,baseMessageIdString);
}

Fixed version (ground truth):
/** 
 * Test that   {@link AmqpMessageIdHelper#toBaseMessageIdString(Object)} returns a stringindicating an AMQP encoded binary when given a Binary object.
 */
@Test public void testToBaseMessageIdStringWithBinary(){
  byte[] bytes=new byte[]{(byte)0x00,(byte)0xAB,(byte)0x09,(byte)0xFF};
  Binary binary=new Binary(bytes);
  String expected=AmqpMessageIdHelper.AMQP_BINARY_PREFIX + "String_Node_Str";
  String baseMessageIdString=_messageIdHelper.toBaseMessageIdString(binary);
  assertNotNull("String_Node_Str",baseMessageIdString);
  assertEquals("String_Node_Str",expected,baseMessageIdString);
}
Program: 41738
Project: 41738
Buggy source:
/** 
 * Test that   {@link AmqpMessageIdHelper#toBaseMessageIdString(String)} returns the givenbasic string unchanged
 */
@Test public void testToBaseMessageIdStringWithString(){
  String stringMessageId="String_Node_Str";
  String baseMessageIdString=_messageIdHelper.toBaseMessageIdString(stringMessageId);
  assertNotNull("String_Node_Str",baseMessageIdString);
  assertEquals("String_Node_Str",stringMessageId,baseMessageIdString);
}

Fixed version (ground truth):
/** 
 * Test that   {@link AmqpMessageIdHelper#toBaseMessageIdString(Object)} returns the givenbasic string unchanged
 */
@Test public void testToBaseMessageIdStringWithString(){
  String stringMessageId="String_Node_Str";
  String baseMessageIdString=_messageIdHelper.toBaseMessageIdString(stringMessageId);
  assertNotNull("String_Node_Str",baseMessageIdString);
  assertEquals("String_Node_Str",stringMessageId,baseMessageIdString);
}
Program: 41739
Project: 41739
Buggy source:
/** 
 * Test that   {@link AmqpMessageIdHelper#toBaseMessageIdString(String)} returns a stringindicating an AMQP encoded string, when the given string happens to already begin with the  {@link AmqpMessageIdHelper#AMQP_UUID_PREFIX}.
 */
@Test public void testToBaseMessageIdStringWithStringBeginningWithEncodingPrefixForUUID(){
  String uuidStringMessageId=AmqpMessageIdHelper.AMQP_UUID_PREFIX + UUID.randomUUID();
  String expected=AmqpMessageIdHelper.AMQP_STRING_PREFIX + uuidStringMessageId;
  String baseMessageIdString=_messageIdHelper.toBaseMessageIdString(uuidStringMessageId);
  assertNotNull("String_Node_Str",baseMessageIdString);
  assertEquals("String_Node_Str",expected,baseMessageIdString);
}

Fixed version (ground truth):
/** 
 * Test that   {@link AmqpMessageIdHelper#toBaseMessageIdString(Object)} returns a stringindicating an AMQP encoded string, when the given string happens to already begin with the  {@link AmqpMessageIdHelper#AMQP_UUID_PREFIX}.
 */
@Test public void testToBaseMessageIdStringWithStringBeginningWithEncodingPrefixForUUID(){
  String uuidStringMessageId=AmqpMessageIdHelper.AMQP_UUID_PREFIX + UUID.randomUUID();
  String expected=AmqpMessageIdHelper.AMQP_STRING_PREFIX + uuidStringMessageId;
  String baseMessageIdString=_messageIdHelper.toBaseMessageIdString(uuidStringMessageId);
  assertNotNull("String_Node_Str",baseMessageIdString);
  assertEquals("String_Node_Str",expected,baseMessageIdString);
}
Program: 41740
Project: 41740
Buggy source:
/** 
 * Test that   {@link AmqpMessageIdHelper#toBaseMessageIdString(String)} returns a stringindicating an AMQP encoded ulong when given a UnsignedLong object.
 */
@Test public void testToBaseMessageIdStringWithUnsignedLong(){
  UnsignedLong uLongMessageId=UnsignedLong.valueOf(123456789L);
  String expected=AmqpMessageIdHelper.AMQP_ULONG_PREFIX + uLongMessageId.toString();
  String baseMessageIdString=_messageIdHelper.toBaseMessageIdString(uLongMessageId);
  assertNotNull("String_Node_Str",baseMessageIdString);
  assertEquals("String_Node_Str",expected,baseMessageIdString);
}

Fixed version (ground truth):
/** 
 * Test that   {@link AmqpMessageIdHelper#toBaseMessageIdString(Object)} returns a stringindicating an AMQP encoded ulong when given a UnsignedLong object.
 */
@Test public void testToBaseMessageIdStringWithUnsignedLong(){
  UnsignedLong uLongMessageId=UnsignedLong.valueOf(123456789L);
  String expected=AmqpMessageIdHelper.AMQP_ULONG_PREFIX + uLongMessageId.toString();
  String baseMessageIdString=_messageIdHelper.toBaseMessageIdString(uLongMessageId);
  assertNotNull("String_Node_Str",baseMessageIdString);
  assertEquals("String_Node_Str",expected,baseMessageIdString);
}
Program: 41741
Project: 41741
Buggy source:
/** 
 * Test that   {@link AmqpMessageIdHelper#toBaseMessageIdString(String)} returns a stringindicating an AMQP encoded string, when the given string happens to already begin with the  {@link AmqpMessageIdHelper#AMQP_BINARY_PREFIX}.
 */
@Test public void testToBaseMessageIdStringWithStringBeginningWithEncodingPrefixForBinary(){
  String binaryStringMessageId=AmqpMessageIdHelper.AMQP_BINARY_PREFIX + "String_Node_Str";
  String expected=AmqpMessageIdHelper.AMQP_STRING_PREFIX + binaryStringMessageId;
  String baseMessageIdString=_messageIdHelper.toBaseMessageIdString(binaryStringMessageId);
  assertNotNull("String_Node_Str",baseMessageIdString);
  assertEquals("String_Node_Str",expected,baseMessageIdString);
}

Fixed version (ground truth):
/** 
 * Test that   {@link AmqpMessageIdHelper#toBaseMessageIdString(Object)} returns a stringindicating an AMQP encoded string, when the given string happens to already begin with the  {@link AmqpMessageIdHelper#AMQP_BINARY_PREFIX}.
 */
@Test public void testToBaseMessageIdStringWithStringBeginningWithEncodingPrefixForBinary(){
  String binaryStringMessageId=AmqpMessageIdHelper.AMQP_BINARY_PREFIX + "String_Node_Str";
  String expected=AmqpMessageIdHelper.AMQP_STRING_PREFIX + binaryStringMessageId;
  String baseMessageIdString=_messageIdHelper.toBaseMessageIdString(binaryStringMessageId);
  assertNotNull("String_Node_Str",baseMessageIdString);
  assertEquals("String_Node_Str",expected,baseMessageIdString);
}
Program: 41742
Project: 41742
Buggy source:
/** 
 * Test that   {@link AmqpMessageIdHelper#toBaseMessageIdString(String)} throws an IAE if given an unexpected object type.
 */
@Test public void testToBaseMessageIdStringThrowsIAEWithUnexpectedType(){
  try {
    _messageIdHelper.toBaseMessageIdString(new Object());
    fail("String_Node_Str");
  }
 catch (  IllegalArgumentException iae) {
  }
}

Fixed version (ground truth):
/** 
 * Test that   {@link AmqpMessageIdHelper#toBaseMessageIdString(Object)} throws an IAE if given an unexpected object type.
 */
@Test public void testToBaseMessageIdStringThrowsIAEWithUnexpectedType(){
  try {
    _messageIdHelper.toBaseMessageIdString(new Object());
    fail("String_Node_Str");
  }
 catch (  IllegalArgumentException iae) {
  }
}
Program: 41743
Project: 41743
Buggy source:
/** 
 * Test that   {@link AmqpMessageIdHelper#toBaseMessageIdString(String)} returns a stringindicating an AMQP encoded UUID when given a UUID object.
 */
@Test public void testToBaseMessageIdStringWithUUID(){
  UUID uuidMessageId=UUID.randomUUID();
  String expected=AmqpMessageIdHelper.AMQP_UUID_PREFIX + uuidMessageId.toString();
  String baseMessageIdString=_messageIdHelper.toBaseMessageIdString(uuidMessageId);
  assertNotNull("String_Node_Str",baseMessageIdString);
  assertEquals("String_Node_Str",expected,baseMessageIdString);
}

Fixed version (ground truth):
/** 
 * Test that   {@link AmqpMessageIdHelper#toBaseMessageIdString(Object)} returns a stringindicating an AMQP encoded UUID when given a UUID object.
 */
@Test public void testToBaseMessageIdStringWithUUID(){
  UUID uuidMessageId=UUID.randomUUID();
  String expected=AmqpMessageIdHelper.AMQP_UUID_PREFIX + uuidMessageId.toString();
  String baseMessageIdString=_messageIdHelper.toBaseMessageIdString(uuidMessageId);
  assertNotNull("String_Node_Str",baseMessageIdString);
  assertEquals("String_Node_Str",expected,baseMessageIdString);
}
Program: 41744
Project: 41744
Buggy source:
/** 
 * Test that   {@link AmqpMessageIdHelper#toBaseMessageIdString(String)} returns a stringindicating an AMQP encoded string, when the given string happens to already begin with the  {@link AmqpMessageIdHelper#AMQP_ULONG_PREFIX}.
 */
@Test public void testToBaseMessageIdStringWithStringBeginningWithEncodingPrefixForLong(){
  String longStringMessageId=AmqpMessageIdHelper.AMQP_ULONG_PREFIX + Long.valueOf(123456789L);
  String expected=AmqpMessageIdHelper.AMQP_STRING_PREFIX + longStringMessageId;
  String baseMessageIdString=_messageIdHelper.toBaseMessageIdString(longStringMessageId);
  assertNotNull("String_Node_Str",baseMessageIdString);
  assertEquals("String_Node_Str",expected,baseMessageIdString);
}

Fixed version (ground truth):
/** 
 * Test that   {@link AmqpMessageIdHelper#toBaseMessageIdString(Object)} returns a stringindicating an AMQP encoded string, when the given string happens to already begin with the  {@link AmqpMessageIdHelper#AMQP_ULONG_PREFIX}.
 */
@Test public void testToBaseMessageIdStringWithStringBeginningWithEncodingPrefixForLong(){
  String longStringMessageId=AmqpMessageIdHelper.AMQP_ULONG_PREFIX + Long.valueOf(123456789L);
  String expected=AmqpMessageIdHelper.AMQP_STRING_PREFIX + longStringMessageId;
  String baseMessageIdString=_messageIdHelper.toBaseMessageIdString(longStringMessageId);
  assertNotNull("String_Node_Str",baseMessageIdString);
  assertEquals("String_Node_Str",expected,baseMessageIdString);
}
Program: 41745
Project: 41745
Buggy source:
/** 
 * Test that   {@link AmqpMessageIdHelper#toBaseMessageIdString(String)} returns a stringindicating an AMQP encoded string (effectively twice), when the given string happens to already begin with the  {@link AmqpMessageIdHelper#AMQP_STRING_PREFIX}.
 */
@Test public void testToBaseMessageIdStringWithStringBeginningWithEncodingPrefixForString(){
  String stringMessageId=AmqpMessageIdHelper.AMQP_STRING_PREFIX + "String_Node_Str";
  String expected=AmqpMessageIdHelper.AMQP_STRING_PREFIX + stringMessageId;
  String baseMessageIdString=_messageIdHelper.toBaseMessageIdString(stringMessageId);
  assertNotNull("String_Node_Str",baseMessageIdString);
  assertEquals("String_Node_Str",expected,baseMessageIdString);
}

Fixed version (ground truth):
/** 
 * Test that   {@link AmqpMessageIdHelper#toBaseMessageIdString(Object)} returns a stringindicating an AMQP encoded string (effectively twice), when the given string happens to already begin with the  {@link AmqpMessageIdHelper#AMQP_STRING_PREFIX}.
 */
@Test public void testToBaseMessageIdStringWithStringBeginningWithEncodingPrefixForString(){
  String stringMessageId=AmqpMessageIdHelper.AMQP_STRING_PREFIX + "String_Node_Str";
  String expected=AmqpMessageIdHelper.AMQP_STRING_PREFIX + stringMessageId;
  String baseMessageIdString=_messageIdHelper.toBaseMessageIdString(stringMessageId);
  assertNotNull("String_Node_Str",baseMessageIdString);
  assertEquals("String_Node_Str",expected,baseMessageIdString);
}
Program: 41746
Project: 41746
Buggy source:
/** 
 * Test that   {@link AmqpMessageIdHelper#toBaseMessageIdString(String)} returns null if given null
 */
@Test public void testToBaseMessageIdStringWithNull(){
  String nullString=null;
  assertNull("String_Node_Str",_messageIdHelper.toBaseMessageIdString(nullString));
}

Fixed version (ground truth):
/** 
 * Test that   {@link AmqpMessageIdHelper#toBaseMessageIdString(Object)} returns null if given null
 */
@Test public void testToBaseMessageIdStringWithNull(){
  String nullString=null;
  assertNull("String_Node_Str",_messageIdHelper.toBaseMessageIdString(nullString));
}
Program: 41747
Project: 41747
Buggy source:
@Ignore @Test(timeout=60000) public void testAnonymousSendToTopic() throws Exception {
  connection=createAmqpConnection();
  assertNotNull(connection);
  connection.start();
  Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
  Topic topic=session.createTopic(name.getMethodName());
  assertNotNull(session);
  MessageProducer producer=session.createProducer(null);
  assertNotNull(producer);
  MessageConsumer consumer=session.createConsumer(topic);
  assertNotNull(consumer);
  Message message=session.createMessage();
  producer.send(topic,message);
  TopicViewMBean proxy=getProxyToTopic(name.getMethodName());
  assertEquals(1,proxy.getEnqueueCount());
}

Fixed version (ground truth):
@Test(timeout=60000) public void testAnonymousSendToTopic() throws Exception {
  connection=createAmqpConnection();
  assertNotNull(connection);
  connection.start();
  Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
  Topic topic=session.createTopic(name.getMethodName());
  assertNotNull(session);
  MessageProducer producer=session.createProducer(null);
  assertNotNull(producer);
  MessageConsumer consumer=session.createConsumer(topic);
  assertNotNull(consumer);
  Message message=session.createMessage();
  producer.send(topic,message);
  TopicViewMBean proxy=getProxyToTopic(name.getMethodName());
  assertEquals(1,proxy.getEnqueueCount());
}
Program: 41748
Project: 41748
Buggy source:
protected void setConnectionIdGenerator(IdGenerator connectionIdGenerator){
  this.connectionIdGenerator=connectionIdGenerator;
}

Fixed version (ground truth):
protected synchronized void setConnectionIdGenerator(IdGenerator connectionIdGenerator){
  this.connectionIdGenerator=connectionIdGenerator;
}
Program: 41749
Project: 41749
Buggy source:
protected void setClientIdGenerator(IdGenerator clientIdGenerator){
  this.clientIdGenerator=clientIdGenerator;
}

Fixed version (ground truth):
protected synchronized void setClientIdGenerator(IdGenerator clientIdGenerator){
  this.clientIdGenerator=clientIdGenerator;
}
Program: 41750
Project: 41750
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 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 on.
 * @param clientIDPrefix
 */
public synchronized void setClientIDPrefix(String clientIDPrefix){
  this.clientIDPrefix=clientIDPrefix;
}
Program: 41751
Project: 41751
Buggy source:
public String getClientIDPrefix(){
  return clientIDPrefix;
}

Fixed version (ground truth):
public synchronized String getClientIDPrefix(){
  return clientIDPrefix;
}
Program: 41752
Project: 41752
Buggy source:
/** 
 * Sets the prefix used by connection id generator.
 * @param connectionIDPrefix The string prefix used on all connection Id's created by this factory.
 */
public void setConnectionIDPrefix(String connectionIDPrefix){
  this.connectionIDPrefix=connectionIDPrefix;
}

Fixed version (ground truth):
/** 
 * Sets the prefix used by connection id generator.
 * @param connectionIDPrefix The string prefix used on all connection Id's created by this factory.
 */
public synchronized void setConnectionIDPrefix(String connectionIDPrefix){
  this.connectionIDPrefix=connectionIDPrefix;
}
Program: 41753
Project: 41753
Buggy source:
@Override public void close(){
  if (closed.compareAndSet(false,true)) {
    final ProviderFuture request=new ProviderFuture();
    serializer.execute(new Runnable(){
      @Override public void run(){
        try {
          if (!transport.isConnected()) {
            request.onSuccess();
          }
          if (connection != null) {
            connection.close(request);
          }
 else {
            request.onSuccess();
          }
          pumpToProtonTransport();
        }
 catch (        Exception e) {
          LOG.debug("String_Node_Str");
        }
      }
    }
);
    try {
      if (closeTimeout < 0) {
        request.sync();
      }
 else {
        request.sync(closeTimeout,TimeUnit.MILLISECONDS);
      }
    }
 catch (    IOException e) {
      LOG.warn("String_Node_Str",e.getMessage());
    }
 finally {
      if (transport != null) {
        try {
          transport.close();
        }
 catch (        Exception e) {
          LOG.debug("String_Node_Str",e.getMessage());
        }
      }
      if (serializer != null) {
        serializer.shutdown();
      }
    }
  }
}

Fixed version (ground truth):
@Override public void close(){
  if (closed.compareAndSet(false,true)) {
    final ProviderFuture request=new ProviderFuture();
    serializer.execute(new Runnable(){
      @Override public void run(){
        try {
          if (!transport.isConnected()) {
            request.onSuccess();
          }
          if (connection != null) {
            connection.close(request);
          }
 else {
            request.onSuccess();
          }
          pumpToProtonTransport();
        }
 catch (        Exception e) {
          LOG.debug("String_Node_Str");
        }
      }
    }
);
    try {
      if (closeTimeout < 0) {
        request.sync();
      }
 else {
        request.sync(closeTimeout,TimeUnit.MILLISECONDS);
      }
    }
 catch (    IOException e) {
      LOG.warn("String_Node_Str",e.getMessage());
    }
 finally {
      if (transport != null) {
        try {
          transport.close();
        }
 catch (        Exception e) {
          LOG.debug("String_Node_Str",e.getMessage());
        }
      }
      serializer.shutdown();
    }
  }
}
Program: 41754
Project: 41754
Buggy source:
/** 
 * Get properties from a uri
 * @param uri
 * @return <Code>Map</Code> of properties
 * @throws Exception
 */
public static Map<String,String> parseQuery(String uri) throws Exception {
  if (uri != null) {
    Map<String,String> rc=new HashMap<String,String>();
    if (uri != null) {
      String[] parameters=uri.split("String_Node_Str");
      for (int i=0; i < parameters.length; i++) {
        int p=parameters[i].indexOf("String_Node_Str");
        if (p >= 0) {
          String name=URLDecoder.decode(parameters[i].substring(0,p),"String_Node_Str");
          String value=URLDecoder.decode(parameters[i].substring(p + 1),"String_Node_Str");
          rc.put(name,value);
        }
 else {
          rc.put(parameters[i],null);
        }
      }
    }
    return rc;
  }
  return Collections.emptyMap();
}

Fixed version (ground truth):
/** 
 * Get properties from a uri
 * @param uri
 * @return <Code>Map</Code> of properties
 * @throws Exception
 */
public static Map<String,String> parseQuery(String uri) throws Exception {
  if (uri != null) {
    Map<String,String> rc=new HashMap<String,String>();
    String[] parameters=uri.split("String_Node_Str");
    for (int i=0; i < parameters.length; i++) {
      int p=parameters[i].indexOf("String_Node_Str");
      if (p >= 0) {
        String name=URLDecoder.decode(parameters[i].substring(0,p),"String_Node_Str");
        String value=URLDecoder.decode(parameters[i].substring(p + 1),"String_Node_Str");
        rc.put(name,value);
      }
 else {
        rc.put(parameters[i],null);
      }
    }
    return rc;
  }
  return Collections.emptyMap();
}
Program: 41755
Project: 41755
Buggy source:
@Override public boolean equals(Object o){
  ConversionKey x=(ConversionKey)o;
  return x.from == from && x.to == to;
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  if (this == o) {
    return true;
  }
  if (o == null || o.getClass() != this.getClass()) {
    return false;
  }
  ConversionKey x=(ConversionKey)o;
  return x.from == from && x.to == to;
}
Program: 41756
Project: 41756
Buggy source:
static public Class loadClass(Properties properties) throws ClassNotFoundException, IOException {
  String className=properties.getProperty("String_Node_Str");
  if (className == null) {
    throw new IOException("String_Node_Str");
  }
  Class clazz=null;
  ClassLoader loader=Thread.currentThread().getContextClassLoader();
  if (loader != null) {
    try {
      clazz=loader.loadClass(className);
    }
 catch (    ClassNotFoundException e) {
    }
  }
  if (clazz == null) {
    clazz=FactoryFinder.class.getClassLoader().loadClass(className);
  }
  return clazz;
}

Fixed version (ground truth):
static public Class<?> loadClass(Properties properties) throws ClassNotFoundException, IOException {
  String className=properties.getProperty("String_Node_Str");
  if (className == null) {
    throw new IOException("String_Node_Str");
  }
  Class<?> clazz=null;
  ClassLoader loader=Thread.currentThread().getContextClassLoader();
  if (loader != null) {
    try {
      clazz=loader.loadClass(className);
    }
 catch (    ClassNotFoundException e) {
    }
  }
  if (clazz == null) {
    clazz=FactoryFinder.class.getClassLoader().loadClass(className);
  }
  return clazz;
}
Program: 41757
Project: 41757
Buggy source:
@Override public Object create(final String path) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException {
  Class clazz=classMap.get(path);
  if (clazz == null) {
    clazz=loadClass(loadProperties(path));
    classMap.put(path,clazz);
  }
  return clazz.newInstance();
}

Fixed version (ground truth):
@Override public Object create(final String path) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException {
  Class<?> clazz=classMap.get(path);
  if (clazz == null) {
    clazz=loadClass(loadProperties(path));
    Class<?> previous=classMap.putIfAbsent(path,clazz);
    if (previous != null) {
      clazz=previous;
    }
  }
  return clazz.newInstance();
}
Program: 41758
Project: 41758
Buggy source:
/** 
 * Creates a new instance of the given key.  The method first checks the cache of previously found factory instances for one that matches the key.  If no cached version exists then the factory will be searched for using the configured ObjectFactory instance.
 * @param key is the key to add to the path to find a text file containing the factory name
 * @return a newly created instance
 * @throws IllegalAccessException if an error occurs while accessing the search path.
 * @throws InstantiationException if the factory object fails on create.
 * @throws IOException if the search encounter an IO error.
 * @throws ClassNotFoundException if the class that is to be loaded cannot be found.
 * @throws ClassCastException if the found object is not assignable to the request factory type.
 */
public T newInstance(String key) throws IllegalAccessException, InstantiationException, IOException, ClassNotFoundException, ClassCastException {
  T factory=cachedFactories.get(key);
  if (factory == null) {
    Object found=objectFactory.create(path + key);
    if (found != null && factoryType.isInstance(found)) {
      factory=factoryType.cast(found);
      cachedFactories.put(key,factory);
    }
 else {
      throw new ClassCastException("String_Node_Str" + found.getClass().getName() + "String_Node_Str"+ factoryType.getName());
    }
  }
  return factory;
}

Fixed version (ground truth):
/** 
 * Creates a new instance of the given key.  The method first checks the cache of previously found factory instances for one that matches the key.  If no cached version exists then the factory will be searched for using the configured ObjectFactory instance.
 * @param key is the key to add to the path to find a text file containing the factory name
 * @return a newly created instance
 * @throws IllegalAccessException if an error occurs while accessing the search path.
 * @throws InstantiationException if the factory object fails on create.
 * @throws IOException if the search encounter an IO error.
 * @throws ClassNotFoundException if the class that is to be loaded cannot be found.
 * @throws ClassCastException if the found object is not assignable to the request factory type.
 */
public T newInstance(String key) throws IllegalAccessException, InstantiationException, IOException, ClassNotFoundException, ClassCastException {
  T factory=cachedFactories.get(key);
  if (factory == null) {
    Object found=objectFactory.create(path + key);
    if (found != null) {
      if (factoryType.isInstance(found)) {
        factory=factoryType.cast(found);
        cachedFactories.putIfAbsent(key,factory);
      }
 else {
        throw new ClassCastException("String_Node_Str" + found.getClass().getName() + "String_Node_Str"+ factoryType.getName());
      }
    }
 else {
      throw new ClassNotFoundException("String_Node_Str" + key);
    }
  }
  return factory;
}
Program: 41759
Project: 41759
Buggy source:
static public Properties loadProperties(String uri) throws IOException {
  ClassLoader classLoader=Thread.currentThread().getContextClassLoader();
  if (classLoader == null) {
    classLoader=StandaloneObjectFactory.class.getClassLoader();
  }
  InputStream in=classLoader.getResourceAsStream(uri);
  if (in == null) {
    in=FactoryFinder.class.getClassLoader().getResourceAsStream(uri);
    if (in == null) {
      throw new IOException("String_Node_Str" + uri);
    }
  }
  BufferedInputStream reader=null;
  try {
    reader=new BufferedInputStream(in);
    Properties properties=new Properties();
    properties.load(reader);
    return properties;
  }
  finally {
    try {
      reader.close();
    }
 catch (    Exception e) {
    }
  }
}

Fixed version (ground truth):
static public Properties loadProperties(String uri) throws IOException {
  ClassLoader classLoader=Thread.currentThread().getContextClassLoader();
  if (classLoader == null) {
    classLoader=StandaloneObjectFactory.class.getClassLoader();
  }
  InputStream in=classLoader.getResourceAsStream(uri);
  if (in == null) {
    in=FactoryFinder.class.getClassLoader().getResourceAsStream(uri);
    if (in == null) {
      throw new IOException("String_Node_Str" + uri);
    }
  }
  try (BufferedInputStream reader=new BufferedInputStream(in)){
    Properties properties=new Properties();
    properties.load(reader);
    return properties;
  }
 }
Program: 41760
Project: 41760
Buggy source:
@Override public boolean equals(Object object){
  if (object instanceof JmsPrefetchPolicy) {
    JmsPrefetchPolicy other=(JmsPrefetchPolicy)object;
    return this.queuePrefetch == other.queuePrefetch && this.queueBrowserPrefetch == other.queueBrowserPrefetch && this.topicPrefetch == other.topicPrefetch && this.durableTopicPrefetch == other.durableTopicPrefetch;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  JmsPrefetchPolicy other=(JmsPrefetchPolicy)obj;
  return this.queuePrefetch == other.queuePrefetch && this.queueBrowserPrefetch == other.queueBrowserPrefetch && this.topicPrefetch == other.topicPrefetch && this.durableTopicPrefetch == other.durableTopicPrefetch;
}
Program: 41761
Project: 41761
Buggy source:
@Override public int hashCode(){
  return this.connectionId.hashCode();
}

Fixed version (ground truth):
@Override public int hashCode(){
  return (connectionId == null) ? super.hashCode() : connectionId.hashCode();
}
Program: 41762
Project: 41762
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  JmsConnectionInfo other=(JmsConnectionInfo)obj;
  if (connectionId == null && other.connectionId != null) {
    return false;
  }
 else   if (!connectionId.equals(other.connectionId)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  JmsConnectionInfo other=(JmsConnectionInfo)obj;
  if (connectionId != null) {
    return connectionId.equals(other.connectionId);
  }
  return false;
}
Program: 41763
Project: 41763
Buggy source:
@Override public int hashCode(){
  return (consumerId == null) ? 0 : consumerId.hashCode();
}

Fixed version (ground truth):
@Override public int hashCode(){
  return (consumerId == null) ? super.hashCode() : consumerId.hashCode();
}
Program: 41764
Project: 41764
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  JmsConsumerInfo other=(JmsConsumerInfo)obj;
  if (consumerId == null && other.consumerId != null) {
    return false;
  }
 else   if (!consumerId.equals(other.consumerId)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  JmsConsumerInfo other=(JmsConsumerInfo)obj;
  if (consumerId != null) {
    return consumerId.equals(other.consumerId);
  }
  return false;
}
Program: 41765
Project: 41765
Buggy source:
@Override public int hashCode(){
  return (producerId == null) ? 0 : producerId.hashCode();
}

Fixed version (ground truth):
@Override public int hashCode(){
  return (producerId == null) ? super.hashCode() : producerId.hashCode();
}
Program: 41766
Project: 41766
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  JmsProducerInfo other=(JmsProducerInfo)obj;
  if (producerId == null && other.producerId != null) {
    return false;
  }
 else   if (!producerId.equals(other.producerId)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  JmsProducerInfo other=(JmsProducerInfo)obj;
  if (producerId != null) {
    return producerId.equals(other.producerId);
  }
  return false;
}
Program: 41767
Project: 41767
Buggy source:
@Override public int hashCode(){
  return (transactionId == null) ? 0 : transactionId.hashCode();
}

Fixed version (ground truth):
@Override public int hashCode(){
  return (transactionId == null) ? super.hashCode() : transactionId.hashCode();
}
Program: 41768
Project: 41768
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  JmsTransactionInfo other=(JmsTransactionInfo)obj;
  if (transactionId == null && other.transactionId != null) {
    return false;
  }
 else   if (!transactionId.equals(other.transactionId)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  JmsTransactionInfo other=(JmsTransactionInfo)obj;
  if (transactionId != null) {
    return transactionId.equals(other.transactionId);
  }
  return false;
}
Program: 41769
Project: 41769
Buggy source:
/** 
 * @return clientId
 * @see javax.jms.Connection#getClientID()
 */
@Override public String getClientID() throws JMSException {
  checkClosedOrFailed();
  return this.connectionInfo.getClientId();
}

Fixed version (ground truth):
/** 
 * @return clientId
 * @see javax.jms.Connection#getClientID()
 */
@Override public synchronized String getClientID() throws JMSException {
  checkClosedOrFailed();
  return this.connectionInfo.getClientId();
}