nus-yam/ex-repair huggingface dataset:
Program: 104031
Project: 104031
Buggy source:
/** 
 * Checks if a packet is a replayed on based on its sequence number. This method supports a 64 packet history relative the the given sequence number. Sequence Number is guaranteed to be real (not faked) through  authentication.
 * @param seqNum sequence number of the packet
 * @return true if this sequence number indicates the packet is not areplayed one, false if not
 */
boolean checkReplay(int seqNo,long guessedIndex){
  long localIndex=(((long)this.roc) << 16) | this.seqNum;
  long delta=guessedIndex - localIndex;
  if (delta > 0) {
    return true;
  }
 else {
    if (-delta > REPLAY_WINDOW_SIZE) {
      return false;
    }
 else {
      if (((this.replayWindow >> (-delta)) & 0x1) != 0) {
        return false;
      }
 else {
        return true;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Checks if a packet is a replayed on based on its sequence number. This method supports a 64 packet history relative the the given sequence number. Sequence Number is guaranteed to be real (not faked) through  authentication.
 * @param seqNo sequence number of the packet
 * @return true if this sequence number indicates the packet is not areplayed one, false if not
 */
boolean checkReplay(int seqNo,long guessedIndex){
  long localIndex=(((long)this.roc) << 16) | this.seqNum;
  long delta=guessedIndex - localIndex;
  if (delta > 0) {
    return true;
  }
 else {
    if (-delta > REPLAY_WINDOW_SIZE) {
      return false;
    }
 else {
      if (((this.replayWindow >> (-delta)) & 0x1) != 0) {
        return false;
      }
 else {
        return true;
      }
    }
  }
}
Program: 104032
Project: 104032
Buggy source:
/** 
 * Perform Counter Mode AES encryption / decryption 
 * @param pkt the RTP packet to be encrypted / decrypted
 */
public void processPacketAESCM(RawPacket pkt){
  long ssrc=PacketManipulator.GetRTPSSRC(pkt);
  int seqNum=PacketManipulator.GetRTPSequenceNumber(pkt);
  long index=((long)this.roc << 16) | (long)seqNum;
  ivStore[0]=saltKey[0];
  ivStore[1]=saltKey[1];
  ivStore[2]=saltKey[2];
  ivStore[3]=saltKey[3];
  int i;
  for (i=4; i < 8; i++) {
    ivStore[i]=(byte)((0xFF & (ssrc >> ((7 - i) * 8))) ^ this.saltKey[i]);
  }
  for (i=8; i < 14; i++) {
    ivStore[i]=(byte)((0xFF & (byte)(index >> ((13 - i) * 8))) ^ this.saltKey[i]);
  }
  ivStore[14]=ivStore[15]=0;
  final int payloadOffset=PacketManipulator.GetRTPHeaderLength(pkt);
  final int payloadLength=PacketManipulator.GetRTPPayloadLength(pkt);
  cipherCtr.process(AEScipher,pkt.getBuffer(),pkt.getOffset() + payloadOffset,payloadLength,ivStore);
}

Fixed version (ground truth):
/** 
 * Perform Counter Mode AES encryption / decryption 
 * @param pkt the RTP packet to be encrypted / decrypted
 */
public void processPacketAESCM(RawPacket pkt){
  long ssrc=PacketManipulator.GetRTPSSRC(pkt);
  int seqNo=PacketManipulator.GetRTPSequenceNumber(pkt);
  long index=((long)this.roc << 16) | seqNo;
  ivStore[0]=saltKey[0];
  ivStore[1]=saltKey[1];
  ivStore[2]=saltKey[2];
  ivStore[3]=saltKey[3];
  int i;
  for (i=4; i < 8; i++) {
    ivStore[i]=(byte)((0xFF & (ssrc >> ((7 - i) * 8))) ^ this.saltKey[i]);
  }
  for (i=8; i < 14; i++) {
    ivStore[i]=(byte)((0xFF & (byte)(index >> ((13 - i) * 8))) ^ this.saltKey[i]);
  }
  ivStore[14]=ivStore[15]=0;
  final int payloadOffset=PacketManipulator.GetRTPHeaderLength(pkt);
  final int payloadLength=PacketManipulator.GetRTPPayloadLength(pkt);
  cipherCtr.process(AEScipher,pkt.getBuffer(),pkt.getOffset() + payloadOffset,payloadLength,ivStore);
}
Program: 104033
Project: 104033
Buggy source:
public RawPacket transform(RawPacket pkt){
  long ssrc=PacketManipulator.GetRTPSSRC(pkt);
  SRTPCryptoContext context=(SRTPCryptoContext)this.contexts.get(ssrc);
  if (context == null) {
    context=this.engine.getDefaultContext().deriveContext(ssrc,0,0);
    if (context != null) {
      context.deriveSrtpKeys(0);
      this.contexts.put(ssrc,context);
    }
  }
  if (context != null) {
    context.transformPacket(pkt);
  }
  return pkt;
}

Fixed version (ground truth):
public RawPacket transform(RawPacket pkt){
  long ssrc=PacketManipulator.GetRTPSSRC(pkt);
  SRTPCryptoContext context=this.contexts.get(ssrc);
  if (context == null) {
    context=this.engine.getDefaultContext().deriveContext(ssrc,0,0);
    if (context != null) {
      context.deriveSrtpKeys(0);
      this.contexts.put(ssrc,context);
    }
  }
  if (context != null) {
    context.transformPacket(pkt);
  }
  return pkt;
}
Program: 104034
Project: 104034
Buggy source:
public RawPacket reverseTransform(RawPacket pkt){
  long ssrc=PacketManipulator.GetRTPSSRC(pkt);
  int seqNum=PacketManipulator.GetRTPSequenceNumber(pkt);
  SRTPCryptoContext context=(SRTPCryptoContext)this.contexts.get(ssrc);
  if (context == null) {
    context=this.engine.getDefaultContext().deriveContext(ssrc,0,0);
    if (context != null) {
      context.deriveSrtpKeys(seqNum);
      this.contexts.put(ssrc,context);
    }
  }
  if (context != null) {
    boolean validPacket=context.reverseTransformPacket(pkt);
    if (!validPacket) {
      return null;
    }
  }
  return pkt;
}

Fixed version (ground truth):
public RawPacket reverseTransform(RawPacket pkt){
  long ssrc=PacketManipulator.GetRTPSSRC(pkt);
  int seqNum=PacketManipulator.GetRTPSequenceNumber(pkt);
  SRTPCryptoContext context=this.contexts.get(ssrc);
  if (context == null) {
    context=this.engine.getDefaultContext().deriveContext(ssrc,0,0);
    if (context != null) {
      context.deriveSrtpKeys(seqNum);
      this.contexts.put(ssrc,context);
    }
  }
  if (context != null) {
    boolean validPacket=context.reverseTransformPacket(pkt);
    if (!validPacket) {
      return null;
    }
  }
  return pkt;
}
Program: 104036
Project: 104036
Buggy source:
/** 
 * Returns true if <tt>obj</tt> is the same object as this AddressPreference or is at least an instance of AddressPreference and has the same numerical value. In all other cases the method returns false.
 * @param obj the object to compare with
 * @return true if both objects represent the same preference value andfalse otherwise.
 */
public boolean equals(Object obj){
  if (!(obj instanceof AddressPreference) || obj == null)   return false;
  if (obj == this || ((AddressPreference)obj).preference == preference)   return true;
  return false;
}

Fixed version (ground truth):
/** 
 * Returns true if <tt>obj</tt> is the same object as this AddressPreference or is at least an instance of AddressPreference and has the same numerical value. In all other cases the method returns false.
 * @param obj the object to compare with
 * @return true if both objects represent the same preference value andfalse otherwise.
 */
public boolean equals(Object obj){
  if (!(obj instanceof AddressPreference))   return false;
  if (obj == this || ((AddressPreference)obj).preference == preference)   return true;
  return false;
}
Program: 104037
Project: 104037
Buggy source:
/** 
 * Compares this address preference with the specified object for order. Returns a negative integer, zero, or a positive integer as this AddressPreference is less than, equal to, or greater than the specified object.<p>
 * @param o the Object to be compared.
 * @return  a negative integer, zero, or a positive integer as this objectis less than, equal to, or greater than the specified object.
 * @throws ClassCastException if the specified object's type is not aninstance or a descendant of AddressPreference.
 */
public int compareTo(Object o){
  AddressPreference other=(AddressPreference)o;
  return this.preference - other.preference;
}

Fixed version (ground truth):
/** 
 * Compares this address preference with the specified object for order. Returns a negative integer, zero, or a positive integer as this AddressPreference is less than, equal to, or greater than the specified object.<p>
 * @param o the Object to be compared.
 * @return  a negative integer, zero, or a positive integer as this objectis less than, equal to, or greater than the specified object.
 * @throws ClassCastException if the specified object's type is not aninstance or a descendant of AddressPreference.
 */
public int compareTo(AddressPreference o){
  return this.preference - o.preference;
}
Program: 104038
Project: 104038
Buggy source:
/** 
 * Creates a NetworkAddressManager, starts it, and registers it as a NetworkAddressManagerService.
 * @param bundleContext  OSGI bundle context
 * @throws Exception if starting the NetworkAddressManagerFails.
 */
public void start(BundleContext bundleContext) throws Exception {
  try {
    logger.logEntry();
    this.bundleContext=bundleContext;
    networkAMS=new NetworkAddressManagerServiceImpl();
    networkAMS.start();
    logger.info("String_Node_Str");
    bundleContext.registerService(NetworkAddressManagerService.class.getName(),networkAMS,null);
    logger.info("String_Node_Str");
  }
  finally {
    logger.logExit();
  }
}

Fixed version (ground truth):
/** 
 * Creates a NetworkAddressManager, starts it, and registers it as a NetworkAddressManagerService.
 * @param bundleContext  OSGI bundle context
 * @throws Exception if starting the NetworkAddressManagerFails.
 */
public void start(BundleContext bundleContext) throws Exception {
  try {
    logger.logEntry();
    NetaddrActivator.bundleContext=bundleContext;
    networkAMS=new NetworkAddressManagerServiceImpl();
    networkAMS.start();
    logger.info("String_Node_Str");
    bundleContext.registerService(NetworkAddressManagerService.class.getName(),networkAMS,null);
    logger.info("String_Node_Str");
  }
  finally {
    logger.logExit();
  }
}
Program: 104039
Project: 104039
Buggy source:
/** 
 * Returns the set of actions registered for this event notification.
 * @return the set of actions registered for this event notification
 */
public Map getActions(){
  return actionsTable;
}

Fixed version (ground truth):
/** 
 * Returns the set of actions registered for this event notification.
 * @return the set of actions registered for this event notification
 */
public Map<String,Action> getActions(){
  return actionsTable;
}
Program: 104040
Project: 104040
Buggy source:
/** 
 * Returns the <tt>Action</tt> corresponding to the given <tt>actionType</tt>.
 * @param actionType one of NotificationService.ACTION_XXX constants
 * @return the <tt>Action</tt> corresponding to the given<tt>actionType</tt>
 */
public Action getAction(String actionType){
  return (Action)actionsTable.get(actionType);
}

Fixed version (ground truth):
/** 
 * Returns the <tt>Action</tt> corresponding to the given <tt>actionType</tt>.
 * @param actionType one of NotificationService.ACTION_XXX constants
 * @return the <tt>Action</tt> corresponding to the given<tt>actionType</tt>
 */
public Action getAction(String actionType){
  return actionsTable.get(actionType);
}
Program: 104042
Project: 104042
Buggy source:
/** 
 * Notifies all registered <tt>NotificationChangeListener</tt>s that a <tt>NotificationActionTypeEvent</tt> has occurred.
 * @param eventType the type of the event, which is one of ACTION_XXXconstants declared in the <tt>NotificationActionTypeEvent</tt> class.
 * @param sourceEventType the <tt>eventType</tt>, which is the parent of theaction
 * @param sourceActionType the <tt>actionType</tt>, for which the event isabout
 * @param actionHandler the notification action handler
 */
private void fireNotificationActionTypeEvent(String eventType,String sourceEventType,String sourceActionType,NotificationActionHandler actionHandler){
  NotificationActionTypeEvent event=new NotificationActionTypeEvent(this,eventType,sourceEventType,sourceActionType,actionHandler);
  NotificationChangeListener listener;
  for (int i=0; i < changeListeners.size(); i++) {
    listener=(NotificationChangeListener)changeListeners.get(i);
    if (eventType.equals(NotificationActionTypeEvent.ACTION_ADDED)) {
      listener.actionAdded(event);
    }
 else     if (eventType.equals(NotificationActionTypeEvent.ACTION_REMOVED)) {
      listener.actionRemoved(event);
    }
 else     if (eventType.equals(NotificationActionTypeEvent.ACTION_CHANGED)) {
      listener.actionChanged(event);
    }
  }
}

Fixed version (ground truth):
/** 
 * Notifies all registered <tt>NotificationChangeListener</tt>s that a <tt>NotificationActionTypeEvent</tt> has occurred.
 * @param eventType the type of the event, which is one of ACTION_XXXconstants declared in the <tt>NotificationActionTypeEvent</tt> class.
 * @param sourceEventType the <tt>eventType</tt>, which is the parent of theaction
 * @param sourceActionType the <tt>actionType</tt>, for which the event isabout
 * @param actionHandler the notification action handler
 */
private void fireNotificationActionTypeEvent(String eventType,String sourceEventType,String sourceActionType,NotificationActionHandler actionHandler){
  NotificationActionTypeEvent event=new NotificationActionTypeEvent(this,eventType,sourceEventType,sourceActionType,actionHandler);
  NotificationChangeListener listener;
  for (int i=0; i < changeListeners.size(); i++) {
    listener=changeListeners.get(i);
    if (eventType.equals(NotificationActionTypeEvent.ACTION_ADDED)) {
      listener.actionAdded(event);
    }
 else     if (eventType.equals(NotificationActionTypeEvent.ACTION_REMOVED)) {
      listener.actionRemoved(event);
    }
 else     if (eventType.equals(NotificationActionTypeEvent.ACTION_CHANGED)) {
      listener.actionChanged(event);
    }
  }
}
Program: 104043
Project: 104043
Buggy source:
/** 
 * Returns the notification handler corresponding to the given <tt>eventType</tt> and <tt>actionType</tt>.
 * @param eventType the type of the event that we'd like to retrieve.
 * @param actionType the type of the action that we'd like to retrieve adescriptor for.
 * @return the notification handler of the action to be executedwhen an event of the specified type has occurred.
 */
public NotificationActionHandler getEventNotificationActionHandler(String eventType,String actionType){
  EventNotification notification=(EventNotification)notificationsTable.get(eventType);
  if (notification == null)   return null;
  EventNotification.Action action=notification.getAction(actionType);
  if (action == null)   return null;
  return action.getActionHandler();
}

Fixed version (ground truth):
/** 
 * Returns the notification handler corresponding to the given <tt>eventType</tt> and <tt>actionType</tt>.
 * @param eventType the type of the event that we'd like to retrieve.
 * @param actionType the type of the action that we'd like to retrieve adescriptor for.
 * @return the notification handler of the action to be executedwhen an event of the specified type has occurred.
 */
public NotificationActionHandler getEventNotificationActionHandler(String eventType,String actionType){
  EventNotification notification=notificationsTable.get(eventType);
  if (notification == null)   return null;
  EventNotification.Action action=notification.getAction(actionType);
  if (action == null)   return null;
  return action.getActionHandler();
}
Program: 104044
Project: 104044
Buggy source:
/** 
 * Finds the <tt>EventNotification</tt> corresponding to the given <tt>eventType</tt> and returns its isActive status.
 * @param eventType the name of the event (as defined by the plugin that'sregistered it) that we are checking.
 * @return <code>true</code> if actions for the specified <tt>eventType</tt>are activated, <code>false</code> - otherwise. If the given <tt>eventType</tt> is not contained in the list of registered event types - returns <code>false</code>.
 */
public boolean isActive(String eventType){
  EventNotification eventNotification=(EventNotification)notificationsTable.get(eventType);
  if (eventNotification == null)   return false;
  return eventNotification.isActive();
}

Fixed version (ground truth):
/** 
 * Finds the <tt>EventNotification</tt> corresponding to the given <tt>eventType</tt> and returns its isActive status.
 * @param eventType the name of the event (as defined by the plugin that'sregistered it) that we are checking.
 * @return <code>true</code> if actions for the specified <tt>eventType</tt>are activated, <code>false</code> - otherwise. If the given <tt>eventType</tt> is not contained in the list of registered event types - returns <code>false</code>.
 */
public boolean isActive(String eventType){
  EventNotification eventNotification=notificationsTable.get(eventType);
  if (eventNotification == null)   return false;
  return eventNotification.isActive();
}
Program: 104045
Project: 104045
Buggy source:
/** 
 * Deletes all registered events and actions  and registers and saves the default events as current.
 */
public void restoreDefaults(){
  Set<String> eventTypes=((Hashtable<String,EventNotification>)notificationsTable.clone()).keySet();
  for (  String eventType : eventTypes) {
    EventNotification notification=notificationsTable.get(eventType);
    Vector actionsToRemove=new Vector(notification.getActions().keySet());
    Iterator actionIter=actionsToRemove.iterator();
    while (actionIter.hasNext()) {
      String actionType=(String)actionIter.next();
      removeEventNotificationAction(eventType,actionType);
    }
    removeEventNotification(eventType);
  }
  for (  Map.Entry<String,EventNotification> entry : defaultNotificationsTable.entrySet()) {
    String eventType=entry.getKey();
    EventNotification notification=entry.getValue();
    Iterator actionIter=notification.getActions().keySet().iterator();
    while (actionIter.hasNext()) {
      String actionType=(String)actionIter.next();
      registerNotificationForEvent(eventType,actionType,notification.getAction(actionType).getActionHandler());
    }
  }
}

Fixed version (ground truth):
/** 
 * Deletes all registered events and actions  and registers and saves the default events as current.
 */
public void restoreDefaults(){
  Set<String> eventTypes=((Hashtable<String,EventNotification>)notificationsTable.clone()).keySet();
  for (  String eventType : eventTypes) {
    EventNotification notification=notificationsTable.get(eventType);
    Vector<String> actionsToRemove=new Vector<String>(notification.getActions().keySet());
    Iterator<String> actionIter=actionsToRemove.iterator();
    while (actionIter.hasNext()) {
      String actionType=actionIter.next();
      removeEventNotificationAction(eventType,actionType);
    }
    removeEventNotification(eventType);
  }
  for (  Map.Entry<String,EventNotification> entry : defaultNotificationsTable.entrySet()) {
    String eventType=entry.getKey();
    EventNotification notification=entry.getValue();
    Iterator<String> actionIter=notification.getActions().keySet().iterator();
    while (actionIter.hasNext()) {
      String actionType=actionIter.next();
      registerNotificationForEvent(eventType,actionType,notification.getAction(actionType).getActionHandler());
    }
  }
}
Program: 104047
Project: 104047
Buggy source:
/** 
 * Returns an iterator over a list of all events registered in this notification service. Each line in the returned list consists of a String, representing the name of the event (as defined by the plugin that registered it).
 * @return an iterator over a list of all events registered in thisnotifications service
 */
public Iterator getRegisteredEvents(){
  return Collections.unmodifiableSet(notificationsTable.keySet()).iterator();
}

Fixed version (ground truth):
/** 
 * Returns an iterator over a list of all events registered in this notification service. Each line in the returned list consists of a String, representing the name of the event (as defined by the plugin that registered it).
 * @return an iterator over a list of all events registered in thisnotifications service
 */
public Iterator<String> getRegisteredEvents(){
  return Collections.unmodifiableSet(notificationsTable.keySet()).iterator();
}
Program: 104048
Project: 104048
Buggy source:
/** 
 * Removes the given actionType from the list of actions registered for the given <tt>eventType</tt>.
 * @param eventType the name of the event (as defined by the plugin that'sregistering it) for which we'll remove the notification.
 * @param actionType the type of the action that is to be executed when thespecified event occurs (could be one of the ACTION_XXX fields).
 */
public void removeEventNotificationAction(String eventType,String actionType){
  EventNotification notification=(EventNotification)notificationsTable.get(eventType);
  if (notification == null)   return;
  Action action=notification.getAction(actionType);
  if (action == null)   return;
  notification.removeAction(actionType);
  saveNotification(eventType,actionType,action.getActionHandler(),false,false);
  fireNotificationActionTypeEvent(NotificationActionTypeEvent.ACTION_REMOVED,eventType,action.getActionType(),action.getActionHandler());
}

Fixed version (ground truth):
/** 
 * Removes the given actionType from the list of actions registered for the given <tt>eventType</tt>.
 * @param eventType the name of the event (as defined by the plugin that'sregistering it) for which we'll remove the notification.
 * @param actionType the type of the action that is to be executed when thespecified event occurs (could be one of the ACTION_XXX fields).
 */
public void removeEventNotificationAction(String eventType,String actionType){
  EventNotification notification=notificationsTable.get(eventType);
  if (notification == null)   return;
  Action action=notification.getAction(actionType);
  if (action == null)   return;
  notification.removeAction(actionType);
  saveNotification(eventType,actionType,action.getActionHandler(),false,false);
  fireNotificationActionTypeEvent(NotificationActionTypeEvent.ACTION_REMOVED,eventType,action.getActionType(),action.getActionHandler());
}
Program: 104051
Project: 104051
Buggy source:
/** 
 * Encodes the input buffer passing it to the output one
 * @param inputBuffer Buffer
 * @param outputBuffer Buffer
 * @return int
 */
public int process(Buffer inputBuffer,Buffer outputBuffer){
  if (!checkInputBuffer(inputBuffer)) {
    return BUFFER_PROCESSED_FAILED;
  }
  if (isEOM(inputBuffer)) {
    propagateEOM(outputBuffer);
    return BUFFER_PROCESSED_OK;
  }
  Format newFormat=inputBuffer.getFormat();
  if (lastFormat != newFormat) {
    initConverter((AudioFormat)newFormat);
  }
  int inpLength=inputBuffer.getLength();
  int outLength=calculateOutputSize(inputBuffer.getLength());
  byte[] inpData=(byte[])inputBuffer.getData();
  byte[] outData=validateByteArraySize(outputBuffer,outLength);
  pcm162alaw(inpData,inputBuffer.getOffset(),outData,0,outData.length,bigEndian);
  updateOutput(outputBuffer,outputFormat,outLength,0);
  return BUFFER_PROCESSED_OK;
}

Fixed version (ground truth):
/** 
 * Encodes the input buffer passing it to the output one
 * @param inputBuffer Buffer
 * @param outputBuffer Buffer
 * @return int
 */
public int process(Buffer inputBuffer,Buffer outputBuffer){
  if (!checkInputBuffer(inputBuffer)) {
    return BUFFER_PROCESSED_FAILED;
  }
  if (isEOM(inputBuffer)) {
    propagateEOM(outputBuffer);
    return BUFFER_PROCESSED_OK;
  }
  Format newFormat=inputBuffer.getFormat();
  if (lastFormat != newFormat) {
    initConverter((AudioFormat)newFormat);
  }
  int outLength=calculateOutputSize(inputBuffer.getLength());
  byte[] inpData=(byte[])inputBuffer.getData();
  byte[] outData=validateByteArraySize(outputBuffer,outLength);
  pcm162alaw(inpData,inputBuffer.getOffset(),outData,0,outData.length,bigEndian);
  updateOutput(outputBuffer,outputFormat,outLength,0);
  return BUFFER_PROCESSED_OK;
}
Program: 104052
Project: 104052
Buggy source:
protected Format[] getMatchingOutputFormats(Format in){
  AudioFormat inFormat=(AudioFormat)in;
  int channels=inFormat.getChannels();
  int sampleRate=(int)(inFormat.getSampleRate());
  supportedOutputFormats=new AudioFormat[]{new AudioFormat(AudioFormat.ALAW,sampleRate,8,1,Format.NOT_SPECIFIED,Format.NOT_SPECIFIED)};
  return supportedOutputFormats;
}

Fixed version (ground truth):
protected Format[] getMatchingOutputFormats(Format in){
  AudioFormat inFormat=(AudioFormat)in;
  int sampleRate=(int)(inFormat.getSampleRate());
  supportedOutputFormats=new AudioFormat[]{new AudioFormat(AudioFormat.ALAW,sampleRate,8,1,Format.NOT_SPECIFIED,Format.NOT_SPECIFIED)};
  return supportedOutputFormats;
}
Program: 104053
Project: 104053
Buggy source:
public java.lang.Object[] getControls(){
  if (controls == null) {
    controls=new Control[1];
    controls[0]=new PacketSizeAdapter(this,packetSize,true);
  }
  return (Object[])controls;
}

Fixed version (ground truth):
public java.lang.Object[] getControls(){
  if (controls == null) {
    controls=new Control[1];
    controls[0]=new PacketSizeAdapter(this,packetSize,true);
  }
  return controls;
}
Program: 104054
Project: 104054
Buggy source:
public java.lang.Object[] getControls(){
  if (controls == null) {
    controls=new Control[1];
    controls[0]=new com.sun.media.controls.SilenceSuppressionAdapter(this,false,false);
  }
  return (Object[])controls;
}

Fixed version (ground truth):
public java.lang.Object[] getControls(){
  if (controls == null) {
    controls=new Control[1];
    controls[0]=new com.sun.media.controls.SilenceSuppressionAdapter(this,false,false);
  }
  return controls;
}
Program: 104055
Project: 104055
Buggy source:
public java.lang.Object[] getControls(){
  if (controls == null) {
    controls=new Control[1];
    controls[0]=new com.sun.media.controls.SilenceSuppressionAdapter(this,false,false);
  }
  return (Object[])controls;
}

Fixed version (ground truth):
public java.lang.Object[] getControls(){
  if (controls == null) {
    controls=new Control[1];
    controls[0]=new com.sun.media.controls.SilenceSuppressionAdapter(this,false,false);
  }
  return controls;
}
Program: 104056
Project: 104056
Buggy source:
protected Format[] getMatchingOutputFormats(Format in){
  AudioFormat af=(AudioFormat)in;
  supportedOutputFormats=new AudioFormat[]{new AudioFormat(Constants.ILBC_RTP,8000.0,16,1,AudioFormat.LITTLE_ENDIAN,AudioFormat.SIGNED)};
  return supportedOutputFormats;
}

Fixed version (ground truth):
protected Format[] getMatchingOutputFormats(Format in){
  supportedOutputFormats=new AudioFormat[]{new AudioFormat(Constants.ILBC_RTP,8000.0,16,1,AudioFormat.LITTLE_ENDIAN,AudioFormat.SIGNED)};
  return supportedOutputFormats;
}
Program: 104057
Project: 104057
Buggy source:
public static float gaindequant(int index,float maxIn,int cblen){
  float scale;
  scale=(float)(float)Math.abs(maxIn);
  if (scale < 0.1) {
    scale=(float)0.1;
  }
  if (cblen == 8) {
    return scale * ilbc_constants.gain_sq3Tbl[index];
  }
 else   if (cblen == 16) {
    return scale * ilbc_constants.gain_sq4Tbl[index];
  }
 else   if (cblen == 32) {
    return scale * ilbc_constants.gain_sq5Tbl[index];
  }
  return 0.0f;
}

Fixed version (ground truth):
public static float gaindequant(int index,float maxIn,int cblen){
  float scale;
  scale=Math.abs(maxIn);
  if (scale < 0.1) {
    scale=(float)0.1;
  }
  if (cblen == 8) {
    return scale * ilbc_constants.gain_sq3Tbl[index];
  }
 else   if (cblen == 16) {
    return scale * ilbc_constants.gain_sq4Tbl[index];
  }
 else   if (cblen == 32) {
    return scale * ilbc_constants.gain_sq5Tbl[index];
  }
  return 0.0f;
}
Program: 104058
Project: 104058
Buggy source:
public static void interpolate(float out[],float in1[],float in2[],int in2_idx,float coef,int length){
  int i;
  float invcoef;
  invcoef=(float)1.0f - coef;
  for (i=0; i < length; i++) {
    out[i]=coef * in1[i] + invcoef * in2[i + in2_idx];
  }
}

Fixed version (ground truth):
public static void interpolate(float out[],float in1[],float in2[],int in2_idx,float coef,int length){
  int i;
  float invcoef;
  invcoef=1.0f - coef;
  for (i=0; i < length; i++) {
    out[i]=coef * in1[i] + invcoef * in2[i + in2_idx];
  }
}
Program: 104059
Project: 104059
Buggy source:
public static void iCBConstruct(float decvector[],int decvector_idx,int index[],int index_idx,int gain_index[],int gain_index_idx,float mem[],int mem_idx,int lMem,int veclen,int nStages){
  int j, k;
  float[] gain=new float[ilbc_constants.CB_NSTAGES];
  float[] cbvec=new float[ilbc_constants.SUBL];
  gain[0]=gaindequant(gain_index[gain_index_idx + 0],1.0f,32);
  if (nStages > 1) {
    gain[1]=gaindequant(gain_index[gain_index_idx + 1],(float)(float)Math.abs(gain[0]),16);
  }
  if (nStages > 2) {
    gain[2]=gaindequant(gain_index[gain_index_idx + 2],(float)(float)Math.abs(gain[1]),8);
  }
  getCBvec(cbvec,mem,mem_idx,index[index_idx + 0],lMem,veclen);
  for (j=0; j < veclen; j++) {
    decvector[decvector_idx + j]=gain[0] * cbvec[j];
  }
  if (nStages > 1) {
    for (k=1; k < nStages; k++) {
      getCBvec(cbvec,mem,mem_idx,index[index_idx + k],lMem,veclen);
      for (j=0; j < veclen; j++) {
        decvector[decvector_idx + j]+=gain[k] * cbvec[j];
      }
    }
  }
}

Fixed version (ground truth):
public static void iCBConstruct(float decvector[],int decvector_idx,int index[],int index_idx,int gain_index[],int gain_index_idx,float mem[],int mem_idx,int lMem,int veclen,int nStages){
  int j, k;
  float[] gain=new float[ilbc_constants.CB_NSTAGES];
  float[] cbvec=new float[ilbc_constants.SUBL];
  gain[0]=gaindequant(gain_index[gain_index_idx + 0],1.0f,32);
  if (nStages > 1) {
    gain[1]=gaindequant(gain_index[gain_index_idx + 1],Math.abs(gain[0]),16);
  }
  if (nStages > 2) {
    gain[2]=gaindequant(gain_index[gain_index_idx + 2],Math.abs(gain[1]),8);
  }
  getCBvec(cbvec,mem,mem_idx,index[index_idx + 0],lMem,veclen);
  for (j=0; j < veclen; j++) {
    decvector[decvector_idx + j]=gain[0] * cbvec[j];
  }
  if (nStages > 1) {
    for (k=1; k < nStages; k++) {
      getCBvec(cbvec,mem,mem_idx,index[index_idx + k],lMem,veclen);
      for (j=0; j < veclen; j++) {
        decvector[decvector_idx + j]+=gain[k] * cbvec[j];
      }
    }
  }
}
Program: 104063
Project: 104063
Buggy source:
public boolean isContactListSupported(){
  return !chatRoomWrapper.getChatRoom().isSystem();
}

Fixed version (ground truth):
public boolean isContactListSupported(){
  ChatRoom chatRoom=chatRoomWrapper.getChatRoom();
  return !chatRoom.isSystem() && !ConferenceChatManager.isPrivate(chatRoom);
}
Program: 104064
Project: 104064
Buggy source:
/** 
 * Creates a room with the named <tt>roomName</tt> and according to the specified <tt>roomProperties</tt> on the server that this protocol provider is currently connected to.
 * @param roomName the name of the <tt>ChatRoom</tt> to create.
 * @param roomProperties properties specifying how the room should becreated. Contains list of invitees and the invitation message.
 * @throws OperationFailedException if the room couldn't be created forsome reason (e.g. room already exists; user already joined to an existent room or user has no permissions to create a chat room).
 * @throws OperationNotSupportedException if chat room creation is notsupported by this server
 * @return ChatRoom the chat room that we've just created.
 */
public ChatRoom createChatRoom(String roomName,Hashtable roomProperties) throws OperationFailedException, OperationNotSupportedException {
  ChatRoom chatRoom=null;
  ChatRoomManager chatRoomManager=icqProvider.getAimConnection().getChatRoomManager();
  ChatRoomSession chatRoomSession=chatRoomManager.joinRoom(roomName);
  if (chatRoomSession != null) {
    chatRoom=new ChatRoomIcqImpl(roomName,chatRoomSession,icqProvider);
  }
  return chatRoom;
}

Fixed version (ground truth):
/** 
 * Creates a room with the named <tt>roomName</tt> and according to the specified <tt>roomProperties</tt> on the server that this protocol provider is currently connected to.
 * @param roomName the name of the <tt>ChatRoom</tt> to create.
 * @param roomProperties properties specifying how the room should becreated. Contains list of invitees and the invitation message.
 * @throws OperationFailedException if the room couldn't be created forsome reason (e.g. room already exists; user already joined to an existent room or user has no permissions to create a chat room).
 * @throws OperationNotSupportedException if chat room creation is notsupported by this server
 * @return ChatRoom the chat room that we've just created.
 */
public ChatRoom createChatRoom(String roomName,Map<String,Object> roomProperties) throws OperationFailedException, OperationNotSupportedException {
  ChatRoom chatRoom=null;
  ChatRoomManager chatRoomManager=icqProvider.getAimConnection().getChatRoomManager();
  ChatRoomSession chatRoomSession=chatRoomManager.joinRoom(roomName);
  if (chatRoomSession != null) {
    chatRoom=new ChatRoomIcqImpl(roomName,chatRoomSession,icqProvider);
  }
  return chatRoom;
}
Program: 104065
Project: 104065
Buggy source:
/** 
 * Determines whether this chat room should be stored in the configuration file or not. If the chat room is persistent it still will be shown after a restart in the chat room list. A non-persistent chat room will be only in the chat room list until the the program is running.
 * @return true if this chat room is persistent, false otherwise
 */
public boolean isPersistent(){
  return true;
}

Fixed version (ground truth):
/** 
 * Determines whether this chat room should be stored in the configuration file or not. If the chat room is persistent it still will be shown after a restart in the chat room list. A non-persistent chat room will be only in the chat room list until the the program is running.
 * @return true if this chat room is persistent, false otherwise
 */
public boolean isPersistent(){
  return !isPrivate();
}
Program: 104066
Project: 104066
Buggy source:
/** 
 * Tests if this chat room is joined
 * @param chatRoom the chat room we want to test
 * @return true if the chat room is joined, false otherwise
 */
protected boolean isJoined(ChatRoomIrcImpl chatRoom){
  if (ircMUCOpSet.findSystemRoom().equals(chatRoom))   return isConnected();
  if (chatRoom.isPrivate())   return true;
  if (this.isConnected()) {
    String[] channels=this.getChannels();
    for (int i=0; i < channels.length; i++) {
      if (chatRoom.getName().equals(channels[i])) {
        return true;
      }
    }
    return false;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Tests if this chat room is joined
 * @param chatRoom the chat room we want to test
 * @return true if the chat room is joined, false otherwise
 */
protected boolean isJoined(ChatRoomIrcImpl chatRoom){
  if (ircMUCOpSet.findSystemRoom().equals(chatRoom))   return isConnected();
  if (chatRoom.isPrivate())   return true;
  if (this.isConnected()) {
    String[] channels=this.getChannels();
    for (    String channel : channels) {
      if (chatRoom.getName().equals(channel))       return true;
    }
    return false;
  }
 else {
    return false;
  }
}
Program: 104067
Project: 104067
Buggy source:
/** 
 * This method is called whenever someone (possibly us) leaves a channel which we are on.
 * @param channel The channel which somebody parted from.
 * @param sender The nick of the user who parted from the channel.
 * @param login The login of the user who parted from the channel.
 * @param hostname The host name of the user who parted from the channel.
 */
protected void onPart(String channel,String sender,String login,String hostname){
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str" + channel + "String_Node_Str"+ sender+ "String_Node_Str"+ login+ "String_Node_Str"+ hostname);
  ChatRoomIrcImpl chatRoom=(ChatRoomIrcImpl)ircMUCOpSet.findRoom(channel);
  if (chatRoom.getUserNickname().equals(sender)) {
    ircMUCOpSet.fireLocalUserPresenceEvent(chatRoom,LocalUserChatRoomPresenceChangeEvent.LOCAL_USER_LEFT,"String_Node_Str");
    Iterator members=chatRoom.getMembers().iterator();
    while (members.hasNext()) {
      ChatRoomMember member=(ChatRoomMember)members.next();
      chatRoom.fireMemberPresenceEvent(member,null,ChatRoomMemberPresenceChangeEvent.MEMBER_LEFT,"String_Node_Str");
    }
    chatRoom.clearChatRoomMemberList();
  }
 else {
    ChatRoomMember member=chatRoom.getChatRoomMember(sender);
    if (member == null)     return;
    chatRoom.removeChatRoomMember(sender);
    chatRoom.fireMemberPresenceEvent(member,null,ChatRoomMemberPresenceChangeEvent.MEMBER_LEFT,null);
  }
}

Fixed version (ground truth):
/** 
 * This method is called whenever someone (possibly us) leaves a channel which we are on.
 * @param channel The channel which somebody parted from.
 * @param sender The nick of the user who parted from the channel.
 * @param login The login of the user who parted from the channel.
 * @param hostname The host name of the user who parted from the channel.
 */
protected void onPart(String channel,String sender,String login,String hostname){
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str" + channel + "String_Node_Str"+ sender+ "String_Node_Str"+ login+ "String_Node_Str"+ hostname);
  ChatRoomIrcImpl chatRoom=(ChatRoomIrcImpl)ircMUCOpSet.findRoom(channel);
  if (chatRoom.getUserNickname().equals(sender)) {
    ircMUCOpSet.fireLocalUserPresenceEvent(chatRoom,LocalUserChatRoomPresenceChangeEvent.LOCAL_USER_LEFT,"String_Node_Str");
    for (    ChatRoomMember member : chatRoom.getMembers())     chatRoom.fireMemberPresenceEvent(member,null,ChatRoomMemberPresenceChangeEvent.MEMBER_LEFT,"String_Node_Str");
    chatRoom.clearChatRoomMemberList();
  }
 else {
    ChatRoomMember member=chatRoom.getChatRoomMember(sender);
    if (member == null)     return;
    chatRoom.removeChatRoomMember(sender);
    chatRoom.fireMemberPresenceEvent(member,null,ChatRoomMemberPresenceChangeEvent.MEMBER_LEFT,null);
  }
}
Program: 104068
Project: 104068
Buggy source:
/** 
 * Creates a room with the named <tt>roomName</tt> and according to the specified <tt>roomProperties</tt> on the server that this protocol provider is currently connected to. When the method returns the room the local user will not have joined it and thus will not receive messages on it until the <tt>ChatRoom.join()</tt> method is called. <p>
 * @param roomName the name of the <tt>ChatRoom</tt> to create.
 * @param roomProperties properties specifying how the room should becreated.
 * @throws OperationFailedException if the room couldn't be created for somereason (e.g. room already exists; user already joined to an existent room or user has no permissions to create a chat room).
 * @throws OperationNotSupportedException if chat room creation is notsupported by this server
 * @return the newly created <tt>ChatRoom</tt> named <tt>roomName</tt>.
 */
public ChatRoom createChatRoom(String roomName,Hashtable roomProperties) throws OperationFailedException, OperationNotSupportedException {
  return findRoom(roomName);
}

Fixed version (ground truth):
/** 
 * Creates a room with the named <tt>roomName</tt> and according to the specified <tt>roomProperties</tt> on the server that this protocol provider is currently connected to. When the method returns the room the local user will not have joined it and thus will not receive messages on it until the <tt>ChatRoom.join()</tt> method is called. <p>
 * @param roomName the name of the <tt>ChatRoom</tt> to create.
 * @param roomProperties properties specifying how the room should becreated.
 * @throws OperationFailedException if the room couldn't be created for somereason (e.g. room already exists; user already joined to an existent room or user has no permissions to create a chat room).
 * @throws OperationNotSupportedException if chat room creation is notsupported by this server
 * @return the newly created <tt>ChatRoom</tt> named <tt>roomName</tt>.
 */
public ChatRoom createChatRoom(String roomName,Map<String,Object> roomProperties) throws OperationFailedException, OperationNotSupportedException {
  return findRoom(roomName);
}
Program: 104069
Project: 104069
Buggy source:
/** 
 * Returns the private room corresponding to the given nick name.
 * @param nickIdentifier the nickName of the person for which the privateroom is.
 * @return the private room corresponding to the given nick name
 */
protected ChatRoomIrcImpl findPrivateChatRoom(String nickIdentifier){
synchronized (privateRoomCache) {
    if (privateRoomCache.containsKey(nickIdentifier))     return privateRoomCache.get(nickIdentifier);
    ChatRoomIrcImpl chatRoom=new ChatRoomIrcImpl(nickIdentifier,ircProvider,true,false);
    privateRoomCache.put(nickIdentifier,chatRoom);
    fireLocalUserPresenceEvent(chatRoom,LocalUserChatRoomPresenceChangeEvent.LOCAL_USER_JOINED,"String_Node_Str");
    return chatRoom;
  }
}

Fixed version (ground truth):
/** 
 * Returns the private room corresponding to the given nick name.
 * @param nickIdentifier the nickName of the person for which the privateroom is.
 * @return the private room corresponding to the given nick name
 */
protected ChatRoomIrcImpl findPrivateChatRoom(String nickIdentifier){
  ChatRoomIrcImpl chatRoom;
synchronized (privateRoomCache) {
    if (privateRoomCache.containsKey(nickIdentifier))     return privateRoomCache.get(nickIdentifier);
    chatRoom=new ChatRoomIrcImpl(nickIdentifier,ircProvider,true,false);
    privateRoomCache.put(nickIdentifier,chatRoom);
  }
  fireLocalUserPresenceEvent(chatRoom,LocalUserChatRoomPresenceChangeEvent.LOCAL_USER_JOINED,"String_Node_Str");
  return chatRoom;
}
Program: 104070
Project: 104070
Buggy source:
/** 
 * Creates a room with the named <tt>roomName</tt> and according to the specified <tt>roomProperties</tt> on the server that this protocol provider is currently connected to.
 * @param roomName the name of the <tt>ChatRoom</tt> to create.
 * @param roomProperties properties specifying how the room should becreated.
 * @throws OperationFailedException if the room couldn't be created forsome reason (e.g. room already exists; user already joined to an existent room or user has no permissions to create a chat room).
 * @throws OperationNotSupportedException if chat room creation is notsupported by this server
 * @return ChatRoom the chat room that we've just created.
 */
public ChatRoom createChatRoom(String roomName,Hashtable roomProperties) throws OperationFailedException, OperationNotSupportedException {
  assertSupportedAndConnected();
  ChatRoom room=findRoom(roomName);
  if (room == null) {
    MultiUserChat muc=new MultiUserChat(getXmppConnection(),getCanonicalRoomName(roomName));
    try {
      muc.create(getXmppConnection().getUser());
      muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));
    }
 catch (    XMPPException ex) {
      logger.error("String_Node_Str",ex);
      throw new OperationFailedException("String_Node_Str",ex.getXMPPError().getCode(),ex.getCause());
    }
    room=createLocalChatRoomInstance(muc);
  }
  return room;
}

Fixed version (ground truth):
/** 
 * Creates a room with the named <tt>roomName</tt> and according to the specified <tt>roomProperties</tt> on the server that this protocol provider is currently connected to.
 * @param roomName the name of the <tt>ChatRoom</tt> to create.
 * @param roomProperties properties specifying how the room should becreated.
 * @throws OperationFailedException if the room couldn't be created forsome reason (e.g. room already exists; user already joined to an existent room or user has no permissions to create a chat room).
 * @throws OperationNotSupportedException if chat room creation is notsupported by this server
 * @return ChatRoom the chat room that we've just created.
 */
public ChatRoom createChatRoom(String roomName,Map<String,Object> roomProperties) throws OperationFailedException, OperationNotSupportedException {
  assertSupportedAndConnected();
  ChatRoom room=findRoom(roomName);
  if (room == null) {
    MultiUserChat muc=new MultiUserChat(getXmppConnection(),getCanonicalRoomName(roomName));
    try {
      muc.create(getXmppConnection().getUser());
      muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));
    }
 catch (    XMPPException ex) {
      logger.error("String_Node_Str",ex);
      throw new OperationFailedException("String_Node_Str",ex.getXMPPError().getCode(),ex.getCause());
    }
    room=createLocalChatRoomInstance(muc);
  }
  return room;
}
Program: 104071
Project: 104071
Buggy source:
/** 
 * Creates a room with the named <tt>roomName</tt> and according to the specified <tt>roomProperties</tt> on the server that this protocol provider is currently connected to. When the method returns the room the local user will not have joined it and thus will not receive messages on it until the <tt>ChatRoom.join()</tt> method is called. <p>
 * @param roomName the name of the <tt>ChatRoom</tt> to create.
 * @param roomProperties properties specifying how the room should becreated.
 * @throws OperationFailedException if the room couldn't be created for somereason (e.g. room already exists; user already joined to an existant room or user has no permissions to create a chat room).
 * @throws OperationNotSupportedException if chat room creation is notsupported by this server
 * @return the newly created <tt>ChatRoom</tt> named <tt>roomName</tt>.
 */
public ChatRoom createChatRoom(String roomName,Hashtable roomProperties) throws OperationFailedException, OperationNotSupportedException {
  MockChatRoom room=new MockChatRoom(provider,this,roomName);
  existingChatRooms.add(room);
  return room;
}

Fixed version (ground truth):
/** 
 * Creates a room with the named <tt>roomName</tt> and according to the specified <tt>roomProperties</tt> on the server that this protocol provider is currently connected to. When the method returns the room the local user will not have joined it and thus will not receive messages on it until the <tt>ChatRoom.join()</tt> method is called. <p>
 * @param roomName the name of the <tt>ChatRoom</tt> to create.
 * @param roomProperties properties specifying how the room should becreated.
 * @throws OperationFailedException if the room couldn't be created for somereason (e.g. room already exists; user already joined to an existing room or user has no permissions to create a chat room).
 * @throws OperationNotSupportedException if chat room creation is notsupported by this server
 * @return the newly created <tt>ChatRoom</tt> named <tt>roomName</tt>.
 */
public ChatRoom createChatRoom(String roomName,Map<String,Object> roomProperties) throws OperationFailedException, OperationNotSupportedException {
  MockChatRoom room=new MockChatRoom(provider,this,roomName);
  existingChatRooms.add(room);
  return room;
}