nus-yam/ex-repair huggingface dataset:
Program: 104349
Project: 104349
Buggy source:
/** 
 * Creates the selector box, containing all protocol statuses, adds it to the StatusPanel and refreshes the panel.
 * @param protocolProvider The protocol provider.
 */
public void addAccount(ProtocolProviderService protocolProvider){
  StatusSelectorBox protocolStatusCombo;
  int providerIndex=this.mainFrame.getProviderIndex(protocolProvider);
  if (mainFrame.getProtocolPresenceOpSet(protocolProvider) != null) {
    protocolStatusCombo=new PresenceStatusSelectorBox(this.mainFrame,protocolProvider,providerIndex);
  }
 else {
    protocolStatusCombo=new SimpleStatusSelectorBox(this.mainFrame,protocolProvider,providerIndex);
  }
  protocolStatusCombo.addComponentListener(this);
  boolean isHidden=protocolProvider.getAccountID().getAccountProperties().get("String_Node_Str") != null;
  if (isHidden)   hiddenProviders++;
  if (protocolStatusCombos.size() - hiddenProviders == 1) {
    this.globalStatusBox=new GlobalStatusSelectorBox(mainFrame);
    Icon statusSeparatorIcon=new ImageIcon(ImageLoader.getImage(ImageLoader.STATUS_SEPARATOR_ICON));
    this.add(new JLabel(statusSeparatorIcon),FlowLayout.LEFT);
    this.add(globalStatusBox,FlowLayout.LEFT);
  }
  this.protocolStatusCombos.put(protocolProvider,protocolStatusCombo);
  if (!isHidden) {
    this.add(protocolStatusCombo);
    this.getParent().validate();
  }
}

Fixed version (ground truth):
/** 
 * Creates the selector box, containing all protocol statuses, adds it to the StatusPanel and refreshes the panel.
 * @param protocolProvider The protocol provider.
 */
public void addAccount(ProtocolProviderService protocolProvider){
  StatusSelectorBox protocolStatusCombo;
  int providerIndex=this.mainFrame.getProviderIndex(protocolProvider);
  if (mainFrame.getProtocolPresenceOpSet(protocolProvider) != null) {
    protocolStatusCombo=new PresenceStatusSelectorBox(this.mainFrame,protocolProvider,providerIndex);
  }
 else {
    protocolStatusCombo=new SimpleStatusSelectorBox(this.mainFrame,protocolProvider,providerIndex);
  }
  protocolStatusCombo.addComponentListener(this);
  boolean isHidden=protocolProvider.getAccountID().getAccountProperties().get("String_Node_Str") != null;
  if (isHidden)   hiddenProviders++;
  if (protocolStatusCombos.size() - hiddenProviders == 1 && !isHidden) {
    this.globalStatusBox=new GlobalStatusSelectorBox(mainFrame);
    Icon statusSeparatorIcon=new ImageIcon(ImageLoader.getImage(ImageLoader.STATUS_SEPARATOR_ICON));
    this.add(new JLabel(statusSeparatorIcon),FlowLayout.LEFT);
    this.add(globalStatusBox,FlowLayout.LEFT);
  }
  this.protocolStatusCombos.put(protocolProvider,protocolStatusCombo);
  if (!isHidden) {
    this.add(protocolStatusCombo);
    this.getParent().validate();
  }
}
Program: 104350
Project: 104350
Buggy source:
/** 
 * Enables or disabled the call button according to the content in the combo box editor field.
 */
protected void handleChange(){
  String item=((CallComboEditor)this.getEditor()).getItem().toString();
  if (item.length() > 0) {
    callManager.setCallMetaContact(false);
    ContactList clist=this.callManager.getMainFrame().getContactListPanel().getContactList();
    clist.removeSelectionInterval(clist.getSelectedIndex(),clist.getSelectedIndex());
    callManager.getCallButton().setEnabled(true);
  }
 else {
    Object o=callManager.getMainFrame().getContactListPanel().getContactList().getSelectedValue();
    if (o == null || !(o instanceof MetaContact)) {
      callManager.getCallButton().setEnabled(false);
    }
  }
}

Fixed version (ground truth):
/** 
 * Enables or disabled the call button according to the content in the combo box editor field.
 */
protected void handleChange(){
  String item=((CallComboEditor)this.getEditor()).getItem().toString();
  if (item.length() > 0) {
    callManager.setCallMetaContact(false);
    ContactList clist=this.callManager.getMainFrame().getContactListPanel().getContactList();
    clist.removeSelectionInterval(clist.getSelectedIndex(),clist.getSelectedIndex());
    callManager.getCallButton().setEnabled(true);
  }
 else {
    Object o=callManager.getMainFrame().getContactListPanel().getContactList().getSelectedValue();
    boolean enabled=true;
    if (o == null || !(o instanceof MetaContact)) {
      enabled=false;
    }
    Component selectedPanel=callManager.getMainFrame().getSelectedTab();
    if (selectedPanel != null && selectedPanel instanceof CallPanel) {
      CallState state=((CallPanel)selectedPanel).getCall().getCallState();
      if (state == CallState.CALL_INITIALIZATION) {
        enabled=true;
      }
    }
    callManager.getCallButton().setEnabled(enabled);
  }
}
Program: 104351
Project: 104351
Buggy source:
public void stateChanged(ChangeEvent e){
  PluginManagerActivator.getConfigurationService().setProperty("String_Node_Str",new Boolean(showSysBundlesCheckBox.isSelected()));
  PluginTableModel tableModel=(PluginTableModel)pluginTable.getModel();
  tableModel.setShowSystemBundles(showSysBundlesCheckBox.isSelected());
  tableModel.update();
}

Fixed version (ground truth):
public void stateChanged(ChangeEvent e){
  if (currentValue == showSysBundlesCheckBox.isSelected()) {
    return;
  }
  currentValue=showSysBundlesCheckBox.isSelected();
  PluginManagerActivator.getConfigurationService().setProperty("String_Node_Str",new Boolean(showSysBundlesCheckBox.isSelected()));
  PluginTableModel tableModel=(PluginTableModel)pluginTable.getModel();
  tableModel.setShowSystemBundles(showSysBundlesCheckBox.isSelected());
  tableModel.update();
}
Program: 104352
Project: 104352
Buggy source:
/** 
 * Creates an instance of <tt>CallListPanel</tt>.
 */
public CallListPanel(MainFrame mainFrame){
  super(new BorderLayout());
  this.mainFrame=mainFrame;
  this.callHistory=GuiActivator.getCallHistoryService();
  this.searchComboBox.addActionListener(this);
  new LoadLastCallsFromHistory().start();
  this.initPanels();
  this.initPluginComponents();
}

