nus-yam/ex-repair huggingface dataset:
Program: 41094
Project: 41094
Buggy source:
/** 
 * @param destination
 * @param messageSelector
 * @param NoLocal
 * @return the MessageConsumer
 * @throws JMSException
 * @see javax.jms.Session#createConsumer(javax.jms.Destination,java.lang.String,boolean)
 */
@Override public MessageConsumer createConsumer(Destination destination,String messageSelector,boolean noLocal) throws JMSException {
  checkClosed();
  checkDestination(destination);
  messageSelector=checkSelector(messageSelector);
  JmsDestination dest=JmsMessageTransformation.transformDestination(connection,destination);
  JmsMessageConsumer result=new JmsMessageConsumer(getNextConsumerId(),this,dest,messageSelector,noLocal);
  result.init();
  return result;
}

Fixed version (ground truth):
/** 
 * @param destination
 * @param messageSelector
 * @param noLocal
 * @return the MessageConsumer
 * @throws JMSException
 * @see javax.jms.Session#createConsumer(javax.jms.Destination,java.lang.String,boolean)
 */
@Override public MessageConsumer createConsumer(Destination destination,String messageSelector,boolean noLocal) throws JMSException {
  checkClosed();
  checkDestination(destination);
  messageSelector=checkSelector(messageSelector);
  JmsDestination dest=JmsMessageTransformation.transformDestination(connection,destination);
  JmsMessageConsumer result=new JmsMessageConsumer(getNextConsumerId(),this,dest,messageSelector,noLocal);
  result.init();
  return result;
}
Program: 41095
Project: 41095
Buggy source:
/** 
 * Constructor
 * @param s
 * @param destination
 */
