nus-yam/ex-repair huggingface dataset:
Program: 103448
Project: 103448
Buggy source:
/** 
 * Waits for resolution to complete (if necessary) and then either returns the response we received or throws whatever exception we saw.
 * @return the response {@link Message} we received from the DNS.
 * @throws IOException if this resolution ended badly because of anetwork IO error
 * @throws RuntimeException if something unexpected happenedduring resolution.
 * @throws IllegalArgumentException if something unexpected happenedduring resolution.
 */
public Message returnResponseOrThrowUp() throws IOException, RuntimeException, IllegalArgumentException {
  if (!done)   waitForResponse(0);
  if (response != null)   return response;
 else   if (exception instanceof IOException)   throw (IOException)exception;
 else   if (exception instanceof RuntimeException)   throw (RuntimeException)exception;
 else   if (exception instanceof Error)   throw (Error)exception;
 else   throw new IllegalStateException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Waits for resolution to complete (if necessary) and then either returns the response we received or throws whatever exception we saw.
 * @return the response {@link Message} we received from the DNS.
 * @throws IOException if this resolution ended badly because of anetwork IO error
 * @throws RuntimeException if something unexpected happenedduring resolution.
 * @throws IllegalArgumentException if something unexpected happenedduring resolution.
 */
public Message returnResponseOrThrowUp() throws IOException, RuntimeException, IllegalArgumentException {
  if (!done)   waitForResponse(0);
  if (response != null)   return response;
 else   if (exception instanceof IOException) {
    logger.warn("String_Node_Str",exception);
    throw (IOException)exception;
  }
 else   if (exception instanceof RuntimeException) {
    logger.warn("String_Node_Str",exception);
    throw (RuntimeException)exception;
  }
 else   if (exception instanceof Error) {
    logger.warn("String_Node_Str",exception);
    throw (Error)exception;
  }
 else {
    logger.warn("String_Node_Str",exception);
    throw new IllegalStateException("String_Node_Str");
  }
}
Program: 103449
Project: 103449
Buggy source:
/** 
 * Create a new call and invite the specified CallPeer to it.
 * @param callee the address of the callee that we should invite to anew call.
 * @return CallPeer the CallPeer that will represented bythe specified uri. All following state change events will be delivered through that call peer. The Call that this peer is a member of could be retrieved from the CallParticipatn instance with the use of the corresponding method.
 * @throws OperationFailedException with the corresponding code if wefail to create the call.
 */
public Call createCall(Contact callee) throws OperationFailedException {
  return createCall(callee.getAddress());
}

Fixed version (ground truth):
/** 
 * Creates a new <tt>Call</tt> and invites a specific <tt>CallPeer</tt> to it given by her <tt>Contact</tt>.
 * @param callee the address of the callee who we should invite to a newcall
 * @return a newly created <tt>Call</tt>. The specified <tt>callee</tt> isavailable in the <tt>Call</tt> as a <tt>CallPeer</tt>
 * @throws OperationFailedException with the corresponding code if we failto create the call
 * @see OperationSetBasicTelephony#createCall(Contact)
 */
public Call createCall(Contact callee) throws OperationFailedException {
  return createCall(callee.getAddress());
}
Program: 103450
Project: 103450
Buggy source:
/** 
 * Create a new call and invite the specified CallPeer to it.
 * @param callee the address of the callee that we should invite to anew call.
 * @return CallPeer the CallPeer that will represented bythe specified uri. All following state change events will be delivered through that call peer. The Call that this peer is a member of could be retrieved from the CallParticipatn instance with the use of the corresponding method.
 * @throws OperationFailedException with the corresponding code if we failto create the call.
 */
public Call createCall(Contact callee) throws OperationFailedException {
  return createCall(callee.getAddress());
}

Fixed version (ground truth):
/** 
 * Creates a new <tt>Call</tt> and invites a specific <tt>CallPeer</tt> to it given by her <tt>Contact</tt>.
 * @param callee the address of the callee who we should invite to a newcall
 * @return a newly created <tt>Call</tt>. The specified <tt>callee</tt> isavailable in the <tt>Call</tt> as a <tt>CallPeer</tt>
 * @throws OperationFailedException with the corresponding code if we failto create the call
 * @see OperationSetBasicTelephony#createCall(Contact)
 */
public Call createCall(Contact callee) throws OperationFailedException {
  return createCall(callee.getAddress());
}
Program: 103451
Project: 103451
Buggy source:
/** 
 * Create a new call and invite the specified CallPeer to it.
 * @param callee the address of the callee that we should invite to anew call.
 * @return CallPeer the CallPeer that will represented bythe specified uri. All following state change events will be delivered through that call peer. The Call that this peer is a member of could be retrieved from the CallParticipatn instance with the use of the corresponding method.
 * @throws OperationFailedException with the corresponding code if wefail to create the call.
 */
public Call createCall(Contact callee) throws OperationFailedException {
  return createNewCall(callee.getAddress());
}

Fixed version (ground truth):
/** 
 * Creates a new <tt>Call</tt> and invites a specific <tt>CallPeer</tt> to it given by her <tt>Contact</tt>.
 * @param callee the address of the callee who we should invite to a newcall
 * @return a newly created <tt>Call</tt>. The specified <tt>callee</tt> isavailable in the <tt>Call</tt> as a <tt>CallPeer</tt>
 * @throws OperationFailedException with the corresponding code if we failto create the call
 * @see OperationSetBasicTelephony#createCall(Contact)
 */
public Call createCall(Contact callee) throws OperationFailedException {
  return createNewCall(callee.getAddress());
}
Program: 103452
Project: 103452
Buggy source:
/** 
 * Create a new call and invite the specified CallPeer to it.
 * @param callee the address of the callee that we should invite to a newcall.
 * @return CallPeer the CallPeer that will represented by the specified URI.All following state change events will be delivered through that call peer. The Call that this peer is a member of could be retrieved from the CallParticipatn instance with the use of the corresponding method.
 * @throws OperationFailedException with the corresponding code if we failto create the call.
 */
public Call createCall(Contact callee) throws OperationFailedException {
  Address toAddress;
  try {
    toAddress=protocolProvider.parseAddressString(callee.getAddress());
  }
 catch (  ParseException ex) {
    logger.error(ex.getMessage(),ex);
    throw new IllegalArgumentException(ex.getMessage());
  }
  return createOutgoingCall(toAddress,null);
}

Fixed version (ground truth):
/** 
 * Creates a new <tt>Call</tt> and invites a specific <tt>CallPeer</tt> to it given by her <tt>Contact</tt>.
 * @param callee the address of the callee who we should invite to a newcall
 * @return a newly created <tt>Call</tt>. The specified <tt>callee</tt> isavailable in the <tt>Call</tt> as a <tt>CallPeer</tt>
 * @throws OperationFailedException with the corresponding code if we failto create the call
 * @see OperationSetBasicTelephony#createCall(Contact)
 */
public Call createCall(Contact callee) throws OperationFailedException {
  Address toAddress;
  try {
    toAddress=protocolProvider.parseAddressString(callee.getAddress());
  }
 catch (  ParseException ex) {
    logger.error(ex.getMessage(),ex);
    throw new IllegalArgumentException(ex.getMessage());
  }
  return createOutgoingCall(toAddress,null);
}
Program: 103453
Project: 103453
Buggy source:
/** 
 * Create a new call and invite the specified CallPeer to it.
 * @param callee the address of the callee that we should invite to a newcall.
 * @return CallPeer the CallPeer that will represented by thespecified uri. All following state change events will be delivered through that call peer. The Call that this peer is a member of could be retrieved from the CallParticipatn instance with the use of the corresponding method.
 * @throws OperationFailedException with the corresponding code if we failto create the call.
 */
public Call createCall(Contact callee) throws OperationFailedException ;

Fixed version (ground truth):
/** 
 * Creates a new <tt>Call</tt> and invites a specific <tt>CallPeer</tt> to it given by her <tt>Contact</tt>.
 * @param callee the address of the callee who we should invite to a newcall
 * @return a newly created <tt>Call</tt>. The specified <tt>callee</tt> isavailable in the <tt>Call</tt> as a <tt>CallPeer</tt>
 * @throws OperationFailedException with the corresponding code if we failto create the call
 */
public Call createCall(Contact callee) throws OperationFailedException ;
Program: 103455
Project: 103455
Buggy source:
public void propertyChange(PropertyChangeEvent evt){
  if (evt.getPropertyName().equals(JSplitPane.DIVIDER_LOCATION_PROPERTY)) {
    int dividerLocation=(Integer)evt.getNewValue();
    if (dividerLocation != autoDividerLocation) {
      int writeAreaSize=messagePane.getHeight() - dividerLocation - messagePane.getDividerSize();
      ConfigurationManager.setChatWriteAreaSize(writeAreaSize);
      writeMessagePanel.setPreferredSize(new Dimension((int)writeMessagePanel.getPreferredSize().getWidth(),writeAreaSize));
    }
  }
}

Fixed version (ground truth):
public void propertyChange(PropertyChangeEvent evt){
  if (evt.getPropertyName().equals(JSplitPane.DIVIDER_LOCATION_PROPERTY)) {
    int dividerLocation=(Integer)evt.getNewValue();
    int writeAreaSize=messagePane.getHeight() - dividerLocation - messagePane.getDividerSize();
    ConfigurationManager.setChatWriteAreaSize(writeAreaSize);
  }
}
Program: 103456
Project: 103456
Buggy source:
/** 
 * Removes the typing notification message from the conversation panel.
 */
public void removeTypingNotification(){
  conversationPanel.removeTypingNotification();
}

Fixed version (ground truth):
/** 
 * Removes the typing notification message from the conversation panel.
 */
public void removeTypingNotification(){
  addTypingNotification("String_Node_Str");
}
Program: 103457
Project: 103457
Buggy source:
/** 
 * Creates a <tt>ChatPanel</tt> which is added to the given chat window.
 * @param chatContainer The parent window of this chat panel.
 */
public ChatPanel(ChatContainer chatContainer){
  super(new BorderLayout());
  this.chatContainer=chatContainer;
  this.conversationPanel=new ChatConversationPanel(this);
  this.conversationPanel.setPreferredSize(new Dimension(400,200));
  this.conversationPanel.getChatTextPane().setTransferHandler(new ChatTransferHandler(this));
  this.writeMessagePanel=new ChatWritePanel(this);
  this.messagePane.setBorder(null);
  this.messagePane.setOpaque(false);
  this.messagePane.addPropertyChangeListener(new DividerLocationListener());
  this.messagePane.setDividerSize(3);
  this.messagePane.setResizeWeight(1.0D);
  this.messagePane.setBottomComponent(writeMessagePanel);
  this.add(messagePane,BorderLayout.CENTER);
  if (OSUtils.IS_MAC) {
    setOpaque(true);
    setBackground(new Color(GuiActivator.getResources().getColor("String_Node_Str")));
  }
  this.addComponentListener(new TabSelectionComponentListener());
}

Fixed version (ground truth):
/** 
 * Creates a <tt>ChatPanel</tt> which is added to the given chat window.
 * @param chatContainer The parent window of this chat panel.
 */
public ChatPanel(ChatContainer chatContainer){
  super(new BorderLayout());
  this.chatContainer=chatContainer;
  this.conversationPanel=new ChatConversationPanel(this);
  this.conversationPanel.setPreferredSize(new Dimension(400,200));
  this.conversationPanel.getChatTextPane().setTransferHandler(new ChatTransferHandler(this));
  topPanel.setBackground(Color.WHITE);
  topPanel.setBorder(BorderFactory.createMatteBorder(1,0,1,0,Color.GRAY));
  this.writeMessagePanel=new ChatWritePanel(this);
  this.messagePane.setBorder(null);
  this.messagePane.setOpaque(false);
  this.messagePane.addPropertyChangeListener(new DividerLocationListener());
  this.messagePane.setDividerSize(3);
  this.messagePane.setResizeWeight(1.0D);
  this.messagePane.setBottomComponent(writeMessagePanel);
  this.messagePane.setTopComponent(topPanel);
  this.add(messagePane,BorderLayout.CENTER);
  if (OSUtils.IS_MAC) {
    setOpaque(true);
    setBackground(new Color(GuiActivator.getResources().getColor("String_Node_Str")));
  }
  this.addComponentListener(new TabSelectionComponentListener());
}
Program: 103459
Project: 103459
Buggy source:
/** 
 * Adds a typing notification message to the conversation panel.
 * @param typingNotification the typing notification string
 */
public void addTypingNotification(String typingNotification){
  conversationPanel.addTypingNotification(typingNotification);
}

Fixed version (ground truth):
/** 
 * Adds a typing notification message to the conversation panel.
 * @param typingNotification the typing notification to show
 */
public void addTypingNotification(String typingNotification){
  if (typingNotificationLabel == null) {
    typingNotificationLabel=new JLabel(typingNotification,typingIcon,SwingConstants.CENTER);
    typingNotificationLabel.setPreferredSize(new Dimension(500,20));
    typingNotificationLabel.setForeground(Color.GRAY);
    typingNotificationLabel.setFont(typingNotificationLabel.getFont().deriveFont(11f));
    typingNotificationLabel.setVerticalTextPosition(JLabel.BOTTOM);
    typingNotificationLabel.setHorizontalTextPosition(JLabel.LEFT);
    typingNotificationLabel.setIconTextGap(0);
    topPanel.add(typingNotificationLabel,BorderLayout.SOUTH);
  }
 else {
    typingNotificationLabel.setText(typingNotification);
    if (typingNotification != null && !typingNotification.equals("String_Node_Str"))     typingNotificationLabel.setIcon(typingIcon);
 else     typingNotificationLabel.setIcon(null);
  }
  revalidate();
  repaint();
}
Program: 103460
Project: 103460
Buggy source:
public void setToolbarVisible(boolean isVisible){
  mainToolBar.setVisible(isVisible);
  contactPhotoPanel.setVisible(isVisible);
  revalidate();
  repaint();
}

Fixed version (ground truth):
/** 
 * Shows/hides the toolbar.
 * @param isVisible 
 */
public void setToolbarVisible(boolean isVisible){
  mainToolBar.setVisible(isVisible);
  contactPhotoPanel.setVisible(isVisible);
  revalidate();
  repaint();
}
Program: 103461
Project: 103461
Buggy source:
/** 
 * Packs the content of this call window.
 */
public void pack(){
  pack();
}

Fixed version (ground truth):
/** 
 * Packs the content of this call window.
 */
public void pack(){
  revalidate();
  repaint();
}
Program: 103462
Project: 103462
Buggy source:
/** 
 * Closes the given call panel.
 * @param callPanel the <tt>CallPanel</tt> to close
 */
public void close(CallPanel callPanel){
  if (this.callPanel.equals(callPanel))   dispose();
}

Fixed version (ground truth):
/** 
 * Hang ups the current call on close.
 * @param isEscaped indicates if the window was close by pressing the escapebutton
 */
protected void close(boolean isEscaped){
  if (!isEscaped) {
    callPanel.actionPerformedOnHangupButton();
  }
}
Program: 103463
Project: 103463
Buggy source:
/** 
 * Implements CallListener.callEnded. Stops sounds that are playing at the moment if there're any. Removes the call panel and disables the hang up button.
 * @param event the <tt>CallEvent</tt>
 */
public void callEnded(CallEvent event){
  Call sourceCall=event.getSourceCall();
  stopAllSounds();
  NotificationManager.fireNotification(NotificationManager.HANG_UP);
  if (activeCalls.get(sourceCall) != null) {
    CallPanel callContainer=activeCalls.get(sourceCall);
    callContainer.getCallWindow().close(callContainer);
  }
}

Fixed version (ground truth):
/** 
 * Implements CallListener.callEnded. Stops sounds that are playing at the moment if there're any. Removes the call panel and disables the hang up button.
 * @param event the <tt>CallEvent</tt>
 */
public void callEnded(CallEvent event){
  Call sourceCall=event.getSourceCall();
  stopAllSounds();
  NotificationManager.fireNotification(NotificationManager.HANG_UP);
  if (activeCalls.get(sourceCall) != null) {
    CallPanel callContainer=activeCalls.get(sourceCall);
    activeCalls.remove(sourceCall);
    callContainer.getCallWindow().closeWait(callContainer);
  }
}
Program: 103464
Project: 103464
Buggy source:
/** 
 * Executes the action associated with the "Hang up" button which may be invoked by clicking the button in question or closing this dialog.
 */
private void actionPerformedOnHangupButton(){
  Call call=getCall();
  NotificationManager.stopSound(NotificationManager.OUTGOING_CALL);
  NotificationManager.stopSound(NotificationManager.BUSY_CALL);
  if (call != null)   CallManager.hangupCall(call);
  callWindow.close(this);
}

Fixed version (ground truth):
/** 
 * Executes the action associated with the "Hang up" button which may be invoked by clicking the button in question or closing this dialog.
 */
public void actionPerformedOnHangupButton(){
  Call call=getCall();
  NotificationManager.stopSound(NotificationManager.OUTGOING_CALL);
  NotificationManager.stopSound(NotificationManager.BUSY_CALL);
  if (call != null)   CallManager.hangupCall(call);
  callWindow.close(this);
}
Program: 103466
Project: 103466
Buggy source:
/** 
 * Adds the given <tt>contact</tt> to this list.
 * @param query the <tt>ContactQuery</tt> that adds the given contact
 * @param contact the <tt>UIContact</tt> to add
 * @param group the <tt>UIGroup</tt> to add to
 * @param isSorted indicates if the contact should be sorted regarding tothe <tt>GroupNode</tt> policy
 */
private void addContact(final ContactQuery query,final UIContact contact,final UIGroup group,final boolean isSorted){
  if (!SwingUtilities.isEventDispatchThread()) {
    LowPriorityEventQueue.invokeLater(new Runnable(){
      public void run(){
        if (query != null && query.getStatus() != ContactQuery.QUERY_CANCELED)         addContact(contact,group,isSorted);
      }
    }
);
    return;
  }
}

Fixed version (ground truth):
/** 
 * Adds the given <tt>contact</tt> to this list.
 * @param query the <tt>ContactQuery</tt> that adds the given contact
 * @param contact the <tt>UIContact</tt> to add
 * @param group the <tt>UIGroup</tt> to add to
 * @param isSorted indicates if the contact should be sorted regarding tothe <tt>GroupNode</tt> policy
 */
private void addContact(final ContactQuery query,final UIContact contact,final UIGroup group,final boolean isSorted){
  if (!SwingUtilities.isEventDispatchThread()) {
    LowPriorityEventQueue.invokeLater(new Runnable(){
      public void run(){
        if (query != null && currentFilterQuery.containsQuery(query)) {
          addContact(contact,group,isSorted);
        }
      }
    }
);
    return;
  }
}
Program: 103467
Project: 103467
Buggy source:
/** 
 * Returns a list of all currently registered telephony providers.
 * @return a list of all currently registered telephony providers
 */
public static List<ProtocolProviderService> getTelephonyProviders(){
  List<ProtocolProviderService> telephonyProviders=new LinkedList<ProtocolProviderService>();
  for (  ProtocolProviderFactory providerFactory : GuiActivator.getProtocolProviderFactories().values()) {
    ServiceReference serRef;
    ProtocolProviderService protocolProvider;
    for (    AccountID accountID : providerFactory.getRegisteredAccounts()) {
      serRef=providerFactory.getProviderForAccount(accountID);
      protocolProvider=(ProtocolProviderService)GuiActivator.bundleContext.getService(serRef);
      if (protocolProvider.getOperationSet(OperationSetBasicTelephony.class) != null && protocolProvider.isRegistered()) {
        telephonyProviders.add(protocolProvider);
      }
    }
  }
  return telephonyProviders;
}

Fixed version (ground truth):
/** 
 * Returns a list of all currently registered telephony providers.
 * @return a list of all currently registered telephony providers
 */
public static List<ProtocolProviderService> getTelephonyProviders(){
  return GuiActivator.getRegisteredProviders(OperationSetBasicTelephony.class);
}
Program: 103470
Project: 103470
Buggy source:
/** 
 * Returns the image corresponding to the underlying <tt>SourceContact</tt>.
 * @param isSelected indicates if the contact is currently selected in thecontact list component
 * @param width the desired image width
 * @param height the desired image height
 * @return the image
 */
public ImageIcon getAvatar(boolean isSelected,int width,int height){
  byte[] image=sourceContact.getImage();
  if (image != null) {
    ImageIcon icon=new ImageIcon();
    if (icon.getIconWidth() > width || icon.getIconHeight() > height) {
      icon=ImageUtils.getScaledRoundedIcon(icon.getImage(),width,height);
    }
    return icon;
  }
 else   return null;
}

Fixed version (ground truth):
/** 
 * Returns the image corresponding to the underlying <tt>SourceContact</tt>.
 * @param isSelected indicates if the contact is currently selected in thecontact list component
 * @param width the desired image width
 * @param height the desired image height
 * @return the image
 */
public ImageIcon getAvatar(boolean isSelected,int width,int height){
  byte[] image=sourceContact.getImage();
  if ((image != null) && (image.length > 0)) {
    ImageIcon icon=new ImageIcon(image);
    if (icon.getIconWidth() > width || icon.getIconHeight() > height) {
      icon=ImageUtils.getScaledRoundedIcon(icon.getImage(),width,height);
    }
    return icon;
  }
 else   return null;
}
Program: 103471
Project: 103471
Buggy source:
/** 
 * Notifies this <tt>MacOSXAddrBookContactQuery</tt> about a specific <tt>ABPerson</tt>.
 * @param person a pointer to the <tt>ABPerson</tt> instance to notify about
 * @return <tt>true</tt> if this <tt>MacOSXAddrBookContactQuery</tt> is tocontinue being called; otherwise, <tt>false</tt>
 */
private boolean onPerson(long person){
  Object[] values=ABRecord_valuesForProperties(person,ABPERSON_PROPERTIES);
  if (matches(values)) {
    String displayName=getDisplayName(values);
    if (displayName.length() != 0) {
      List<ContactDetail> contactDetails=getContactDetails(values);
      if (!contactDetails.isEmpty()) {
        AddrBookSourceContact sourceContact=new AddrBookSourceContact(getContactSource(),displayName,contactDetails);
        try {
          byte[] image=ABPerson_imageData(person);
          if (image != null)           sourceContact.setImage(image);
        }
 catch (        OutOfMemoryError oome) {
        }
        addQueryResult(sourceContact);
      }
    }
  }
  return (getStatus() == QUERY_IN_PROGRESS);
}

Fixed version (ground truth):
/** 
 * Notifies this <tt>MacOSXAddrBookContactQuery</tt> about a specific <tt>ABPerson</tt>.
 * @param person a pointer to the <tt>ABPerson</tt> instance to notify about
 * @return <tt>true</tt> if this <tt>MacOSXAddrBookContactQuery</tt> is tocontinue being called; otherwise, <tt>false</tt>
 */
private boolean onPerson(long person){
  Object[] values=ABRecord_valuesForProperties(person,ABPERSON_PROPERTIES);
  String displayName=getDisplayName(values);
  if ((displayName.length() != 0) && (query.matcher(displayName).find() || matches(values))) {
    List<ContactDetail> contactDetails=getContactDetails(values);
    if (!contactDetails.isEmpty()) {
      AddrBookSourceContact sourceContact=new AddrBookSourceContact(getContactSource(),displayName,contactDetails);
      try {
        byte[] image=ABPerson_imageData(person);
        if (image != null)         sourceContact.setImage(image);
      }
 catch (      OutOfMemoryError oome) {
      }
      addQueryResult(sourceContact);
    }
  }
  return (getStatus() == QUERY_IN_PROGRESS);
}
Program: 103472
Project: 103472
Buggy source:
/** 
 * Gets the <tt>contactDetails</tt> to be set on a <tt>SourceContact</tt> which is to represent an <tt>ABPerson</tt> specified by the values of its  {@link #ABPERSON_PROPERTIES}.
 * @param values the values of the <tt>ABPERSON_PROPERTIES</tt> whichrepresent the <tt>ABPerson</tt> to get the <tt>contactDetails</tt> of
 * @return the <tt>contactDetails</tt> to be set on a <tt>SourceContact</tt>which is to represent the <tt>ABPerson</tt> specified by <tt>values</tt>
 */
private List<ContactDetail> getContactDetails(Object[] values){
  List<ContactDetail> contactDetails=new LinkedList<ContactDetail>();
  for (int i=0; i < CONTACT_DETAIL_PROPERTY_INDEXES.length; i++) {
    Object value=values[CONTACT_DETAIL_PROPERTY_INDEXES[i]];
    if (value instanceof String) {
      String stringValue=(String)value;
      if (stringValue.length() != 0)       contactDetails.add(new ContactDetail(stringValue));
    }
 else     if (value instanceof Object[]) {
      for (      Object subValue : (Object[])value) {
        if (subValue instanceof String) {
          String stringSubValue=(String)subValue;
          if (stringSubValue.length() != 0) {
            contactDetails.add(new ContactDetail(stringSubValue));
          }
        }
      }
    }
  }
  return contactDetails;
}

Fixed version (ground truth):
/** 
 * Gets the <tt>contactDetails</tt> to be set on a <tt>SourceContact</tt> which is to represent an <tt>ABPerson</tt> specified by the values of its  {@link #ABPERSON_PROPERTIES}.
 * @param values the values of the <tt>ABPERSON_PROPERTIES</tt> whichrepresent the <tt>ABPerson</tt> to get the <tt>contactDetails</tt> of
 * @return the <tt>contactDetails</tt> to be set on a <tt>SourceContact</tt>which is to represent the <tt>ABPerson</tt> specified by <tt>values</tt>
 */
private List<ContactDetail> getContactDetails(Object[] values){
  List<ContactDetail> contactDetails=new LinkedList<ContactDetail>();
  for (int i=0; i < CONTACT_DETAIL_PROPERTY_INDEXES.length; i++) {
    int property=CONTACT_DETAIL_PROPERTY_INDEXES[i];
    Object value=values[property];
    if (value instanceof String) {
      String stringValue=(String)value;
      if (stringValue.length() != 0) {
        contactDetails.add(setCapabilities(new ContactDetail(stringValue),property));
      }
    }
 else     if (value instanceof Object[]) {
      for (      Object subValue : (Object[])value) {
        if (subValue instanceof String) {
          String stringSubValue=(String)subValue;
          if (stringSubValue.length() != 0) {
            contactDetails.add(setCapabilities(new ContactDetail(stringSubValue),property));
          }
        }
      }
    }
  }
  return contactDetails;
}
Program: 103476
Project: 103476
Buggy source:
/** 
 * Creates an account id for the specified provider userid and accountProperties.
 * @param userID a String that uniquely identifies the user.
 * @param accountProperties a Map containing any other protocol andimplementation specific account initialization properties
 * @param protocolName the name of the protocol implemented by the providerthat this id is meant for.
 * @param serviceName the name of the service (e.g. iptel.org, jabber.org,icq.com) that this account is registered with.
 */
protected AccountID(String userID,Map<String,String> accountProperties,String protocolName,String serviceName){
  this.protocolDisplayName=getOverriddenProtocolName(accountProperties,protocolName);
  this.protocolName=protocolName;
  this.userID=userID;
  this.accountProperties=new HashMap<String,String>(accountProperties);
  this.serviceName=serviceName;
  this.accountUID=protocolDisplayName + "String_Node_Str" + userID+ "String_Node_Str"+ ((serviceName == null) ? "String_Node_Str" : serviceName);
}

Fixed version (ground truth):
/** 
 * Creates an account id for the specified provider userid and accountProperties. If account uid exists in account properties, we are loading the account and so load its value from there, prevent changing account uid when server changed (serviceName has changed).
 * @param userID a String that uniquely identifies the user.
 * @param accountProperties a Map containing any other protocol andimplementation specific account initialization properties
 * @param protocolName the name of the protocol implemented by the providerthat this id is meant for.
 * @param serviceName the name of the service (e.g. iptel.org, jabber.org,icq.com) that this account is registered with.
 */
protected AccountID(String userID,Map<String,String> accountProperties,String protocolName,String serviceName){
  this.protocolDisplayName=getOverriddenProtocolName(accountProperties,protocolName);
  this.protocolName=protocolName;
  this.userID=userID;
  this.accountProperties=new HashMap<String,String>(accountProperties);
  this.serviceName=serviceName;
  String existingAccountUID=accountProperties.get(ProtocolProviderFactory.ACCOUNT_UID);
  if (existingAccountUID == null) {
    this.accountUID=protocolDisplayName + "String_Node_Str" + userID+ "String_Node_Str"+ ((serviceName == null) ? "String_Node_Str" : serviceName);
  }
 else {
    this.accountUID=existingAccountUID;
  }
}
Program: 103477
Project: 103477
Buggy source:
/** 
 * Sets the <tt>MediaFormat</tt> that this <tt>MediaStream</tt> should transmit in.
 * @param format the <tt>MediaFormat</tt> that this <tt>MediaStream</tt>should transmit in
 * @see MediaStream#setFormat(MediaFormat)
 */
public void setFormat(MediaFormat format){
  if (logger.isTraceEnabled())   logger.trace("String_Node_Str" + hashCode() + "String_Node_Str"+ getDeviceSession().getFormat()+ "String_Node_Str"+ format);
  setAdvancedAttributes(format.getAdvancedAttributes());
  handleAttributes(format.getAdvancedAttributes());
  handleAttributes(format.getFormatParameters());
  getDeviceSession().setFormat(format);
}

Fixed version (ground truth):
/** 
 * Sets the <tt>MediaFormat</tt> that this <tt>MediaStream</tt> should transmit in.
 * @param format the <tt>MediaFormat</tt> that this <tt>MediaStream</tt>should transmit in
 * @see MediaStream#setFormat(MediaFormat)
 */
public void setFormat(MediaFormat format){
  if (logger.isTraceEnabled())   logger.trace("String_Node_Str" + hashCode() + "String_Node_Str"+ format);
  setAdvancedAttributes(format.getAdvancedAttributes());
  handleAttributes(format.getAdvancedAttributes());
  handleAttributes(format.getFormatParameters());
  getDeviceSession().setFormat(format);
}
Program: 103479
Project: 103479
Buggy source:
private void removeCapabilities(Contact contact,Map<String,? extends OperationSet> opSets){
  Iterator<String> caps=this.capabilities.keySet().iterator();
  Set<String> contactNewCaps=opSets.keySet();
  while (caps.hasNext()) {
    String opSetName=caps.next();
    List<Contact> contactsForCap=capabilities.get(opSetName);
    if (contactsForCap.contains(contact) && !contactNewCaps.contains(opSetName)) {
      contactsForCap.remove(contact);
      if (contactsForCap.size() == 0)       capabilities.remove(opSetName);
    }
  }
}

Fixed version (ground truth):
/** 
 * Remove capabilities for the given contacts.
 * @param contact the <tt>Contact</tt>, which capabilities we remove
 * @param opSets the new updated set of operation sets
 */
private void removeCapabilities(Contact contact,Map<String,? extends OperationSet> opSets){
  Iterator<String> caps=this.capabilities.keySet().iterator();
  Set<String> contactNewCaps=opSets.keySet();
  while (caps.hasNext()) {
    String opSetName=caps.next();
    List<Contact> contactsForCap=capabilities.get(opSetName);
    if (contactsForCap.contains(contact) && !contactNewCaps.contains(opSetName)) {
      contactsForCap.remove(contact);
      if (contactsForCap.size() == 0)       capabilities.remove(opSetName);
    }
  }
}
Program: 103480
Project: 103480
Buggy source:
/** 
 * Adds the capabilities of the given contact. 
 * @param contact the <tt>Contact</tt>, which capabilities we add
 * @param opSets the map of operation sets supported by the contact
 */
private void addCapabilities(Contact contact,Map<String,? extends OperationSet> opSets){
  Iterator<String> contactNewCaps=opSets.keySet().iterator();
  while (contactNewCaps.hasNext()) {
    String newCap=contactNewCaps.next();
    List<Contact> capContacts=null;
    if (!capabilities.containsKey(newCap)) {
      capContacts=new LinkedList<Contact>();
      capContacts.add(contact);
      capabilities.put(newCap,capContacts);
    }
 else {
      capContacts=capabilities.get(newCap);
      if (!capContacts.contains(contact)) {
        capContacts.add(contact);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds the capabilities of the given contact.
 * @param contact the <tt>Contact</tt>, which capabilities we add
 * @param opSets the map of operation sets supported by the contact
 */
private void addCapabilities(Contact contact,Map<String,? extends OperationSet> opSets){
  Iterator<String> contactNewCaps=opSets.keySet().iterator();
  while (contactNewCaps.hasNext()) {
    String newCap=contactNewCaps.next();
    List<Contact> capContacts=null;
    if (!capabilities.containsKey(newCap)) {
      capContacts=new LinkedList<Contact>();
      capContacts.add(contact);
      capabilities.put(newCap,capContacts);
    }
 else {
      capContacts=capabilities.get(newCap);
      if (!capContacts.contains(contact)) {
        capContacts.add(contact);
      }
    }
  }
}
Program: 103484
Project: 103484
Buggy source:
/** 
 * Loads the given error message in the current dialog, by re-validating the content.
 * @param errorMessage The error message to load.
 */
private void loadErrorMessage(String errorMessage){
  JEditorPane errorMessagePane=new JEditorPane();
  errorMessagePane.setOpaque(false);
  errorMessagePane.setText(errorMessage);
  errorMessagePane.setForeground(Color.RED);
  accountPanel.add(errorMessagePane,BorderLayout.NORTH);
  accountPanel.revalidate();
  accountPanel.repaint();
  this.pack();
  this.setSize(getWidth(),getHeight() + errorMessagePane.getHeight());
}

Fixed version (ground truth):
/** 
 * Loads the given error message in the current dialog, by re-validating the content.
 * @param errorMessage The error message to load.
 */
private void loadErrorMessage(String errorMessage){
  if (errorMessagePane == null) {
    errorMessagePane=new JEditorPane();
    errorMessagePane.setOpaque(false);
    errorMessagePane.setForeground(Color.RED);
    accountPanel.add(errorMessagePane,BorderLayout.NORTH);
    if (isVisible())     pack();
    this.setSize(getWidth(),getHeight() + errorMessagePane.getHeight());
  }
  errorMessagePane.setText(errorMessage);
  accountPanel.revalidate();
  accountPanel.repaint();
}
Program: 103485
Project: 103485
Buggy source:
/** 
 * Get the output format.
 * @return output format
 * @see net.sf.fmj.media.AbstractCodec#getOutputFormat()
 */
@Override public Format getOutputFormat(){
  Format outputFormat=super.getOutputFormat();
  if ((outputFormat != null) && (outputFormat.getClass() == AudioFormat.class)) {
    AudioFormat outputAudioFormat=(AudioFormat)outputFormat;
    setOutputFormat(new AudioFormat(outputAudioFormat.getEncoding(),outputAudioFormat.getSampleRate(),outputAudioFormat.getSampleSizeInBits(),outputAudioFormat.getChannels(),outputAudioFormat.getEndian(),outputAudioFormat.getSigned(),outputAudioFormat.getFrameSizeInBits(),outputAudioFormat.getFrameRate(),outputAudioFormat.getDataType()){
      @Override public long computeDuration(      long length){
        return JNIEncoder.this.duration;
      }
    }
);
  }
  return outputFormat;
}

Fixed version (ground truth):
/** 
 * Get the output format.
 * @return output format
 * @see net.sf.fmj.media.AbstractCodec#getOutputFormat()
 */
@Override public Format getOutputFormat(){
  Format outputFormat=super.getOutputFormat();
  if ((outputFormat != null) && (outputFormat.getClass() == AudioFormat.class)) {
    AudioFormat outputAudioFormat=(AudioFormat)outputFormat;
    outputFormat=setOutputFormat(new AudioFormat(outputAudioFormat.getEncoding(),outputAudioFormat.getSampleRate(),outputAudioFormat.getSampleSizeInBits(),outputAudioFormat.getChannels(),outputAudioFormat.getEndian(),outputAudioFormat.getSigned(),outputAudioFormat.getFrameSizeInBits(),outputAudioFormat.getFrameRate(),outputAudioFormat.getDataType()){
      private static final long serialVersionUID=0L;
      @Override public long computeDuration(      long length){
        return JNIEncoder.this.duration;
      }
    }
);
  }
  return outputFormat;
}
Program: 103486
Project: 103486
Buggy source:
/** 
 * Called when this bundle is started.
 * @param bc The execution context of the bundle being started.
 * @throws Exception If
 */
public void start(BundleContext bc) throws Exception {
  bundleContext=bc;
  try {
    SystrayService systrayService=new SystrayServiceJdicImpl();
    if (logger.isInfoEnabled())     logger.info("String_Node_Str");
    bundleContext.registerService(SystrayService.class.getName(),systrayService,null);
    if (logger.isInfoEnabled())     logger.info("String_Node_Str");
    DesktopService desktopService=new DesktopServiceImpl();
    if (logger.isInfoEnabled())     logger.info("String_Node_Str");
    bundleContext.registerService(DesktopService.class.getName(),desktopService,null);
    if (logger.isInfoEnabled())     logger.info("String_Node_Str");
    logger.logEntry();
  }
  finally {
    logger.logExit();
  }
}

Fixed version (ground truth):
/** 
 * Called when this bundle is started.
 * @param bc The execution context of the bundle being started.
 * @throws Exception If
 */
public void start(BundleContext bc) throws Exception {
  bundleContext=bc;
  try {
    MacOSXDockIcon.addDockIconListener();
    SystrayService systrayService=new SystrayServiceJdicImpl();
    if (logger.isInfoEnabled())     logger.info("String_Node_Str");
    bundleContext.registerService(SystrayService.class.getName(),systrayService,null);
    if (logger.isInfoEnabled())     logger.info("String_Node_Str");
    DesktopService desktopService=new DesktopServiceImpl();
    if (logger.isInfoEnabled())     logger.info("String_Node_Str");
    bundleContext.registerService(DesktopService.class.getName(),desktopService,null);
    if (logger.isInfoEnabled())     logger.info("String_Node_Str");
    logger.logEntry();
  }
  finally {
    logger.logExit();
  }
}
Program: 103487
Project: 103487
Buggy source:
/** 
 * Handles early media in 183 Session Progress responses. Retrieves the SDP and makes sure that we start transmitting and playing early media that we receive. Puts the call into a CONNECTING_WITH_EARLY_MEDIA state.
 * @param tran the <tt>ClientTransaction</tt> that the responsearrived in.
 * @param response the 183 <tt>Response</tt> to process
 */
public void processSessionProgress(ClientTransaction tran,Response response){
  if (response.getContentLength().getContentLength() == 0) {
    if (logger.isDebugEnabled())     logger.debug("String_Node_Str");
    return;
  }
  ContentTypeHeader contentTypeHeader=(ContentTypeHeader)response.getHeader(ContentTypeHeader.NAME);
  if (!contentTypeHeader.getContentType().equalsIgnoreCase("String_Node_Str") || !contentTypeHeader.getContentSubType().equalsIgnoreCase("String_Node_Str")) {
    logger.warn("String_Node_Str" + "String_Node_Str");
    return;
  }
  try {
    getMediaHandler().processAnswer(SdpUtils.getContentAsString(response));
  }
 catch (  Exception exc) {
    logAndFail("String_Node_Str" + getDisplayName() + "String_Node_Str"+ getAddress()+ "String_Node_Str",exc);
    return;
  }
  setState(CallPeerState.CONNECTING_WITH_EARLY_MEDIA);
}

Fixed version (ground truth):
/** 
 * Handles early media in 183 Session Progress responses. Retrieves the SDP and makes sure that we start transmitting and playing early media that we receive. Puts the call into a CONNECTING_WITH_EARLY_MEDIA state.
 * @param tran the <tt>ClientTransaction</tt> that the responsearrived in.
 * @param response the 183 <tt>Response</tt> to process
 */
public void processSessionProgress(ClientTransaction tran,Response response){
  if (response.getContentLength().getContentLength() == 0) {
    if (logger.isDebugEnabled())     logger.debug("String_Node_Str");
    return;
  }
  ContentTypeHeader contentTypeHeader=(ContentTypeHeader)response.getHeader(ContentTypeHeader.NAME);
  if (!contentTypeHeader.getContentType().equalsIgnoreCase("String_Node_Str") || !contentTypeHeader.getContentSubType().equalsIgnoreCase("String_Node_Str")) {
    logger.warn("String_Node_Str" + "String_Node_Str");
    return;
  }
  try {
    getMediaHandler().processAnswer(SdpUtils.getContentAsString(response));
  }
 catch (  Exception exc) {
    logAndFail("String_Node_Str" + getDisplayName() + "String_Node_Str"+ getAddress()+ "String_Node_Str",exc);
    return;
  }
  setState(CallPeerState.CONNECTING_WITH_EARLY_MEDIA);
  getMediaHandler().start();
  setMute(true);
}
Program: 103488
Project: 103488
Buggy source:
/** 
 * Registers   {@link #CUSTOM_CODEC_FORMATS} with a specific<tt>RTPManager</tt>.
 * @param rtpManager the <tt>RTPManager</tt> to register{@link #CUSTOM_CODEC_FORMATS} with
 * @see MediaStreamImpl#registerCustomCodecFormats(RTPManager)
 */
@Override protected void registerCustomCodecFormats(RTPManager rtpManager){
  super.registerCustomCodecFormats(rtpManager);
  if (!FMJConditionals.REGISTER_FORMATS_WITH_EVERY_RTP_MANAGER && formatsRegisteredOnce)   return;
  for (  AudioFormat format : CUSTOM_CODEC_FORMATS) {
    if (logger.isDebugEnabled())     logger.debug("String_Node_Str" + format + "String_Node_Str");
    rtpManager.addFormat(format,MediaUtils.getRTPPayloadType(format.getEncoding(),format.getSampleRate()));
  }
  formatsRegisteredOnce=true;
}

Fixed version (ground truth):
/** 
 * Registers   {@link #CUSTOM_CODEC_FORMATS} with a specific<tt>RTPManager</tt>.
 * @param rtpManager the <tt>RTPManager</tt> to register{@link #CUSTOM_CODEC_FORMATS} with
 * @see MediaStreamImpl#registerCustomCodecFormats(RTPManager)
 */
@Override protected void registerCustomCodecFormats(RTPManager rtpManager){
  super.registerCustomCodecFormats(rtpManager);
  for (  AudioFormat format : CUSTOM_CODEC_FORMATS) {
    if (logger.isDebugEnabled())     logger.debug("String_Node_Str" + format + "String_Node_Str");
    rtpManager.addFormat(format,MediaUtils.getRTPPayloadType(format.getEncoding(),format.getSampleRate()));
  }
}
Program: 103491
Project: 103491
Buggy source:
/** 
 * @param inputBuffer
 * @param outputBuffer
 * @return
 * @see AbstractCodecExt#doProcess(Buffer,Buffer)
 */
protected int doProcess(Buffer inputBuffer,Buffer outputBuffer){
  byte[] input=(byte[])inputBuffer.getData();
  int outputOffset=outputBuffer.getOffset();
  int outputLength=inputBuffer.getLength() * 4;
  byte[] output=validateByteArraySize(outputBuffer,outputOffset + outputLength);
  g722_decoder_process(decoder,input,inputBuffer.getOffset(),output,outputOffset,outputLength);
  outputBuffer.setDuration((outputLength * 1000000L) / (16L * 2L));
  outputBuffer.setFormat(getOutputFormat());
  outputBuffer.setLength(outputLength);
  return BUFFER_PROCESSED_OK;
}

Fixed version (ground truth):
/** 
 * @param inputBuffer
 * @param outputBuffer
 * @return
 * @see AbstractCodecExt#doProcess(Buffer,Buffer)
 */
protected int doProcess(Buffer inputBuffer,Buffer outputBuffer){
  byte[] input=(byte[])inputBuffer.getData();
  int outputOffset=outputBuffer.getOffset();
  int outputLength=inputBuffer.getLength() * 4;
  byte[] output=validateByteArraySize(outputBuffer,outputOffset + outputLength);
  g722_decoder_process(decoder,input,inputBuffer.getOffset(),output,outputOffset,outputLength);
  for (int i=outputOffset; i < outputLength; i+=2) {
    short sample=ArrayIOUtils.readShort(output,i);
    sample<<=2;
    ArrayIOUtils.writeShort(sample,output,i);
  }
  outputBuffer.setDuration((outputLength * 1000000L) / (16L * 2L));
  outputBuffer.setFormat(getOutputFormat());
  outputBuffer.setLength(outputLength);
  return BUFFER_PROCESSED_OK;
}
Program: 103492
Project: 103492
Buggy source:
/** 
 * @param inputBuffer
 * @param outputBuffer
 * @return
 * @see AbstractCodecExt#doProcess(Buffer,Buffer)
 */
protected int doProcess(Buffer inputBuffer,Buffer outputBuffer){
  byte[] input=(byte[])inputBuffer.getData();
  int outputOffset=outputBuffer.getOffset();
  int outputLength=inputBuffer.getLength() / 4;
  byte[] output=validateByteArraySize(outputBuffer,outputOffset + outputLength);
  g722_encoder_process(encoder,input,inputBuffer.getOffset(),output,outputOffset,outputLength);
  outputBuffer.setDuration(computeDuration(outputLength));
  outputBuffer.setFormat(getOutputFormat());
  outputBuffer.setLength(outputLength);
  return BUFFER_PROCESSED_OK;
}

Fixed version (ground truth):
/** 
 * @param inputBuffer
 * @param outputBuffer
 * @return
 * @see AbstractCodecExt#doProcess(Buffer,Buffer)
 */
protected int doProcess(Buffer inputBuffer,Buffer outputBuffer){
  int inputOffset=inputBuffer.getOffset();
  int inputLength=inputBuffer.getLength();
  byte[] input=(byte[])inputBuffer.getData();
  int outputOffset=outputBuffer.getOffset();
  int outputLength=inputLength / 4;
  byte[] output=validateByteArraySize(outputBuffer,outputOffset + outputLength);
  for (int i=inputOffset; i < inputLength; i+=2) {
    short sample=ArrayIOUtils.readShort(input,i);
    sample>>>=2;
    ArrayIOUtils.writeShort(sample,input,i);
  }
  g722_encoder_process(encoder,input,inputOffset,output,outputOffset,outputLength);
  outputBuffer.setDuration(computeDuration(outputLength));
  outputBuffer.setFormat(getOutputFormat());
  outputBuffer.setLength(outputLength);
  return BUFFER_PROCESSED_OK;
}
Program: 103493
Project: 103493
Buggy source:
/** 
 * Shows this modal dialog.
 * @param isVisible specifies whether we should be showing or hiding thewindow.
 */
@Override public void setVisible(boolean isVisible){
  this.setName("String_Node_Str");
  pack();
  super.setVisible(isVisible);
  if (isVisible) {
    this.passwdField.requestFocus();
synchronized (lock) {
      try {
        lock.wait();
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Shows this modal dialog.
 * @param isVisible specifies whether we should be showing or hiding thewindow.
 */
@Override public void setVisible(boolean isVisible){
  this.setName("String_Node_Str");
  super.setVisible(isVisible);
  if (isVisible) {
    this.passwdField.requestFocus();
synchronized (lock) {
      try {
        lock.wait();
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
    }
  }
}