Fixed version (ground truth):
/** 
 * Creates an instance of <tt>CallListPanel</tt>.
 */
public CallListPanel(MainFrame mainFrame){
  super(new BorderLayout());
  this.mainFrame=mainFrame;
  this.callHistory=GuiActivator.getCallHistoryService();
  this.searchComboBox.addActionListener(this);
  new LoadLastCallsFromHistory().start();
  this.initPanels();
  this.initPluginComponents();
  this.setPreferredSize(new Dimension(200,450));
  this.setMinimumSize(new Dimension(80,200));
}
Program: 104353
Project: 104353
Buggy source:
/** 
 * Creates the scroll panel containing the chat rooms list.
 * @param frame the main application frame
 */
public ChatRoomsListPanel(MainFrame frame){
  this.mainFrame=frame;
  this.chatRoomsList=new ChatRoomsList(mainFrame);
  this.treePanel.add(chatRoomsList,BorderLayout.NORTH);
  this.treePanel.setOpaque(false);
  this.setViewport(new ScrollPaneBackground());
  this.getViewport().setView(treePanel);
  this.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  this.getVerticalScrollBar().setUnitIncrement(30);
  this.getActionMap().put("String_Node_Str",new ChatRoomsListPanelEnterAction());
  InputMap imap=this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
  imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0),"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Creates the scroll panel containing the chat rooms list.
 * @param frame the main application frame
 */
public ChatRoomsListPanel(MainFrame frame){
  this.mainFrame=frame;
  this.chatRoomsList=new ChatRoomsList(mainFrame);
  this.treePanel.add(chatRoomsList,BorderLayout.NORTH);
  this.treePanel.setOpaque(false);
  this.setViewport(new ScrollPaneBackground());
  this.getViewport().setView(treePanel);
  this.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  this.getVerticalScrollBar().setUnitIncrement(30);
  this.getActionMap().put("String_Node_Str",new ChatRoomsListPanelEnterAction());
  InputMap imap=this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
  imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0),"String_Node_Str");
  this.setPreferredSize(new Dimension(200,450));
  this.setMinimumSize(new Dimension(80,200));
}
Program: 104354
Project: 104354
Buggy source:
/** 
 * Creates the contactlist scroll panel defining the parent frame.
 * @param mainFrame The parent frame.
 */
public ContactListPanel(MainFrame mainFrame){
  this.mainFrame=mainFrame;
  this.chatWindowManager=mainFrame.getChatWindowManager();
  this.treePanel.setOpaque(false);
  this.setViewport(new ScrollPaneBackground());
  this.getViewport().setView(treePanel);
  this.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  this.getVerticalScrollBar().setUnitIncrement(30);
  this.setPreferredSize(new Dimension(300,600));
  this.setMinimumSize(new Dimension(80,200));
}

Fixed version (ground truth):
/** 
 * Creates the contactlist scroll panel defining the parent frame.
 * @param mainFrame The parent frame.
 */
public ContactListPanel(MainFrame mainFrame){
  this.mainFrame=mainFrame;
  this.chatWindowManager=mainFrame.getChatWindowManager();
  this.treePanel.setOpaque(false);
  this.setViewport(new ScrollPaneBackground());
  this.getViewport().setView(treePanel);
  this.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  this.getVerticalScrollBar().setUnitIncrement(30);
  this.setPreferredSize(new Dimension(200,450));
  this.setMinimumSize(new Dimension(80,200));
}
Program: 104355
Project: 104355
Buggy source:
/** 
 * Creates an Message through the advance createMessage() method and inspects its parameters.
 */
public void testCreateMessage2(){
  String body="String_Node_Str" + "String_Node_Str" + new Date().toString();
  String contentType="String_Node_Str";
  String encoding="String_Node_Str";
  String subject="String_Node_Str";
  net.java.sip.communicator.service.protocol.Message msg=opSetBasicIM1.createMessage(body.getBytes(),contentType,encoding,subject);
  assertEquals("String_Node_Str",body,msg.getContent());
  assertTrue("String_Node_Str",Arrays.equals(body.getBytes(),msg.getRawData()));
  assertEquals("String_Node_Str",body.length(),msg.getSize());
  assertEquals("String_Node_Str",contentType,msg.getContentType());
  assertEquals("String_Node_Str",encoding,msg.getEncoding());
  assertNotNull("String_Node_Str",msg.getMessageUID());
  net.java.sip.communicator.service.protocol.Message msg2=opSetBasicIM1.createMessage(body);
  assertFalse("String_Node_Str",msg.getMessageUID().equals(msg2.getMessageUID()));
}

Fixed version (ground truth):
/** 
 * Creates an Message through the advance createMessage() method and inspects its parameters.
 */
public void testCreateMessage2(){
  String body="String_Node_Str" + "String_Node_Str" + new Date().toString();
  String contentType="String_Node_Str";
  String encoding="String_Node_Str";
  String subject="String_Node_Str";
  net.java.sip.communicator.service.protocol.Message msg=opSetBasicIM1.createMessage(body.getBytes(),contentType,encoding,subject);
  assertEquals("String_Node_Str",body,msg.getContent());
  assertEquals("String_Node_Str",encoding,msg.getEncoding());
  try {
    assertTrue("String_Node_Str",Arrays.equals(body.getBytes(encoding),msg.getRawData()));
    assertEquals("String_Node_Str",body.getBytes(encoding).length,msg.getSize());
  }
 catch (  UnsupportedEncodingException e) {
    logger.warn("String_Node_Str",e);
    assertTrue("String_Node_Str",Arrays.equals(body.getBytes(),msg.getRawData()));
    assertEquals("String_Node_Str",body.getBytes().length,msg.getSize());
  }
  assertEquals("String_Node_Str",contentType,msg.getContentType());
  assertNotNull("String_Node_Str",msg.getMessageUID());
  net.java.sip.communicator.service.protocol.Message msg2=opSetBasicIM1.createMessage(body);
  assertFalse("String_Node_Str",msg.getMessageUID().equals(msg2.getMessageUID()));
}
Program: 104356
Project: 104356
Buggy source:
public Packetizer(){
  packetSize=480;
  supportedInputFormats=new AudioFormat[]{new AudioFormat(AudioFormat.ALAW,Format.NOT_SPECIFIED,8,1,Format.NOT_SPECIFIED,Format.NOT_SPECIFIED,8,Format.NOT_SPECIFIED,Format.byteArray)};
  defaultOutputFormats=new AudioFormat[]{new AudioFormat(AudioFormat.ALAW,Format.NOT_SPECIFIED,8,1,Format.NOT_SPECIFIED,Format.NOT_SPECIFIED,8,Format.NOT_SPECIFIED,Format.byteArray)};
  PLUGIN_NAME="String_Node_Str";
}