protected JmsTopicPublisher(JmsProducerId id,JmsSession session,JmsDestination destination) throws JMSException {
  super(id,session,destination);
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param session
 * @param destination
 */
protected JmsTopicPublisher(JmsProducerId id,JmsSession session,JmsDestination destination) throws JMSException {
  super(id,session,destination);
}
Program: 41096
Project: 41096
Buggy source:
/** 
 * For each of the currently configured message property intercepter instance a string key value is inserted into an Set and returned if the property has a value and is available for a read operation. The Set returned may be manipulated by the receiver without impacting the facade, and an empty set will be returned if there are no matching properties.
 * @param message the JmsMessageFacade instance to read from
 * @param excludeStandardJMSHeaders whether the standard JMS header names should be excluded from the returned set
 * @return a Set<String> containing the names of all intercepted properties with a value.
 * @throws JMSException if an error occurs while gathering the message property names.
 */
public static Set<String> getPropertyNames(JmsMessageFacade message,boolean excludeStandardJMSHeaders) throws JMSException {
  Set<String> names=new HashSet<String>();
  for (  Entry<String,PropertyIntercepter> entry : PROPERTY_INTERCEPTERS.entrySet()) {
    if (excludeStandardJMSHeaders && STANDARD_HEADERS.contains(entry.getKey())) {
      continue;
    }
    if (entry.getValue().propertyExists(message)) {
      names.add(entry.getKey());
    }
  }
  names.addAll(message.getPropertyNames());
  return names;
}

Fixed version (ground truth):
/** 
 * For each of the currently configured message property intercepter instance a string key value is inserted into an Set and returned if the property has a value and is available for a read operation. The Set returned may be manipulated by the receiver without impacting the facade, and an empty set will be returned if there are no matching properties.
 * @param message the JmsMessageFacade instance to read from
 * @param excludeStandardJMSHeaders whether the standard JMS header names should be excluded from the returned set
 * @return a {@code Set<String>} containing the names of all intercepted properties with a value.
 * @throws JMSException if an error occurs while gathering the message property names.
 */
public static Set<String> getPropertyNames(JmsMessageFacade message,boolean excludeStandardJMSHeaders) throws JMSException {
  Set<String> names=new HashSet<String>();
  for (  Entry<String,PropertyIntercepter> entry : PROPERTY_INTERCEPTERS.entrySet()) {
    if (excludeStandardJMSHeaders && STANDARD_HEADERS.contains(entry.getKey())) {
      continue;
    }
    if (entry.getValue().propertyExists(message)) {
      names.add(entry.getKey());
    }
  }
  names.addAll(message.getPropertyNames());
  return names;
}
Program: 41097
Project: 41097
Buggy source:
/** 
 * For each of the currently configured message property intercepter instance a string key value is inserted into an Set and returned.
 * @param message the JmsMessageFacade instance to read property names from.
 * @return a Set<String> containing the names of all intercepted properties.
 * @throws JMSException if an error occurs while gathering the message property names.
 */
public static Set<String> getAllPropertyNames(JmsMessageFacade message) throws JMSException {
  Set<String> names=new HashSet<String>(PROPERTY_INTERCEPTERS.keySet());
  names.addAll(message.getPropertyNames());
  return names;
}

Fixed version (ground truth):
/** 
 * For each of the currently configured message property intercepter instance a string key value is inserted into an Set and returned.
 * @param message the JmsMessageFacade instance to read property names from.
 * @return a {@code Set<String>} containing the names of all intercepted properties.
 * @throws JMSException if an error occurs while gathering the message property names.
 */
public static Set<String> getAllPropertyNames(JmsMessageFacade message) throws JMSException {
  Set<String> names=new HashSet<String>(PROPERTY_INTERCEPTERS.keySet());
  names.addAll(message.getPropertyNames());
  return names;
}
Program: 41098
Project: 41098
Buggy source:
/** 
 * @param transport the transport type name to use when creating a new provider.
 */
public void setTransportType(String transportType){
  this.transportType=transportType;
}

Fixed version (ground truth):
/** 
 * @param transportType the transport type name to use when creating a new provider.
 */
public void setTransportType(String transportType){
  this.transportType=transportType;
}
Program: 41099
Project: 41099
Buggy source:
/** 
 * For each of the currently configured message property intercepter instance a string key value is inserted into an Set and returned if the property has a value and is available for a read operation. The Set returned may be manipulated by the receiver without impacting the facade, and an empty set will be returned if there are no matching properties.
 * @return a Set<String> containing the names of all intercepted properties with a value.
 */
public static Set<String> getPropertyNames(AmqpJmsMessageFacade message){
  Set<String> names=new HashSet<String>();
  for (  Entry<String,PropertyIntercepter> entry : PROPERTY_INTERCEPTERS.entrySet()) {
    if (entry.getValue().propertyExists(message)) {
      names.add(entry.getKey());
    }
  }
  return message.getApplicationPropertyNames(names);
}

Fixed version (ground truth):
/** 
 * For each of the currently configured message property intercepter instance a string key value is inserted into an Set and returned if the property has a value and is available for a read operation. The Set returned may be manipulated by the receiver without impacting the facade, and an empty set will be returned if there are no matching properties.
 * @return a {@code Set<String>} containing the names of all intercepted properties with a value.
 */
public static Set<String> getPropertyNames(AmqpJmsMessageFacade message){
  Set<String> names=new HashSet<String>();
  for (  Entry<String,PropertyIntercepter> entry : PROPERTY_INTERCEPTERS.entrySet()) {
    if (entry.getValue().propertyExists(message)) {
      names.add(entry.getKey());
    }
  }
  return message.getApplicationPropertyNames(names);
}
Program: 41100
Project: 41100
Buggy source:
/** 
 * For each of the currently configured message property intercepter instance a string key value is inserted into an Set and returned.
 * @return a Set<String> containing the names of all intercepted properties.
 */
public static Set<String> getAllPropertyNames(){
  return PROPERTY_INTERCEPTERS.keySet();
}

Fixed version (ground truth):
/** 
 * For each of the currently configured message property intercepter instance a string key value is inserted into an Set and returned.
 * @return a {@code Set<String>} containing the names of all intercepted properties.
 */
public static Set<String> getAllPropertyNames(){
  return PROPERTY_INTERCEPTERS.keySet();
}
Program: 41101
Project: 41101
Buggy source:
/** 
 * Sets the password value for this Mechanism.  The Mechanism can ignore this value if it does not utilize a password in it's authentication processing.
 * @param username The user name given.
 */
void setPassword(String value);

Fixed version (ground truth):
/** 
 * Sets the password value for this Mechanism.  The Mechanism can ignore this value if it does not utilize a password in it's authentication processing.
 * @param username The user name given.
 */
void setPassword(String username);
Program: 41102
Project: 41102
Buggy source:
/** 
 * Sets the user name value for this Mechanism.  The Mechanism can ignore this value if it does not utilize user name in it's authentication processing.
 * @param username The user name given.
 */
void setUsername(String value);

Fixed version (ground truth):
/** 
 * Sets the user name value for this Mechanism.  The Mechanism can ignore this value if it does not utilize user name in it's authentication processing.
 * @param username The user name given.
 */
void setUsername(String username);
Program: 41103
Project: 41103
Buggy source:
/** 
 * Encodes the value of string so that it looks like it would look like when it was provided in a selector.
 * @param string
 * @return the encoded String
 */
public static String encodeString(String s){
  StringBuffer b=new StringBuffer();
  b.append('\'');
  for (int i=0; i < s.length(); i++) {
    char c=s.charAt(i);
    if (c == '\'') {
      b.append(c);
    }
    b.append(c);
  }
  b.append('\'');
  return b.toString();
}

Fixed version (ground truth):
/** 
 * Encodes the value of string so that it looks like it would look like when it was provided in a selector.
 * @param s the original string
 * @return the encoded String
 */
public static String encodeString(String s){
  StringBuffer b=new StringBuffer();
  b.append('\'');
  for (int i=0; i < s.length(); i++) {
    char c=s.charAt(i);
    if (c == '\'') {
      b.append(c);
    }
    b.append(c);
  }
  b.append('\'');
  return b.toString();
}
Program: 41104
Project: 41104
Buggy source:
/** 
 * When using the   {@link java.net.InetAddress#getHostName()} method in anenvironment where neither a proper DNS lookup nor an <tt>/etc/hosts</tt> entry exists for a given host, the following exception will be thrown: <code> java.net.UnknownHostException: &lt;hostname&gt;: &lt;hostname&gt; at java.net.InetAddress.getLocalHost(InetAddress.java:1425) ... </code> Instead of just throwing an UnknownHostException and giving up, this method grabs a suitable hostname from the exception and prevents the exception from being thrown. If a suitable hostname cannot be acquired from the exception, only then is the <tt>UnknownHostException</tt> thrown.
 * @return The hostname
 * @throws UnknownHostException
 * @see {@link java.net.InetAddress#getLocalHost()}
 * @see {@link java.net.InetAddress#getHostName()}
 */
public static String getLocalHostName() throws UnknownHostException {
  try {
    return (InetAddress.getLocalHost()).getHostName();
  }
 catch (  UnknownHostException uhe) {
    String host=uhe.getMessage();
    if (host != null) {
      int colon=host.indexOf(':');
      if (colon > 0) {
        return host.substring(0,colon);
      }
    }
    throw uhe;
  }
}

Fixed version (ground truth):
/** 
 * When using the   {@link java.net.InetAddress#getHostName()} method in anenvironment where neither a proper DNS lookup nor an <tt>/etc/hosts</tt> entry exists for a given host, the following exception will be thrown: <code> java.net.UnknownHostException: &lt;hostname&gt;: &lt;hostname&gt; at java.net.InetAddress.getLocalHost(InetAddress.java:1425) ... </code> Instead of just throwing an UnknownHostException and giving up, this method grabs a suitable hostname from the exception and prevents the exception from being thrown. If a suitable hostname cannot be acquired from the exception, only then is the <tt>UnknownHostException</tt> thrown.
 * @return The hostname
 * @throws UnknownHostException
 * @see java.net.InetAddress#getLocalHost()
 * @see java.net.InetAddress#getHostName()
 */
public static String getLocalHostName() throws UnknownHostException {
  try {
    return (InetAddress.getLocalHost()).getHostName();
  }
 catch (  UnknownHostException uhe) {
    String host=uhe.getMessage();
    if (host != null) {
      int colon=host.indexOf(':');
      if (colon > 0) {
        return host.substring(0,colon);
      }
    }
    throw uhe;
  }
}
Program: 41105
Project: 41105
Buggy source:
/** 
 * Awaits the termination of the thread pool. <p/> This implementation will log every 2nd second at INFO level that we are waiting, so the end user can see we are not hanging in case it takes longer time to terminate the pool.
 * @param executorService the thread pool
 * @param shutdownAwaitTermination time in millis to use as timeout
 * @return <tt>true</tt> if the pool is terminated, or <tt>false</tt> if we timed out
 * @throws InterruptedException is thrown if we are interrupted during the waiting
 */
public static boolean awaitTermination(ExecutorService executorService,long shutdownAwaitTermination) throws InterruptedException {
  if (executorService == null) {
    return true;
  }
  StopWatch watch=new StopWatch();
  long interval=Math.min(2000,shutdownAwaitTermination);
  boolean done=false;
  while (!done && interval > 0) {
    if (executorService.awaitTermination(interval,TimeUnit.MILLISECONDS)) {
      done=true;
    }
 else {
      LOG.debug("String_Node_Str",TimeUtils.printDuration(watch.taken()),executorService);
      interval=Math.min(2000,shutdownAwaitTermination - watch.taken());
    }
  }
  return done;
}

Fixed version (ground truth):
/** 
 * Awaits the termination of the thread pool. <p> This implementation will log every 2nd second at INFO level that we are waiting, so the end user can see we are not hanging in case it takes longer time to terminate the pool.
 * @param executorService the thread pool
 * @param shutdownAwaitTermination time in millis to use as timeout
 * @return <tt>true</tt> if the pool is terminated, or <tt>false</tt> if we timed out
 * @throws InterruptedException is thrown if we are interrupted during the waiting
 */
public static boolean awaitTermination(ExecutorService executorService,long shutdownAwaitTermination) throws InterruptedException {
  if (executorService == null) {
    return true;
  }
  StopWatch watch=new StopWatch();
  long interval=Math.min(2000,shutdownAwaitTermination);
  boolean done=false;
  while (!done && interval > 0) {
    if (executorService.awaitTermination(interval,TimeUnit.MILLISECONDS)) {
      done=true;
    }
 else {
      LOG.debug("String_Node_Str",TimeUtils.printDuration(watch.taken()),executorService);
      interval=Math.min(2000,shutdownAwaitTermination - watch.taken());
    }
  }
  return done;
}
Program: 41106
Project: 41106
Buggy source:
/** 
 * Shutdown the given executor service graceful at first, and then aggressively if the await termination timeout was hit. <p/> Will try to perform an orderly shutdown by giving the running threads time to complete tasks, before going more aggressively by doing a  {@link #shutdownNow(java.util.concurrent.ExecutorService)} which forces a shutdown. Theparameter <tt>shutdownAwaitTermination</tt> is used as timeout value waiting for orderly shutdown to complete normally, before going aggressively.
 * @param executorService the executor service to shutdown
 * @param shutdownAwaitTermination timeout in millis to wait for orderly shutdown
 */
public static void shutdownGraceful(ExecutorService executorService,long shutdownAwaitTermination){
  doShutdown(executorService,shutdownAwaitTermination);
}

Fixed version (ground truth):
/** 
 * Shutdown the given executor service graceful at first, and then aggressively if the await termination timeout was hit. <p> Will try to perform an orderly shutdown by giving the running threads time to complete tasks, before going more aggressively by doing a  {@link #shutdownNow(java.util.concurrent.ExecutorService)} which forces a shutdown. Theparameter <tt>shutdownAwaitTermination</tt> is used as timeout value waiting for orderly shutdown to complete normally, before going aggressively.
 * @param executorService the executor service to shutdown
 * @param shutdownAwaitTermination timeout in millis to wait for orderly shutdown
 */
public static void shutdownGraceful(ExecutorService executorService,long shutdownAwaitTermination){
  doShutdown(executorService,shutdownAwaitTermination);
}
Program: 41107
Project: 41107
Buggy source:
/** 
 * Given a URI parse and extract any URI query options and return them as a Key / Value mapping. This method differs from the   {@link parseQuery} method in that it handles composite URItypes and will extract the URI options from the outermost composite URI.
 * @param uri The URI whose query should be extracted and processed.
 * @return A Mapping of the URI options.
 * @throws URISyntaxException
 */
public static Map<String,String> parseParameters(URI uri) throws URISyntaxException {
  if (!isCompositeURI(uri)) {
    if (uri.getQuery() == null) {
      return Collections.emptyMap();
    }
 else {
      try {
        return PropertyUtil.parseQuery(PropertyUtil.stripPrefix(uri.getQuery(),"String_Node_Str"));
      }
 catch (      Exception e) {
        throw new URISyntaxException(uri.toString(),e.getMessage());
      }
    }
  }
 else {
    CompositeData data=URISupport.parseComposite(uri);
    Map<String,String> parameters=new HashMap<String,String>();
    parameters.putAll(data.getParameters());
    if (parameters.isEmpty()) {
      parameters=Collections.emptyMap();
    }
    return parameters;
  }
}

Fixed version (ground truth):
/** 
 * Given a URI parse and extract any URI query options and return them as a Key / Value mapping. This method handles composite URI types and will extract the URI options from the outermost composite URI.
 * @param uri The URI whose query should be extracted and processed.
 * @return A Mapping of the URI options.
 * @throws URISyntaxException
 */
public static Map<String,String> parseParameters(URI uri) throws URISyntaxException {
  if (!isCompositeURI(uri)) {
    if (uri.getQuery() == null) {
      return Collections.emptyMap();
    }
 else {
      try {
        return PropertyUtil.parseQuery(PropertyUtil.stripPrefix(uri.getQuery(),"String_Node_Str"));
      }
 catch (      Exception e) {
        throw new URISyntaxException(uri.toString(),e.getMessage());
      }
    }
  }
 else {
    CompositeData data=URISupport.parseComposite(uri);
    Map<String,String> parameters=new HashMap<String,String>();
    parameters.putAll(data.getParameters());
    if (parameters.isEmpty()) {
      parameters=Collections.emptyMap();
    }
    return parameters;
  }
}
Program: 41108
Project: 41108
Buggy source:
/** 
 * @returns if the currently transaction has been marked as being failed.
 */
boolean isFailed();

Fixed version (ground truth):
/** 
 * @return if the currently transaction has been marked as being failed.
 */
boolean isFailed();
Program: 41109
Project: 41109
Buggy source:
/** 
 * Creates an instance of a basic JmsObjectMessage object.  The provider may either create the Message with the default generic internal message implementation or create a Provider specific instance that optimizes the access and marshaling of the message.
 * @returns a newly created and initialized JmsObjectMessage instance.
 * @throws JMSException if the provider cannot create the message for some reason.
 */
JmsObjectMessage createObjectMessage() throws JMSException ;

Fixed version (ground truth):
/** 
 * Creates an instance of a basic JmsObjectMessage object.  The provider may either create the Message with the default generic internal message implementation or create a Provider specific instance that optimizes the access and marshaling of the message.
 * @return a newly created and initialized JmsObjectMessage instance.
 * @throws JMSException if the provider cannot create the message for some reason.
 */
JmsObjectMessage createObjectMessage() throws JMSException ;
Program: 41110
Project: 41110
Buggy source:
/** 
 * Creates an instance of a basic JmsStreamMessage object.  The provider may either create the Message with the default generic internal message implementation or create a Provider specific instance that optimizes the access and marshaling of the message.
 * @returns a newly created and initialized JmsTextMessage instance.
 * @throws JMSException if the provider cannot create the message for some reason.
 */
JmsStreamMessage createStreamMessage() throws JMSException ;

Fixed version (ground truth):
/** 
 * Creates an instance of a basic JmsStreamMessage object.  The provider may either create the Message with the default generic internal message implementation or create a Provider specific instance that optimizes the access and marshaling of the message.
 * @return a newly created and initialized JmsTextMessage instance.
 * @throws JMSException if the provider cannot create the message for some reason.
 */
JmsStreamMessage createStreamMessage() throws JMSException ;
Program: 41111
Project: 41111
Buggy source:
/** 
 * Creates an instance of a basic JmsTextMessage object.  The provider may either create the Message with the default generic internal message implementation or create a Provider specific instance that optimizes the access and marshaling of the message.
 * @returns a newly created and initialized JmsTextMessage instance.
 * @throws JMSException if the provider cannot create the message for some reason.
 */
JmsTextMessage createTextMessage() throws JMSException ;

Fixed version (ground truth):
/** 
 * Creates an instance of a basic JmsTextMessage object.  The provider may either create the Message with the default generic internal message implementation or create a Provider specific instance that optimizes the access and marshaling of the message.
 * @return a newly created and initialized JmsTextMessage instance.
 * @throws JMSException if the provider cannot create the message for some reason.
 */
JmsTextMessage createTextMessage() throws JMSException ;
Program: 41112
Project: 41112
Buggy source:
/** 
 * Creates an instance of a basic JmsBytesMessage object.  The provider may either create the Message with the default generic internal message implementation or create a Provider specific instance that optimizes the access and marshaling of the message.
 * @returns a newly created and initialized JmsTextMessage instance.
 * @throws JMSException if the provider cannot create the message for some reason.
 */
JmsBytesMessage createBytesMessage() throws JMSException ;

Fixed version (ground truth):
/** 
 * Creates an instance of a basic JmsBytesMessage object.  The provider may either create the Message with the default generic internal message implementation or create a Provider specific instance that optimizes the access and marshaling of the message.
 * @return a newly created and initialized JmsTextMessage instance.
 * @throws JMSException if the provider cannot create the message for some reason.
 */
JmsBytesMessage createBytesMessage() throws JMSException ;
Program: 41113
Project: 41113
Buggy source:
/** 
 * Creates an instance of a basic JmsMapMessage object.  The provider may either create the Message with the default generic internal message implementation or create a Provider specific instance that optimizes the access and marshaling of the message.
 * @returns a newly created and initialized JmsTextMessage instance.
 * @throws JMSException if the provider cannot create the message for some reason.
 */
JmsMapMessage createMapMessage() throws JMSException ;

Fixed version (ground truth):
/** 
 * Creates an instance of a basic JmsMapMessage object.  The provider may either create the Message with the default generic internal message implementation or create a Provider specific instance that optimizes the access and marshaling of the message.
 * @return a newly created and initialized JmsTextMessage instance.
 * @throws JMSException if the provider cannot create the message for some reason.
 */
JmsMapMessage createMapMessage() throws JMSException ;
Program: 41114
Project: 41114
Buggy source:
/** 
 * Performs a copy of this message facade into a new instance.  Calling this method results in a call to reset() prior to the message copy meaning any in use streams will be closed on return.
 * @returns a deep copy of this Message Facade including a complete copyof the byte contents of the wrapped message.
 */
@Override JmsBytesMessageFacade copy() throws JMSException ;

Fixed version (ground truth):
/** 
 * Performs a copy of this message facade into a new instance.  Calling this method results in a call to reset() prior to the message copy meaning any in use streams will be closed on return.
 * @return a deep copy of this Message Facade including a complete copyof the byte contents of the wrapped message.
 */
@Override JmsBytesMessageFacade copy() throws JMSException ;
Program: 41115
Project: 41115
Buggy source:
/** 
 * Determines whether an item exists in this Map based message.
 * @returns true if the item exists in the Map, false otherwise.
 */
boolean itemExists(String key);

Fixed version (ground truth):
/** 
 * Determines whether an item exists in this Map based message.
 * @return true if the item exists in the Map, false otherwise.
 */
boolean itemExists(String key);
Program: 41116
Project: 41116
Buggy source:
/** 
 * Gets the value stored in the Map at the specified key.
 * @param key the key to use to access a value in the Map.
 * @returns the item associated with the given key, or null if not present.
 */
Object get(String key);

Fixed version (ground truth):
/** 
 * Gets the value stored in the Map at the specified key.
 * @param key the key to use to access a value in the Map.
 * @return the item associated with the given key, or null if not present.
 */
Object get(String key);
Program: 41117
Project: 41117
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: 41118
Project: 41118
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: 41119
Project: 41119
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: 41120
Project: 41120
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: 41121
Project: 41121
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: 41122
Project: 41122
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: 41123
Project: 41123
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: 41124
Project: 41124
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: 41125
Project: 41125
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: 41126
Project: 41126
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: 41127
Project: 41127
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: 41128
Project: 41128
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: 41129
Project: 41129
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: 41130
Project: 41130
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: 41131
Project: 41131
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: 41132
Project: 41132
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: 41133
Project: 41133
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: 41134
Project: 41134
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: 41135
Project: 41135
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: 41136
Project: 41136
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: 41137
Project: 41137
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: 41138
Project: 41138
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: 41139
Project: 41139
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: 41140
Project: 41140
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: 41141
Project: 41141
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: 41143
Project: 41143
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: 41144
Project: 41144
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;
}