Fixed version (ground truth):
public Packetizer(){
  packetSize=160;
  supportedInputFormats=new AudioFormat[]{new AudioFormat(AudioFormat.ALAW,Format.NOT_SPECIFIED,8,1,Format.NOT_SPECIFIED,Format.NOT_SPECIFIED,8,Format.NOT_SPECIFIED,Format.byteArray)};
  defaultOutputFormats=new AudioFormat[]{new AudioFormat(AudioFormat.ALAW,Format.NOT_SPECIFIED,8,1,Format.NOT_SPECIFIED,Format.NOT_SPECIFIED,8,Format.NOT_SPECIFIED,Format.byteArray)};
  PLUGIN_NAME="String_Node_Str";
}
Program: 104357
Project: 104357
Buggy source:
/** 
 * Create an instance of the <tt>QuickMenu</tt>.
 * @param mainFrame The parent <tt>MainFrame</tt> window.
 */
public QuickMenu(MainFrame mainFrame){
  this.mainFrame=mainFrame;
  this.setRollover(true);
  this.setLayout(new FlowLayout(FlowLayout.LEFT,2,0));
  this.setBorder(BorderFactory.createEmptyBorder(0,5,5,5));
  this.setFloatable(true);
  this.infoButton.setPreferredSize(new Dimension(28,28));
  this.configureButton.setPreferredSize(new Dimension(28,28));
  this.searchButton.setPreferredSize(new Dimension(28,28));
  this.addButton.setPreferredSize(new Dimension(28,28));
  this.soundButton.setPreferredSize(new Dimension(28,28));
  this.infoButton.setToolTipText(Messages.getI18NString("String_Node_Str").getText());
  this.configureButton.setToolTipText(Messages.getI18NString("String_Node_Str").getText());
  this.searchButton.setToolTipText(Messages.getI18NString("String_Node_Str").getText());
  this.addButton.setToolTipText(Messages.getI18NString("String_Node_Str").getText());
  this.soundButton.setToolTipText(Messages.getI18NString("String_Node_Str").getText());
  this.updateMuteButton(GuiActivator.getAudioNotifier().isMute());
  this.init();
}

Fixed version (ground truth):
/** 
 * Create an instance of the <tt>QuickMenu</tt>.
 * @param mainFrame The parent <tt>MainFrame</tt> window.
 */
public QuickMenu(MainFrame mainFrame){
  this.mainFrame=mainFrame;
  this.setRollover(true);
  this.setLayout(new FlowLayout(FlowLayout.LEFT,2,0));
  this.setBorder(BorderFactory.createEmptyBorder(0,5,5,5));
  this.setFloatable(true);
  this.infoButton.setPreferredSize(new Dimension(BUTTON_SIZE,BUTTON_SIZE));
  this.configureButton.setPreferredSize(new Dimension(BUTTON_SIZE,BUTTON_SIZE));
  this.searchButton.setPreferredSize(new Dimension(BUTTON_SIZE,BUTTON_SIZE));
  this.addButton.setPreferredSize(new Dimension(BUTTON_SIZE,BUTTON_SIZE));
  this.soundButton.setPreferredSize(new Dimension(BUTTON_SIZE,BUTTON_SIZE));
  this.infoButton.setToolTipText(Messages.getI18NString("String_Node_Str").getText());
  this.configureButton.setToolTipText(Messages.getI18NString("String_Node_Str").getText());
  this.searchButton.setToolTipText(Messages.getI18NString("String_Node_Str").getText());
  this.addButton.setToolTipText(Messages.getI18NString("String_Node_Str").getText());
  this.soundButton.setToolTipText(Messages.getI18NString("String_Node_Str").getText());
  this.updateMuteButton(GuiActivator.getAudioNotifier().isMute());
  this.init();
}
Program: 104358
Project: 104358
Buggy source:
/** 
 * Implements ComponentListener.componentMoved method in order to resize the toolbar when buttons are aligned on more than one row.
 */
public void componentMoved(ComponentEvent e){
  int compCount=this.getComponentCount();
  int buttonHeight=this.infoButton.getHeight();
  int biggestY=0;
  for (int i=0; i < compCount; i++) {
    Component c=this.getComponent(i);
    if (c instanceof JButton) {
      if (c.getY() > biggestY)       biggestY=c.getY();
    }
  }
  this.setPreferredSize(new Dimension(this.getWidth(),biggestY + buttonHeight));
  ((JPanel)this.getParent()).revalidate();
  ((JPanel)this.getParent()).repaint();
}

Fixed version (ground truth):
/** 
 * Implements ComponentListener.componentMoved method in order to resize the toolbar when buttons are aligned on more than one row.
 */
public void componentMoved(ComponentEvent e){
  int compCount=this.getComponentCount();
  int biggestY=0;
  for (int i=0; i < compCount; i++) {
    Component c=this.getComponent(i);
    if (c instanceof JButton) {
      if (c.getY() > biggestY)       biggestY=c.getY();
    }
  }
  this.setPreferredSize(new Dimension(this.getWidth(),biggestY + BUTTON_SIZE));
  ((JPanel)this.getParent()).revalidate();
  ((JPanel)this.getParent()).repaint();
}
Program: 104359
Project: 104359
Buggy source:
/** 
 * Returns all <tt>OperationSetWhiteboarding</tt>s obtained from the bundle context.
 * @return all <tt>OperationSetWhiteboarding</tt>s obtained from the bundlecontext
 */
public static List getWhiteboardOperationSets(){
  List whiteboardOpSets=new ArrayList();
  ServiceReference[] serRefs=null;
  try {
    serRefs=bundleContext.getServiceReferences(ProtocolProviderService.class.getName(),null);
  }
 catch (  InvalidSyntaxException e) {
    logger.error("String_Node_Str" + e);
  }
  for (int i=0; i < serRefs.length; i++) {
    ProtocolProviderService protocolProvider=(ProtocolProviderService)bundleContext.getService(serRefs[i]);
    OperationSet opSet=protocolProvider.getOperationSet(OperationSetWhiteboarding.class);
    if (opSet != null)     whiteboardOpSets.add(opSet);
  }
  return whiteboardOpSets;
}

Fixed version (ground truth):
/** 
 * Returns all <tt>OperationSetWhiteboarding</tt>s obtained from the bundle context.
 * @return all <tt>OperationSetWhiteboarding</tt>s obtained from the bundlecontext
 */
public static List getWhiteboardOperationSets(){
  List whiteboardOpSets=new ArrayList();
  ServiceReference[] serRefs=null;
  try {
    serRefs=bundleContext.getServiceReferences(ProtocolProviderService.class.getName(),null);
  }
 catch (  InvalidSyntaxException e) {
    logger.error("String_Node_Str" + e);
  }
  if (serRefs == null)   return null;
  for (int i=0; i < serRefs.length; i++) {
    ProtocolProviderService protocolProvider=(ProtocolProviderService)bundleContext.getService(serRefs[i]);
    OperationSet opSet=protocolProvider.getOperationSet(OperationSetWhiteboarding.class);
    if (opSet != null)     whiteboardOpSets.add(opSet);
  }
  return whiteboardOpSets;
}
Program: 104361
Project: 104361
Buggy source:
public WhiteboardSessionManager(){
  Iterator opSets=WhiteboardActivator.getWhiteboardOperationSets().iterator();
  while (opSets.hasNext()) {
    OperationSetWhiteboarding whiteboardOpSet=(OperationSetWhiteboarding)opSets.next();
    whiteboardOpSet.addInvitationListener(new InvitationListener());
    whiteboardOpSet.addPresenceListener(new PresenceListener());
  }
}

Fixed version (ground truth):
public WhiteboardSessionManager(){
  if (WhiteboardActivator.getWhiteboardOperationSets() == null)   return;
  Iterator opSets=WhiteboardActivator.getWhiteboardOperationSets().iterator();
  while (opSets.hasNext()) {
    OperationSetWhiteboarding whiteboardOpSet=(OperationSetWhiteboarding)opSets.next();
    whiteboardOpSet.addInvitationListener(new InvitationListener());
    whiteboardOpSet.addPresenceListener(new PresenceListener());
  }
}
Program: 104362
Project: 104362
Buggy source:
/** 
 * Creates an instance of this Message with the specified parameters.
 * @param content the text content of the message.
 * @param contentType a MIME string indicating the content type of the<tt>content</tt> String.
 * @param contentEncoding a MIME String indicating the content encoding ofthe <tt>content</tt> String.
 * @param subject the subject of the message or null for empty.
 */
public MessageSipImpl(String content,String contentType,String contentEncoding,String subject){
  this.textContent=content;
  this.contentType=contentType;
  this.contentEncoding=contentEncoding;
  this.subject=subject;
  this.messageUID=String.valueOf(System.currentTimeMillis()) + String.valueOf(hashCode());
}

Fixed version (ground truth):
/** 
 * Creates an instance of this Message with the specified parameters.
 * @param content the text content of the message.
 * @param contentType a MIME string indicating the content type of the<tt>content</tt> String.
 * @param contentEncoding a MIME String indicating the content encoding ofthe <tt>content</tt> String.
 * @param subject the subject of the message or null for empty.
 */
public MessageSipImpl(String content,String contentType,String contentEncoding,String subject){
  this.textContent=content;
  this.contentType=contentType;
  this.contentEncoding=contentEncoding;
  this.subject=subject;
  try {
    this.rawContent=content.getBytes(contentEncoding);
  }
 catch (  UnsupportedEncodingException ex) {
    logger.warn("String_Node_Str",ex);
    this.contentEncoding=Charset.defaultCharset().name();
    this.rawContent=content.getBytes();
  }
  this.messageUID=String.valueOf(System.currentTimeMillis()) + String.valueOf(hashCode());
}
Program: 104363
Project: 104363
Buggy source:
/** 
 * Returns the size of the content stored in this message.
 * @return an int indicating the number of bytes that this messagecontains.
 */
public int getSize(){
  return getContent().length();
}

Fixed version (ground truth):
/** 
 * Returns the size of the content stored in this message.
 * @return an int indicating the number of bytes that this messagecontains.
 */
public int getSize(){
  return rawContent.length;
}
Program: 104364
Project: 104364
Buggy source:
/** 
 * Get the raw/binary content of an instant message.
 * @return a byte[] array containing message bytes.
 */
public byte[] getRawData(){
  return getContent().getBytes();
}

Fixed version (ground truth):
/** 
 * Get the raw/binary content of an instant message.
 * @return a byte[] array containing message bytes.
 */
public byte[] getRawData(){
  return rawContent;
}
Program: 104366
Project: 104366
Buggy source:
/** 
 * Indicates whether the user is Online, available and eager to communicatie (can be reached and is likely to become annoyngly talkative if contacted).
 * @return true if the the status coefficient is higher than theEAGER_TO_COMMUNICATE_THRESHOLD and false otherwise
 */
public boolean isEagerToCommunicate(){
  return getStatus() >= EAGER_TO_COMMUNICATE_THRESHOLD;
}

Fixed version (ground truth):
/** 
 * Indicates whether the user is Online, available and eager to communicatie (can be reached and is likely to become annoyngly talkative if contacted).
 * @return true if the the status coefficient is higher than theEAGER_TO_COMMUNICATE_THRESHOLD and false otherwise
 */
public boolean isEagerToCommunicate(){
  return getStatus() >= EAGER_TO_COMMUNICATE_THRESSHOLD;
}
Program: 104367
Project: 104367
Buggy source:
public void run(){
  if (Constants.REMOVE_CONTACT_ASK) {
    String message="String_Node_Str" + this.group.getGroupName() + "String_Node_Str";
    MessageDialog dialog=new MessageDialog(mainFrame,message,Messages.getI18NString("String_Node_Str").getText());
    dialog.setTitle(Messages.getI18NString("String_Node_Str").getText());
    int returnCode=dialog.showDialog();
    if (returnCode == MessageDialog.OK_RETURN_CODE) {
      mainFrame.getContactList().removeMetaContactGroup(group);
    }
 else     if (returnCode == MessageDialog.OK_DONT_ASK_CODE) {
      mainFrame.getContactList().removeMetaContactGroup(group);
      Constants.REMOVE_CONTACT_ASK=false;
    }
  }
 else {
    mainFrame.getContactList().removeMetaContactGroup(group);
  }
}

Fixed version (ground truth):
public void run(){
  if (Constants.REMOVE_CONTACT_ASK) {
    String message="String_Node_Str" + this.group.getGroupName() + "String_Node_Str";
    MessageDialog dialog=new MessageDialog(mainFrame,Messages.getI18NString("String_Node_Str").getText(),message,Messages.getI18NString("String_Node_Str").getText());
    int returnCode=dialog.showDialog();
    if (returnCode == MessageDialog.OK_RETURN_CODE) {
      mainFrame.getContactList().removeMetaContactGroup(group);
    }
 else     if (returnCode == MessageDialog.OK_DONT_ASK_CODE) {
      mainFrame.getContactList().removeMetaContactGroup(group);
      Constants.REMOVE_CONTACT_ASK=false;
    }
  }
 else {
    mainFrame.getContactList().removeMetaContactGroup(group);
  }
}
Program: 104368
Project: 104368
Buggy source:
/** 
 * Unregisters the contained protocol provider and process all possible errors that may occur during the un-registration process.
 */
public void run(){
  try {
    protocolProvider.unregister();
  }
 catch (  OperationFailedException ex) {
    int errorCode=ex.getErrorCode();
    if (errorCode == OperationFailedException.GENERAL_ERROR) {
      logger.error("String_Node_Str" + "String_Node_Str" + ex);
    }
 else     if (errorCode == OperationFailedException.INTERNAL_ERROR) {
      logger.error("String_Node_Str" + "String_Node_Str" + ex);
    }
 else     if (errorCode == OperationFailedException.NETWORK_FAILURE) {
      logger.error("String_Node_Str" + "String_Node_Str" + ex);
    }
    new ErrorDialog(mainFrame,Messages.getI18NString("String_Node_Str",new String[]{protocolProvider.getAccountID().getUserID(),protocolProvider.getAccountID().getService()}).getText(),Messages.getI18NString("String_Node_Str").getText()).showDialog();
  }
}

Fixed version (ground truth):
/** 
 * Unregisters the contained protocol provider and process all possible errors that may occur during the un-registration process.
 */
public void run(){
  try {
    protocolProvider.unregister();
  }
 catch (  OperationFailedException ex) {
    int errorCode=ex.getErrorCode();
    if (errorCode == OperationFailedException.GENERAL_ERROR) {
      logger.error("String_Node_Str" + "String_Node_Str" + ex);
    }
 else     if (errorCode == OperationFailedException.INTERNAL_ERROR) {
      logger.error("String_Node_Str" + "String_Node_Str" + ex);
    }
 else     if (errorCode == OperationFailedException.NETWORK_FAILURE) {
      logger.error("String_Node_Str" + "String_Node_Str" + ex);
    }
    new ErrorDialog(mainFrame,Messages.getI18NString("String_Node_Str").getText(),Messages.getI18NString("String_Node_Str",new String[]{protocolProvider.getAccountID().getUserID(),protocolProvider.getAccountID().getService()}).getText()).showDialog();
  }
}
Program: 104370
Project: 104370
Buggy source:
/** 
 * Indicates whether the user is Online, available and eager to communicatie (can be reached and is likely to become annoyngly talkative if contacted).
 * @return true if the the status coefficient is higher than theEAGER_TO_COMMUNICATE_THRESHOLD and false otherwise
 */
public boolean isEagerToCommunicate(){
  return getStatus() >= EAGER_TO_COMMUNICATE_THRESSHOLD;
}

Fixed version (ground truth):
/** 
 * Indicates whether the user is Online, available and eager to communicatie (can be reached and is likely to become annoyngly talkative if contacted).
 * @return true if the the status coefficient is higher than theEAGER_TO_COMMUNICATE_THRESHOLD and false otherwise
 */
public boolean isEagerToCommunicate(){
  return getStatus() >= EAGER_TO_COMMUNICATE_THRESHOLD;
}
Program: 104371
Project: 104371
Buggy source:
public void run(){
  try {
    chatRoom.banParticipant((ChatRoomMember)chatContact.getSourceContact(),reason);
  }
 catch (  OperationFailedException e) {
    logger.error("String_Node_Str",e);
    if (e.getErrorCode() == OperationFailedException.NOT_ENOUGH_PRIVILEGES) {
      new ErrorDialog(chatPanel.getChatWindow(),Messages.getI18NString("String_Node_Str",new String[]{chatContact.getName()}).getText(),e,Messages.getI18NString("String_Node_Str").getText()).showDialog();
    }
 else     if (e.getErrorCode() == OperationFailedException.FORBIDDEN) {
      new ErrorDialog(chatPanel.getChatWindow(),Messages.getI18NString("String_Node_Str",new String[]{chatContact.getName()}).getText(),e,Messages.getI18NString("String_Node_Str").getText()).showDialog();
    }
 else {
      new ErrorDialog(chatPanel.getChatWindow(),Messages.getI18NString("String_Node_Str",new String[]{chatContact.getName()}).getText(),e,Messages.getI18NString("String_Node_Str").getText()).showDialog();
    }
  }
}

Fixed version (ground truth):
public void run(){
  try {
    chatRoom.banParticipant((ChatRoomMember)chatContact.getSourceContact(),reason);
  }
 catch (  OperationFailedException e) {
    logger.error("String_Node_Str",e);
    if (e.getErrorCode() == OperationFailedException.NOT_ENOUGH_PRIVILEGES) {
      new ErrorDialog(chatPanel.getChatWindow(),Messages.getI18NString("String_Node_Str").getText(),Messages.getI18NString("String_Node_Str",new String[]{chatContact.getName()}).getText(),e).showDialog();
    }
 else     if (e.getErrorCode() == OperationFailedException.FORBIDDEN) {
      new ErrorDialog(chatPanel.getChatWindow(),Messages.getI18NString("String_Node_Str").getText(),Messages.getI18NString("String_Node_Str",new String[]{chatContact.getName()}).getText(),e).showDialog();
    }
 else {
      new ErrorDialog(chatPanel.getChatWindow(),Messages.getI18NString("String_Node_Str").getText(),Messages.getI18NString("String_Node_Str",new String[]{chatContact.getName()}).getText(),e).showDialog();
    }
  }
}
Program: 104373
Project: 104373
Buggy source:
public void run(){
  try {
    configForm.submit();
  }
 catch (  Exception e) {
    new ErrorDialog(ChatRoomConfigurationWindow.this,Messages.getI18NString("String_Node_Str").getText(),e,Messages.getI18NString("String_Node_Str").getText()).showDialog();
  }
}

Fixed version (ground truth):
public void run(){
  try {
    configForm.submit();
  }
 catch (  Exception e) {
    new ErrorDialog(ChatRoomConfigurationWindow.this,Messages.getI18NString("String_Node_Str").getText(),Messages.getI18NString("String_Node_Str").getText(),e).showDialog();
  }
}
Program: 104374
Project: 104374
Buggy source:
/** 
 * Obtains and opens the configuration form of the corresponding chat room when user clicks on the configuration button.
 */
public void actionPerformed(ActionEvent evt){
  if (chatRoomWrapper.getChatRoom() == null)   return;
  try {
    ChatRoomConfigurationForm configForm=chatRoomWrapper.getChatRoom().getConfigurationForm();
    ChatRoomConfigurationWindow configWindow=new ChatRoomConfigurationWindow(chatRoomWrapper.getChatRoomName(),configForm);
    configWindow.setVisible(true);
  }
 catch (  OperationFailedException e) {
    logger.error("String_Node_Str",e);
    if (e.getErrorCode() == OperationFailedException.NOT_ENOUGH_PRIVILEGES) {
      new ErrorDialog(chatWindow,Messages.getI18NString("String_Node_Str",new String[]{chatRoomWrapper.getChatRoomName()}).getText(),Messages.getI18NString("String_Node_Str").getText(),ErrorDialog.WARNING).showDialog();
    }
 else {
      new ErrorDialog(chatWindow,Messages.getI18NString("String_Node_Str",new String[]{chatRoomWrapper.getChatRoomName()}).getText(),e,Messages.getI18NString("String_Node_Str").getText()).showDialog();
    }
  }
}

Fixed version (ground truth):
/** 
 * Obtains and opens the configuration form of the corresponding chat room when user clicks on the configuration button.
 */
public void actionPerformed(ActionEvent evt){
  if (chatRoomWrapper.getChatRoom() == null)   return;
  try {
    ChatRoomConfigurationForm configForm=chatRoomWrapper.getChatRoom().getConfigurationForm();
    ChatRoomConfigurationWindow configWindow=new ChatRoomConfigurationWindow(chatRoomWrapper.getChatRoomName(),configForm);
    configWindow.setVisible(true);
  }
 catch (  OperationFailedException e) {
    logger.error("String_Node_Str",e);
    if (e.getErrorCode() == OperationFailedException.NOT_ENOUGH_PRIVILEGES) {
      new ErrorDialog(chatWindow,Messages.getI18NString("String_Node_Str").getText(),Messages.getI18NString("String_Node_Str",new String[]{chatRoomWrapper.getChatRoomName()}).getText(),ErrorDialog.WARNING).showDialog();
    }
 else {
      new ErrorDialog(chatWindow,Messages.getI18NString("String_Node_Str").getText(),Messages.getI18NString("String_Node_Str",new String[]{chatRoomWrapper.getChatRoomName()}).getText(),e).showDialog();
    }
  }
}
Program: 104375
Project: 104375
Buggy source:
/** 
 * Called to accept an incoming invitation. Adds the invitation chat room to the list of chat rooms and joins it.
 * @param invitation the invitation to accept.
 */
public void acceptInvitation(ChatRoomInvitation invitation){
  ChatRoom chatRoom=invitation.getTargetChatRoom();
  byte[] password=invitation.getChatRoomPassword();
  ChatRoomsList chatRoomsList=mainFrame.getChatRoomsListPanel().getChatRoomsList();
  chatRoomsList.addChatRoom(new ChatRoomWrapper(chatRoom));
  try {
    if (password == null)     chatRoom.join();
 else     chatRoom.join(password);
  }
 catch (  OperationFailedException e) {
    new ErrorDialog(mainFrame,Messages.getI18NString("String_Node_Str",new String[]{chatRoom.getName()}).getText(),Messages.getI18NString("String_Node_Str").getText()).showDialog();
    logger.error("String_Node_Str" + chatRoom.getName(),e);
  }
}

Fixed version (ground truth):
/** 
 * Called to accept an incoming invitation. Adds the invitation chat room to the list of chat rooms and joins it.
 * @param invitation the invitation to accept.
 */
public void acceptInvitation(ChatRoomInvitation invitation){
  ChatRoom chatRoom=invitation.getTargetChatRoom();
  byte[] password=invitation.getChatRoomPassword();
  ChatRoomsList chatRoomsList=mainFrame.getChatRoomsListPanel().getChatRoomsList();
  chatRoomsList.addChatRoom(new ChatRoomWrapper(chatRoom));
  try {
    if (password == null)     chatRoom.join();
 else     chatRoom.join(password);
  }
 catch (  OperationFailedException e) {
    new ErrorDialog(mainFrame,Messages.getI18NString("String_Node_Str").getText(),Messages.getI18NString("String_Node_Str",new String[]{chatRoom.getName()}).getText()).showDialog();
    logger.error("String_Node_Str" + chatRoom.getName(),e);
  }
}
Program: 104378
Project: 104378
Buggy source:
public void run(){
  String chatRoomName=chatRoomPanel.getChatRoomName();
  ChatRoom chatRoom=null;
  try {
    chatRoom=mainFrame.getMultiUserChatOpSet(pps).createChatRoom(chatRoomName,null);
  }
 catch (  OperationFailedException ex) {
    logger.error("String_Node_Str",ex);
    new ErrorDialog(mainFrame,Messages.getI18NString("String_Node_Str",new String[]{chatRoomName}).getText(),ex,Messages.getI18NString("String_Node_Str").getText()).showDialog();
  }
catch (  OperationNotSupportedException ex) {
    logger.error("String_Node_Str",ex);
    new ErrorDialog(mainFrame,Messages.getI18NString("String_Node_Str",new String[]{chatRoomName}).getText(),ex,Messages.getI18NString("String_Node_Str").getText()).showDialog();
  }
  if (chatRoom != null)   mainFrame.getChatRoomsListPanel().getChatRoomsList().addChatRoom(new ChatRoomWrapper(chatRoom));
}

Fixed version (ground truth):
public void run(){
  String chatRoomName=chatRoomPanel.getChatRoomName();
  ChatRoom chatRoom=null;
  try {
    chatRoom=mainFrame.getMultiUserChatOpSet(pps).createChatRoom(chatRoomName,null);
  }
 catch (  OperationFailedException ex) {
    logger.error("String_Node_Str",ex);
    new ErrorDialog(mainFrame,Messages.getI18NString("String_Node_Str").getText(),Messages.getI18NString("String_Node_Str",new String[]{chatRoomName}).getText(),ex).showDialog();
  }
catch (  OperationNotSupportedException ex) {
    logger.error("String_Node_Str",ex);
    new ErrorDialog(mainFrame,Messages.getI18NString("String_Node_Str").getText(),Messages.getI18NString("String_Node_Str",new String[]{chatRoomName}).getText(),ex).showDialog();
  }
  if (chatRoom != null)   mainFrame.getChatRoomsListPanel().getChatRoomsList().addChatRoom(new ChatRoomWrapper(chatRoom));
}
Program: 104379
Project: 104379
Buggy source:
/** 
 * Indicates whether the user is Online, available and eager to communicatie (can be reached and is likely to become annoyngly talkative if contacted).
 * @return true if the the status coefficient is higher than theEAGER_TO_COMMUNICATE_THRESHOLD and false otherwise
 */
public boolean isEagerToCommunicate(){
  return getStatus() >= EAGER_TO_COMMUNICATE_THRESSHOLD;
}

Fixed version (ground truth):
/** 
 * Indicates whether the user is Online, available and eager to communicatie (can be reached and is likely to become annoyngly talkative if contacted).
 * @return true if the the status coefficient is higher than theEAGER_TO_COMMUNICATE_THRESHOLD and false otherwise
 */
public boolean isEagerToCommunicate(){
  return getStatus() >= EAGER_TO_COMMUNICATE_THRESHOLD;
}
Program: 104381
Project: 104381
Buggy source:
/** 
 * Removes the specified provider from the list of currently known providers and ignores all the contacts that it has registered locally.
 * @param provider the ProtocolProviderService that has been unregistered.
 */
private void handleProviderRemoved(ProtocolProviderService provider){
  logger.debug("String_Node_Str" + provider.getProtocolName());
  this.currentlyInstalledProviders.remove(provider.getAccountID().getAccountUniqueID());
  OperationSetPersistentPresence persPresOpSet=(OperationSetPersistentPresence)provider.getOperationSet(OperationSetPersistentPresence.class);
  if (persPresOpSet == null)   return;
  ContactGroup rootGroup=persPresOpSet.getServerStoredContactListRoot();
  Iterator subgroups=rootGroup.subgroups();
  while (subgroups.hasNext()) {
    ContactGroup group=(ContactGroup)subgroups.next();
    this.removeContactGroupFromMetaContactGroup(this.rootMetaGroup,group,provider);
  }
  this.removeContactGroupFromMetaContactGroup(this.rootMetaGroup,rootGroup,provider);
}

Fixed version (ground truth):
/** 
 * Removes the specified provider from the list of currently known providers and ignores all the contacts that it has registered locally.
 * @param provider the ProtocolProviderService that has been unregistered.
 */
private void handleProviderRemoved(ProtocolProviderService provider){
  logger.debug("String_Node_Str" + provider.getProtocolName());
  this.currentlyInstalledProviders.remove(provider.getAccountID().getAccountUniqueID());
  OperationSetPersistentPresence persPresOpSet=(OperationSetPersistentPresence)provider.getOperationSet(OperationSetPersistentPresence.class);
  if (persPresOpSet == null)   return;
  ContactGroup rootGroup=persPresOpSet.getServerStoredContactListRoot();
  Iterator subgroups=rootGroup.subgroups();
  while (subgroups.hasNext()) {
    ContactGroup group=(ContactGroup)subgroups.next();
    this.removeContactGroupFromMetaContactGroup((MetaContactGroupImpl)findMetaContactGroupByContactGroup(group),group,provider);
  }
  this.removeContactGroupFromMetaContactGroup(this.rootMetaGroup,rootGroup,provider);
}
Program: 104382
Project: 104382
Buggy source:
/** 
 * Derive a new SRTPCryptoContext for use with a new SSRC This method returns a new SRTPCryptoContext initialized with the data of this SRTPCryptoContext. Replacing the SSRC, Roll-over-Counter, and the key derivation rate the application cab use this SRTPCryptoContext to encrypt / decrypt a new stream (Synchronization source) inside one RTP session. Before the application can use this SRTPCryptoContext it must call the deriveSrtpKeys method.
 * @param ssrc The SSRC for this context
 * @param roc The Roll-Over-Counter for this context
 * @param keyDerivRate The key derivation rate for this context
 * @return a new SRTPCryptoContext with all relevant data set.
 */
public SRTPCryptoContext deriveContext(long ssrc,int roc,long deriveRate){
  SRTPCryptoContext pcc=new SRTPCryptoContext(ssrc,roc,deriveRate,this.masterKey,this.masterSalt,this.policy);
  return pcc;
}

Fixed version (ground truth):
/** 
 * Derive a new SRTPCryptoContext for use with a new SSRC This method returns a new SRTPCryptoContext initialized with the data of this SRTPCryptoContext. Replacing the SSRC, Roll-over-Counter, and the key derivation rate the application cab use this SRTPCryptoContext to encrypt / decrypt a new stream (Synchronization source) inside one RTP session. Before the application can use this SRTPCryptoContext it must call the deriveSrtpKeys method.
 * @param ssrc The SSRC for this context
 * @param roc The Roll-Over-Counter for this context
 * @param deriveRate The key derivation rate for this context
 * @return a new SRTPCryptoContext with all relevant data set.
 */
public SRTPCryptoContext deriveContext(long ssrc,int roc,long deriveRate){
  SRTPCryptoContext pcc=new SRTPCryptoContext(ssrc,roc,deriveRate,this.masterKey,this.masterSalt,this.policy);
  return pcc;
}
Program: 104385
Project: 104385
Buggy source:
/** 
 * Refreshes all the registered feeds.
 */
public void refreshAllRssFeeds(){
  Vector rssContactList=new Vector();
  rssContactList=opSetPersPresence.getContactListRoot().getRssURLList(rssContactList);
  Iterator rssContact=rssContactList.iterator();
  while (rssContact.hasNext()) {
    submitRssQuery((ContactRssImpl)rssContact.next(),false);
  }
}

Fixed version (ground truth):
/** 
 * Refreshes all the registered feeds.
 */
public void refreshAllRssFeeds(){
  Vector rssContactList=new Vector();
  rssContactList=opSetPersPresence.getContactListRoot().getRssURLList(rssContactList);
  Iterator rssContact=rssContactList.iterator();
  while (rssContact.hasNext()) {
    ContactRssImpl contact=(ContactRssImpl)rssContact.next();
    try {
      submitRssQuery(contact,false);
    }
 catch (    Exception ex) {
      logger.error("String_Node_Str" + contact,ex);
    }
  }
}
Program: 104386
Project: 104386
Buggy source:
/** 
 * Used for restoring the key information from a textual representation.
 * @param settings textual representation of the stored data
 */
public static RssItemKey deserialize(String settings){
  StringTokenizer reader=new StringTokenizer(settings,"String_Node_Str");
  RssItemKey result=new RssItemKey();
  while (reader.hasMoreTokens()) {
    String data[]=reader.nextToken().split("String_Node_Str");
    if (data[0].equals("String_Node_Str")) {
      if (data.length == 2) {
        try {
          result.itemDate=formatter.parse(data[1]);
        }
 catch (        ParseException e) {
          result.itemDate=null;
        }
      }
 else       result.itemDate=null;
    }
    if (data[0].equals("String_Node_Str")) {
      if (data.length == 2)       result.itemUri=data[1];
 else       result.itemUri=null;
    }
    if (data[0].equals("String_Node_Str")) {
      if (data.length == 2)       result.usesDate=Boolean.valueOf(data[1]).booleanValue();
 else       result.usesDate=result.itemDate == null;
    }
  }
  if (result.itemDate == null && result.itemUri == null)   return null;
 else   return result;
}

Fixed version (ground truth):
/** 
 * Used for restoring the key information from a textual representation.
 * @param settings textual representation of the stored data
 * @return the result rss item
 */
public static RssItemKey deserialize(String settings){
  StringTokenizer reader=new StringTokenizer(settings,"String_Node_Str");
  RssItemKey result=new RssItemKey();
  while (reader.hasMoreTokens()) {
    String data[]=reader.nextToken().split("String_Node_Str",2);
    if (data[0].equals("String_Node_Str")) {
      if (data.length == 2) {
        try {
          result.itemDate=formatter.parse(data[1]);
        }
 catch (        ParseException e) {
          result.itemDate=null;
        }
      }
 else       result.itemDate=null;
    }
    if (data[0].equals("String_Node_Str")) {
      if (data.length == 2)       result.itemUri=data[1];
 else       result.itemUri=null;
    }
    if (data[0].equals("String_Node_Str")) {
      if (data.length == 2)       result.usesDate=Boolean.valueOf(data[1]).booleanValue();
 else       result.usesDate=result.itemDate == null;
    }
  }
  if (result.itemDate == null && result.itemUri == null)   return null;
 else   return result;
}
Program: 104387
Project: 104387
Buggy source:
/** 
 * Tests if an ID is valid.
 */
private static boolean isIDValid(String id){
  boolean isValid=true;
  int pos=id.indexOf('%');
  if (pos < 0) {
    isValid=!hasSpecialChar(id);
  }
 else {
    if (pos + 1 < id.length()) {
      String start=id.substring(0,pos);
      String end=id.substring(pos + 1);
      isValid=!hasSpecialChar(start);
      if (isValid) {
        try {
          Integer.parseInt(end,16);
          isValid=true;
        }
 catch (        Exception e) {
          isValid=false;
        }
      }
    }
 else {
      isValid=false;
    }
  }
  return isValid;
}

Fixed version (ground truth):
/** 
 * Tests if an ID is valid.
 */
private static boolean isIDValid(String id){
  boolean isValid=true;
  int pos=id.indexOf('$');
  if (pos < 0) {
    isValid=!hasSpecialChar(id);
  }
 else {
    if (pos + 1 < id.length()) {
      String start=id.substring(0,pos);
      String end=id.substring(pos + 1);
      isValid=!hasSpecialChar(start);
      if (isValid) {
        try {
          Integer.parseInt(end,16);
          isValid=true;
        }
 catch (        Exception e) {
          isValid=false;
        }
      }
    }
 else {
      isValid=false;
    }
  }
  return isValid;
}
Program: 104388
Project: 104388
Buggy source:
/** 
 * An one-way function returning a "human readable" containing no special characters. All characters _, a-z, A-Z, 0-9 are kept unchainged. All other are replaced with _ and the word is postfixed with %HASHCODE, where HASHCODE is the hexadecimal hash value of the original string. If there are no special characters the word is not postfixed. Note: This method does not use URLEncoder, because in url-encoding the  sign is considered as "safe".
 * @param rawString The string to be hashed.
 * @return The human-readable hash.
 */
public static String readableHash(String rawString){
  StringBuffer encodedString=new StringBuffer(rawString);
  boolean addHash=false;
  for (int i=0; i < encodedString.length(); i++) {
    if (HistoryID.isSpecialChar(encodedString.charAt(i))) {
      addHash=true;
      encodedString.setCharAt(i,'_');
    }
  }
  if (addHash) {
    encodedString.append('%');
    encodedString.append(Integer.toHexString(rawString.hashCode()));
  }
  return encodedString.toString();
}

Fixed version (ground truth):
/** 
 * An one-way function returning a "human readable" containing no special characters. All characters _, a-z, A-Z, 0-9 are kept unchainged. All other are replaced with _ and the word is postfixed with $HASHCODE, where HASHCODE is the hexadecimal hash value of the original string. If there are no special characters the word is not postfixed. Note: This method does not use URLEncoder, because in url-encoding the  sign is considered as "safe".
 * @param rawString The string to be hashed.
 * @return The human-readable hash.
 */
public static String readableHash(String rawString){
  StringBuffer encodedString=new StringBuffer(rawString);
  boolean addHash=false;
  for (int i=0; i < encodedString.length(); i++) {
    if (HistoryID.isSpecialChar(encodedString.charAt(i))) {
      addHash=true;
      encodedString.setCharAt(i,'_');
    }
  }
  if (addHash) {
    encodedString.append('$');
    encodedString.append(Integer.toHexString(rawString.hashCode()));
  }
  return encodedString.toString();
}
Program: 104389
Project: 104389
Buggy source:
/** 
 * Tests if a character is a special one. A character is special if it is not in the range _, a-z, A-Z, 0-9.
 * @param c The character to test.
 * @return Returns true if the character is special. False otherwise.
 */
private static boolean isSpecialChar(char c){
  return (c != '_') && (c < 'A' || c > 'Z') && (c < 'a' || c > 'z')&& (c < '0' || c > '9');
}

Fixed version (ground truth):
/** 
 * Tests if a character is a special one. A character is special if it is not in the range _, a-z, A-Z, 0-9.
 * @param c The character to test.
 * @return Returns true if the character is special. False otherwise.
 */
private static boolean isSpecialChar(char c){
  return (c != '_') && (c != '@') && (c != '.')&& (c != '-')&& (c != '+')&& (c < 'A' || c > 'Z')&& (c < 'a' || c > 'z')&& (c < '0' || c > '9');
}
Program: 104390
Project: 104390
Buggy source:
/** 
 * Tests there is a special character in a string.
 */
private static boolean hasSpecialChar(String str){
  boolean hasSpecialChar=false;
  for (int i=0; i < str.length(); i++) {
    if (isSpecialChar(str.charAt(i))) {
      hasSpecialChar=false;
      break;
    }
  }
  return hasSpecialChar;
}

Fixed version (ground truth):
/** 
 * Tests there is a special character in a string.
 */
private static boolean hasSpecialChar(String str){
  boolean hasSpecialChar=false;
  for (int i=0; i < str.length(); i++) {
    if (isSpecialChar(str.charAt(i))) {
      hasSpecialChar=true;
      break;
    }
  }
  return hasSpecialChar;
}