nus-yam/ex-repair huggingface dataset:
Program: 104115
Project: 104115
Buggy source:
/** 
 * When CTRL+Z is pressed invokes the <code>ChatWritePanel.undo()</code> method, when CTRL+R is pressed invokes the <code>ChatWritePanel.redo()</code> method. <p> Sends typing notifications when user types.
 */
public void keyPressed(KeyEvent e){
  if ((e.getModifiers() & KeyEvent.CTRL_MASK) == KeyEvent.CTRL_MASK && (e.getKeyCode() == KeyEvent.VK_Z)) {
    if (undo.canUndo())     undo();
  }
 else   if ((e.getModifiers() & KeyEvent.CTRL_MASK) == KeyEvent.CTRL_MASK && (e.getKeyCode() == KeyEvent.VK_R)) {
    if (undo.canRedo())     redo();
  }
 else   if (ConfigurationManager.isSendTypingNotifications() && e.getKeyCode() != KeyEvent.VK_ESCAPE) {
    if (typingState != OperationSetTypingNotifications.STATE_TYPING) {
      stoppedTypingTimer.setDelay(2 * 1000);
      typingState=OperationSetTypingNotifications.STATE_TYPING;
      int result=chatPanel.getChatSession().getCurrentChatTransport().sendTypingNotification(typingState);
      if (result == ChatPanel.TYPING_NOTIFICATION_SUCCESSFULLY_SENT)       typingTimer.start();
    }
    if (!stoppedTypingTimer.isRunning())     stoppedTypingTimer.start();
 else     stoppedTypingTimer.restart();
  }
}

Fixed version (ground truth):
/** 
 * When CTRL+Z is pressed invokes the <code>ChatWritePanel.undo()</code> method, when CTRL+R is pressed invokes the <code>ChatWritePanel.redo()</code> method. <p> Sends typing notifications when user types.
 */
public void keyPressed(KeyEvent e){
  if ((e.getModifiers() & KeyEvent.CTRL_MASK) == KeyEvent.CTRL_MASK && (e.getKeyCode() == KeyEvent.VK_Z)) {
    if (undo.canUndo())     undo();
  }
 else   if ((e.getModifiers() & KeyEvent.CTRL_MASK) == KeyEvent.CTRL_MASK && (e.getKeyCode() == KeyEvent.VK_R)) {
    if (undo.canRedo())     redo();
  }
 else   if (ConfigurationManager.isSendTypingNotifications() && e.getKeyCode() != KeyEvent.VK_ESCAPE && !e.isAltDown() && !e.isControlDown() && !e.isActionKey()) {
    if (typingState != OperationSetTypingNotifications.STATE_TYPING) {
      stoppedTypingTimer.setDelay(2 * 1000);
      typingState=OperationSetTypingNotifications.STATE_TYPING;
      int result=chatPanel.getChatSession().getCurrentChatTransport().sendTypingNotification(typingState);
      if (result == ChatPanel.TYPING_NOTIFICATION_SUCCESSFULLY_SENT)       typingTimer.start();
    }
    if (!stoppedTypingTimer.isRunning())     stoppedTypingTimer.start();
 else     stoppedTypingTimer.restart();
  }
}
Program: 104116
Project: 104116
Buggy source:
/** 
 * Handles the <tt>ActionEvent</tt>. The choosen menu item should correspond to an account, where the new contact will be added. We obtain here the protocol provider corresponding to the choosen account and show the dialog, where the user could add the contact.
 */
public void actionPerformed(ActionEvent e){
  JMenuItem item=(JMenuItem)e.getSource();
  String itemText=item.getText();
  String itemName=item.getName();
  if (itemName.equals("String_Node_Str")) {
    if (group != null)     new RemoveGroupThread(group).start();
  }
 else   if (itemName.equals("String_Node_Str")) {
    RenameGroupDialog dialog=new RenameGroupDialog(mainFrame,group);
    dialog.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width / 2 - 200,Toolkit.getDefaultToolkit().getScreenSize().height / 2 - 50);
    dialog.setVisible(true);
    dialog.requestFocusInFiled();
  }
 else   if (item instanceof AccountMenuItem) {
    ProtocolProviderService pps=((AccountMenuItem)item).getProtocolProvider();
    AddContactDialog dialog=new AddContactDialog(mainFrame,group,pps);
    dialog.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width / 2 - 250,Toolkit.getDefaultToolkit().getScreenSize().height / 2 - 100);
    dialog.showDialog();
  }
}

Fixed version (ground truth):
/** 
 * Handles the <tt>ActionEvent</tt>. The choosen menu item should correspond to an account, where the new contact will be added. We obtain here the protocol provider corresponding to the choosen account and show the dialog, where the user could add the contact.
 */
public void actionPerformed(ActionEvent e){
  JMenuItem item=(JMenuItem)e.getSource();
  String itemName=item.getName();
  if (itemName.equals("String_Node_Str")) {
    if (group != null)     new RemoveGroupThread(group).start();
  }
 else   if (itemName.equals("String_Node_Str")) {
    RenameGroupDialog dialog=new RenameGroupDialog(mainFrame,group);
    dialog.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width / 2 - 200,Toolkit.getDefaultToolkit().getScreenSize().height / 2 - 50);
    dialog.setVisible(true);
    dialog.requestFocusInFiled();
  }
 else   if (item instanceof AccountMenuItem) {
    ProtocolProviderService pps=((AccountMenuItem)item).getProtocolProvider();
    AddContactDialog dialog=new AddContactDialog(mainFrame,group,pps);
    dialog.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width / 2 - 250,Toolkit.getDefaultToolkit().getScreenSize().height / 2 - 100);
    dialog.showDialog();
  }
}
Program: 104117
Project: 104117
Buggy source:
/** 
 * Creates an instance of <tt>ChatContactListPanel</tt>.
 */
public ChatRoomMemberListPanel(ChatPanel chat){
  super(new BorderLayout());
  this.memberList=new DefaultContactList();
  this.memberList.setModel(memberListModel);
  this.memberList.setCellRenderer(new ChatContactCellRenderer());
  JScrollPane contactsScrollPane=new SCScrollPane();
  contactsScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  contactsScrollPane.getViewport().add(memberList);
  contactsScrollPane.getViewport().setOpaque(false);
  contactsScrollPane.setOpaque(false);
  this.add(contactsScrollPane);
}

Fixed version (ground truth):
/** 
 * Creates an instance of <tt>ChatContactListPanel</tt>.
 */
public ChatRoomMemberListPanel(ChatPanel chat){
  super(new BorderLayout());
  this.memberList.setModel(memberListModel);
  this.memberList.setCellRenderer(new ChatContactCellRenderer());
  JScrollPane contactsScrollPane=new SCScrollPane();
  contactsScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  contactsScrollPane.setOpaque(false);
  JViewport viewport=contactsScrollPane.getViewport();
  viewport.setOpaque(false);
  viewport.add(memberList);
  this.add(contactsScrollPane);
}
Program: 104119
Project: 104119
Buggy source:
/** 
 * Removes from the wizard the <tt>WizardPage</tt> corresponding to the given identifier.
 * @param id The identifer of the wizard page.
 */
public void unregisterWizardPage(Object id){
  WizardPage wizardPage=wizardModel.getWizardPage(id);
  if (wizardPage != null) {
    cardPanel.remove((Component)wizardModel.getWizardPage(id).getWizardForm());
    wizardModel.unregisterPage(id);
  }
}

Fixed version (ground truth):
/** 
 * Removes from the wizard the <tt>WizardPage</tt> corresponding to the given identifier.
 * @param id The identifier of the wizard page.
 */
public void unregisterWizardPage(Object id){
  WizardPage wizardPage=wizardModel.getWizardPage(id);
  if (wizardPage != null) {
    cardPanel.remove((Component)wizardModel.getWizardPage(id).getWizardForm());
    wizardModel.unregisterPage(id);
  }
}
Program: 104120
Project: 104120
Buggy source:
/** 
 * This method accepts a java.awt.Frame object as the javax.swing.JDialog's parent.
 * @param owner The java.awt.Frame object that is the owner of thejavax.swing.JDialog.
 */
public Wizard(Frame owner){
  super(owner,false);
  wizardModel=new WizardModel();
  initComponents();
}

Fixed version (ground truth):
/** 
 * This method accepts a java.awt.Frame object as the javax.swing.JDialog's parent.
 * @param owner The java.awt.Frame object that is the owner of thejavax.swing.JDialog.
 */
public Wizard(Frame owner){
  super(owner,false);
  initComponents();
}
Program: 104121
Project: 104121
Buggy source:
/** 
 * Resets the buttons to support the original panel rules, including whether the next or back buttons are enabled or disabled, or if the panel is finishable. If the panel in question has another panel behind it, enables the back button. Otherwise, disables it. If the panel in question has one or more panels in front of it, enables the next button. Otherwise, disables it.
 */
void resetButtonsToPanelRules(){
  WizardModel model=wizard.getModel();
  WizardPage page=model.getCurrentWizardPage();
  model.setCancelButtonText(Wizard.CANCEL_TEXT);
  model.setBackButtonText(Wizard.BACK_TEXT);
  if (page.getBackPageIdentifier() != null) {
    model.setBackButtonEnabled(Boolean.TRUE);
  }
 else {
    model.setBackButtonEnabled(Boolean.FALSE);
  }
  if (page.getNextPageIdentifier() != null) {
    model.setNextFinishButtonEnabled(Boolean.TRUE);
  }
 else {
    model.setNextFinishButtonEnabled(Boolean.FALSE);
  }
  if (page.getNextPageIdentifier().equals(WizardPage.FINISH_PAGE_IDENTIFIER)) {
    model.setNextFinishButtonText(Wizard.FINISH_TEXT);
  }
 else {
    model.setNextFinishButtonText(Wizard.NEXT_TEXT);
  }
}

Fixed version (ground truth):
/** 
 * Resets the buttons to support the original panel rules, including whether the next or back buttons are enabled or disabled, or if the panel is finishable. If the panel in question has another panel behind it, enables the back button. Otherwise, disables it. If the panel in question has one or more panels in front of it, enables the next button. Otherwise, disables it.
 */
void resetButtonsToPanelRules(){
  WizardModel model=wizard.getModel();
  WizardPage page=model.getCurrentWizardPage();
  model.setCancelButtonText(Wizard.CANCEL_TEXT);
  Object backPageIdentifier=page.getBackPageIdentifier();
  model.setBackButtonEnabled((backPageIdentifier != null) && !WizardPage.DEFAULT_PAGE_IDENTIFIER.equals(backPageIdentifier));
  model.setBackButtonText(Wizard.BACK_TEXT);
  model.setNextFinishButtonEnabled(page.getNextPageIdentifier() != null);
  if (page.getNextPageIdentifier().equals(WizardPage.FINISH_PAGE_IDENTIFIER)) {
    model.setNextFinishButtonText(Wizard.FINISH_TEXT);
  }
 else {
    model.setNextFinishButtonText(Wizard.NEXT_TEXT);
  }
}
Program: 104122
Project: 104122
Buggy source:
/** 
 * Saves the (protocol provider, wizard) pair in through the <tt>ConfigurationService</tt>.
 * @param protocolProvider the protocol provider to save
 * @param wizard the wizard to save
 */
public void saveAccountWizard(ProtocolProviderService protocolProvider,AccountRegistrationWizard wizard){
  String prefix="String_Node_Str";
  List<String> accounts=configService.getPropertyNamesByPrefix(prefix,true);
  boolean savedAccount=false;
  for (  String accountRootPropName : accounts) {
    String accountUID=configService.getString(accountRootPropName);
    if (accountUID.equals(protocolProvider.getAccountID().getAccountUniqueID())) {
      configService.setProperty(accountRootPropName + "String_Node_Str",wizard.getClass().getName().replace('.','_'));
      savedAccount=true;
    }
  }
  if (!savedAccount) {
    String accNodeName="String_Node_Str" + Long.toString(System.currentTimeMillis());
    String accountPackage="String_Node_Str" + accNodeName;
    configService.setProperty(accountPackage,protocolProvider.getAccountID().getAccountUniqueID());
    configService.setProperty(accountPackage + "String_Node_Str",wizard);
  }
}

Fixed version (ground truth):
/** 
 * Saves the (protocol provider, wizard) pair in through the <tt>ConfigurationService</tt>.
 * @param protocolProvider the protocol provider to save
 * @param wizard the wizard to save
 */
public void saveAccountWizard(ProtocolProviderService protocolProvider,AccountRegistrationWizard wizard){
  String prefix="String_Node_Str";
  List<String> accounts=configService.getPropertyNamesByPrefix(prefix,true);
  boolean savedAccount=false;
  for (  String accountRootPropName : accounts) {
    String accountUID=configService.getString(accountRootPropName);
    if (accountUID.equals(protocolProvider.getAccountID().getAccountUniqueID())) {
      configService.setProperty(accountRootPropName + "String_Node_Str",wizard.getClass().getName().replace('.','_'));
      savedAccount=true;
    }
  }
  if (!savedAccount) {
    String accountPackage=prefix + "String_Node_Str" + Long.toString(System.currentTimeMillis());
    configService.setProperty(accountPackage,protocolProvider.getAccountID().getAccountUniqueID());
    configService.setProperty(accountPackage + "String_Node_Str",wizard);
  }
}
Program: 104123
Project: 104123
Buggy source:
public AccountRegWizardContainerImpl(MainFrame mainFrame){
  super(mainFrame);
  this.setTitle(GuiActivator.getResources().getI18NString("String_Node_Str"));
  this.summaryPage=new AccountRegSummaryPage(this);
  this.registerWizardPage(summaryPage.getIdentifier(),summaryPage);
  ServiceReference[] accountWizardRefs=null;
  try {
    accountWizardRefs=GuiActivator.bundleContext.getServiceReferences(AccountRegistrationWizard.class.getName(),null);
  }
 catch (  InvalidSyntaxException ex) {
    logger.error("String_Node_Str",ex);
    return;
  }
  if (accountWizardRefs != null) {
    logger.debug("String_Node_Str" + accountWizardRefs.length + "String_Node_Str");
    for (int i=0; i < accountWizardRefs.length; i++) {
      ServiceReference serRef=accountWizardRefs[i];
      String protocolName=(String)serRef.getProperty(ProtocolProviderFactory.PROTOCOL);
      AccountRegistrationWizard wizard=(AccountRegistrationWizard)GuiActivator.bundleContext.getService(serRef);
      this.addAccountRegistrationWizard(protocolName,wizard);
    }
  }
  GuiActivator.bundleContext.addServiceListener(this);
}

Fixed version (ground truth):
public AccountRegWizardContainerImpl(MainFrame mainFrame){
  super(mainFrame);
  this.setTitle(GuiActivator.getResources().getI18NString("String_Node_Str"));
  this.summaryPage=new AccountRegSummaryPage(this);
  this.registerWizardPage(summaryPage.getIdentifier(),summaryPage);
  ServiceReference[] accountWizardRefs=null;
  try {
    accountWizardRefs=GuiActivator.bundleContext.getServiceReferences(AccountRegistrationWizard.class.getName(),null);
  }
 catch (  InvalidSyntaxException ex) {
    logger.error("String_Node_Str",ex);
    return;
  }
  if (accountWizardRefs != null) {
    logger.debug("String_Node_Str" + accountWizardRefs.length + "String_Node_Str");
    for (    ServiceReference serRef : accountWizardRefs) {
      String protocolName=(String)serRef.getProperty(ProtocolProviderFactory.PROTOCOL);
      AccountRegistrationWizard wizard=(AccountRegistrationWizard)GuiActivator.bundleContext.getService(serRef);
      this.addAccountRegistrationWizard(protocolName,wizard);
    }
  }
  GuiActivator.bundleContext.addServiceListener(this);
}
Program: 104124
Project: 104124
Buggy source:
/** 
 * Handles registration of a new account wizard.
 */
public void serviceChanged(ServiceEvent event){
  if (!GuiActivator.isStarted)   return;
  ServiceReference serRef=event.getServiceReference();
  String protocolName=(String)serRef.getProperty(ProtocolProviderFactory.PROTOCOL);
  Object sService=GuiActivator.bundleContext.getService(event.getServiceReference());
  if (!(sService instanceof AccountRegistrationWizard)) {
    return;
  }
  AccountRegistrationWizard wizard=(AccountRegistrationWizard)sService;
switch (event.getType()) {
case ServiceEvent.REGISTERED:
    logger.info("String_Node_Str");
  this.addAccountRegistrationWizard(protocolName,wizard);
break;
case ServiceEvent.UNREGISTERING:
this.removeAccountRegistrationWizard(protocolName,wizard);
break;
}
}

Fixed version (ground truth):
/** 
 * Handles registration of a new account wizard.
 */
public void serviceChanged(ServiceEvent event){
  if (!GuiActivator.isStarted)   return;
  ServiceReference serRef=event.getServiceReference();
  Object sService=GuiActivator.bundleContext.getService(serRef);
  if (!(sService instanceof AccountRegistrationWizard))   return;
  String protocolName=(String)serRef.getProperty(ProtocolProviderFactory.PROTOCOL);
  AccountRegistrationWizard wizard=(AccountRegistrationWizard)sService;
switch (event.getType()) {
case ServiceEvent.REGISTERED:
    logger.info("String_Node_Str");
  this.addAccountRegistrationWizard(protocolName,wizard);
break;
case ServiceEvent.UNREGISTERING:
this.removeAccountRegistrationWizard(protocolName,wizard);
break;
}
}
Program: 104125
Project: 104125
Buggy source:
/** 
 * Opens the corresponding wizard to modify an existing account given by the <tt>protocolProvider</tt> parameter.
 * @param protocolProvider The <tt>ProtocolProviderService</tt> for theaccount to modify.
 */
public void modifyAccount(ProtocolProviderService protocolProvider){
  AccountRegistrationWizard wizard=registeredWizards.get(protocolProvider.getProtocolDisplayName());
  this.setCurrentWizard(wizard);
  wizard.setModification(true);
  Iterator<WizardPage> i=wizard.getPages();
  boolean firstPage=true;
  while (i.hasNext()) {
    WizardPage page=i.next();
    Object identifier=page.getIdentifier();
    this.registerWizardPage(identifier,page);
    if (firstPage) {
      this.setCurrentPage(identifier);
      firstPage=false;
    }
  }
  wizard.loadAccount(protocolProvider);
  try {
    this.setWizzardIcon(ImageIO.read(new ByteArrayInputStream(wizard.getPageImage())));
  }
 catch (  IOException e1) {
    e1.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Opens the corresponding wizard to modify an existing account given by the <tt>protocolProvider</tt> parameter.
 * @param protocolProvider The <tt>ProtocolProviderService</tt> for theaccount to modify.
 */
public void modifyAccount(ProtocolProviderService protocolProvider){
  AccountRegistrationWizard wizard=registeredWizards.get(protocolProvider.getProtocolDisplayName());
  this.setCurrentWizard(wizard);
  wizard.setModification(true);
  wizard.loadAccount(protocolProvider);
}
Program: 104126
Project: 104126
Buggy source:
/** 
 * Sets the currently used <tt>AccountRegistrationWizard</tt>.
 * @param wizard the <tt>AccountRegistrationWizard</tt> to set ascurrent one
 */
public void setCurrentWizard(AccountRegistrationWizard wizard){
  this.currentWizard=wizard;
  Dimension wizardSize=this.currentWizard.getSize();
  summaryPage.setPreferredSize(wizardSize);
  Iterator<WizardPage> i=wizard.getPages();
  while (i.hasNext()) {
    WizardPage page=i.next();
    this.registerWizardPage(page.getIdentifier(),page);
  }
  this.setCurrentPage(wizard.getFirstPageIdentifier());
  try {
    this.setWizzardIcon(ImageIO.read(new ByteArrayInputStream(wizard.getPageImage())));
  }
 catch (  IOException e1) {
    e1.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Sets the currently used <tt>AccountRegistrationWizard</tt>.
 * @param wizard the <tt>AccountRegistrationWizard</tt> to set ascurrent one
 */
public void setCurrentWizard(AccountRegistrationWizard wizard){
  this.currentWizard=wizard;
  summaryPage.setPreferredSize(this.currentWizard.getSize());
  Iterator<WizardPage> i=wizard.getPages();
  while (i.hasNext()) {
    WizardPage page=i.next();
    this.registerWizardPage(page.getIdentifier(),page);
  }
  this.setCurrentPage(wizard.getFirstPageIdentifier());
  try {
    this.setWizzardIcon(ImageIO.read(new ByteArrayInputStream(wizard.getPageImage())));
  }
 catch (  IOException e1) {
    e1.printStackTrace();
  }
}
Program: 104129
Project: 104129
Buggy source:
/** 
 * Handles the <tt>ActionEvent</tt> when one of the menu items is selected.
 */
public void actionPerformed(ActionEvent e){
  JMenuItem menuItem=(JMenuItem)e.getSource();
  String itemText=menuItem.getName();
  if (itemText.equalsIgnoreCase("String_Node_Str")) {
    ChatRoomListDialog chatRoomsDialog=new ChatRoomListDialog(GuiActivator.getUIService().getMainFrame());
    chatRoomsDialog.setPreferredSize(new Dimension(500,400));
    chatRoomsDialog.setVisible(true);
  }
 else   if (itemText.equalsIgnoreCase("String_Node_Str")) {
    this.parentWindow.setVisible(false);
    this.parentWindow.dispose();
  }
}

Fixed version (ground truth):
/** 
 * Handles the <tt>ActionEvent</tt> when one of the menu items is selected.
 */
public void actionPerformed(ActionEvent e){
  JMenuItem menuItem=(JMenuItem)e.getSource();
  String itemText=menuItem.getName();
  if (itemText.equalsIgnoreCase("String_Node_Str")) {
    ChatRoomListDialog.showChatRoomListDialog();
  }
 else   if (itemText.equalsIgnoreCase("String_Node_Str")) {
    this.parentWindow.setVisible(false);
    this.parentWindow.dispose();
  }
}
Program: 104130
Project: 104130
Buggy source:
/** 
 * Handles the <tt>ActionEvent</tt> when one of the menu items is selected.
 */
public void actionPerformed(ActionEvent e){
  JMenuItem menuItem=(JMenuItem)e.getSource();
  String itemName=menuItem.getName();
  if (itemName.equals("String_Node_Str")) {
    NewAccountDialog.showNewAccountDialog();
  }
 else   if (itemName.equals("String_Node_Str")) {
    AddContactWizard wizard=new AddContactWizard(parentWindow);
    wizard.showDialog(false);
  }
 else   if (itemName.equals("String_Node_Str")) {
    CreateGroupDialog dialog=new CreateGroupDialog(parentWindow);
    dialog.setVisible(true);
  }
 else   if (itemName.equals("String_Node_Str")) {
    closeActionPerformed();
  }
 else   if (itemName.equals("String_Node_Str")) {
    ChatRoomListDialog chatRoomsDialog=new ChatRoomListDialog(parentWindow);
    chatRoomsDialog.setPreferredSize(new Dimension(500,400));
    chatRoomsDialog.setVisible(true);
  }
}

Fixed version (ground truth):
/** 
 * Handles the <tt>ActionEvent</tt> when one of the menu items is selected.
 */
public void actionPerformed(ActionEvent e){
  JMenuItem menuItem=(JMenuItem)e.getSource();
  String itemName=menuItem.getName();
  if (itemName.equals("String_Node_Str")) {
    NewAccountDialog.showNewAccountDialog();
  }
 else   if (itemName.equals("String_Node_Str")) {
    AddContactWizard wizard=new AddContactWizard(parentWindow);
    wizard.showDialog(false);
  }
 else   if (itemName.equals("String_Node_Str")) {
    CreateGroupDialog dialog=new CreateGroupDialog(parentWindow);
    dialog.setVisible(true);
  }
 else   if (itemName.equals("String_Node_Str")) {
    closeActionPerformed();
  }
 else   if (itemName.equals("String_Node_Str")) {
    ChatRoomListDialog.showChatRoomListDialog();
  }
}
Program: 104131
Project: 104131
Buggy source:
/** 
 * Creates an SCAudioClip from the given URI and adds it to the list of available audio-s.
 * @param uri the path where the audio file could be found
 */
public SCAudioClip createAudio(String uri){
  SCAudioClipImpl audioClip;
synchronized (audioClips) {
    if (audioClips.containsKey(uri)) {
      audioClip=audioClips.get(uri);
    }
 else {
      URL url=AudioNotifierActivator.getResources().getSoundURLForPath(uri);
      if (url == null) {
        try {
          url=new URL(uri);
        }
 catch (        MalformedURLException e) {
        }
      }
      audioClip=new SCAudioClipImpl(url,this);
      audioClips.put(uri,audioClip);
    }
  }
  return audioClip;
}

Fixed version (ground truth):
/** 
 * Creates an SCAudioClip from the given URI and adds it to the list of available audio-s.
 * @param uri the path where the audio file could be found
 */
public SCAudioClip createAudio(String uri){
  SCAudioClipImpl audioClip;
synchronized (audioClips) {
    if (audioClips.containsKey(uri)) {
      audioClip=audioClips.get(uri);
    }
 else {
      URL url=AudioNotifierActivator.getResources().getSoundURLForPath(uri);
      if (url == null) {
        try {
          url=new URL(uri);
        }
 catch (        MalformedURLException e) {
          return null;
        }
      }
      try {
        audioClip=new SCAudioClipImpl(url,this);
        if (audioClip == null)         return null;
      }
 catch (      Throwable e) {
        return null;
      }
      audioClips.put(uri,audioClip);
    }
  }
  return audioClip;
}
Program: 104132
Project: 104132
Buggy source:
/** 
 * Creates the audio clip and initialize the listener used from the loop timer.
 * @param url the url pointing to the audio file
 */
public SCAudioClipImpl(URL url,AudioNotifierService audioNotifier){
  InputStream inputstream;
  try {
    inputstream=url.openStream();
    this.createAppletAudioClip(inputstream);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  this.audioListener=new PlayAudioListener(audioClip);
  this.playAudioTimer.addActionListener(audioListener);
  this.audioNotifier=audioNotifier;
}

Fixed version (ground truth):
/** 
 * Creates the audio clip and initialize the listener used from the loop timer.
 * @param url the url pointing to the audio file
 */
public SCAudioClipImpl(URL url,AudioNotifierService audioNotifier) throws IOException {
  InputStream inputstream;
  inputstream=url.openStream();
  this.createAppletAudioClip(inputstream);
  this.audioListener=new PlayAudioListener(audioClip);
  this.playAudioTimer.addActionListener(audioListener);
  this.audioNotifier=audioNotifier;
}
Program: 104134
Project: 104134
Buggy source:
/** 
 * Plays the sound given by the containing <tt>soundFileDescriptor</tt>. The sound is played in loop if the loopInterval is defined.
 */
public void start(){
  AudioNotifierService audioNotifService=NotificationActivator.getAudioNotifier();
  if (audioNotifService == null)   return;
  audio=audioNotifService.createAudio(soundFileDescriptor);
  if (loopInterval > -1)   audio.playInLoop(loopInterval);
 else   audio.play();
}

Fixed version (ground truth):
/** 
 * Plays the sound given by the containing <tt>soundFileDescriptor</tt>. The sound is played in loop if the loopInterval is defined.
 */
public void start(){
  AudioNotifierService audioNotifService=NotificationActivator.getAudioNotifier();
  if (audioNotifService == null)   return;
  audio=audioNotifService.createAudio(soundFileDescriptor);
  if (audio == null)   return;
  if (loopInterval > -1)   audio.playInLoop(loopInterval);
 else   audio.play();
}
Program: 104135
Project: 104135
Buggy source:
/** 
 * Called when we're connected to the IRC server.
 */
protected void onConnect(){
  RegistrationState oldState=parentProvider.getCurrentRegistrationState();
  parentProvider.setCurrentRegistrationState(RegistrationState.REGISTERED);
  parentProvider.fireRegistrationStateChanged(oldState,RegistrationState.REGISTERED,RegistrationStateChangeEvent.REASON_USER_REQUEST,null);
}

Fixed version (ground truth):
/** 
 * Called when we're connected to the IRC server.
 */
protected void onConnect(){
synchronized (this) {
    onConnectInvoked=true;
  }
}
Program: 104136
Project: 104136
Buggy source:
/** 
 * Connects to the server.
 * @param serverAddress the address of the server
 * @param serverPort the port to connect to
 * @param serverPassword the password to use for connect
 * @param autoNickChange indicates if the nick name should be changed in case there exist already a participant with the same nick name
 * @throws OperationFailedException
 */
public void connect(String serverAddress,int serverPort,String serverPassword,boolean autoNickChange) throws OperationFailedException {
  this.setVerbose(false);
  this.setAutoNickChange(autoNickChange);
  try {
    if (serverPassword == null) {
      this.connect(serverAddress,serverPort);
    }
 else     this.connect(serverAddress,serverPort,serverPassword);
  }
 catch (  IOException e) {
    throw new OperationFailedException(e.getMessage(),OperationFailedException.INTERNAL_SERVER_ERROR);
  }
catch (  NickAlreadyInUseException e) {
    throw new OperationFailedException(e.getMessage(),OperationFailedException.SUBSCRIPTION_ALREADY_EXISTS);
  }
catch (  IrcException e) {
    throw new OperationFailedException(e.getMessage(),OperationFailedException.GENERAL_ERROR);
  }
}

Fixed version (ground truth):
/** 
 * Connects to the server.
 * @param serverAddress the address of the server
 * @param serverPort the port to connect to
 * @param serverPassword the password to use for connect
 * @param autoNickChange indicates if the nick name should be changed in case there exist already a participant with the same nick name
 * @throws OperationFailedException
 */
public void connect(String serverAddress,int serverPort,String serverPassword,boolean autoNickChange) throws OperationFailedException {
  this.setVerbose(false);
  this.setAutoNickChange(autoNickChange);
  try {
synchronized (this) {
      onConnectInvoked=false;
      if (serverPassword == null) {
        this.connect(serverAddress,serverPort);
      }
 else       this.connect(serverAddress,serverPort,serverPassword);
    }
  }
 catch (  IOException e) {
    throw new OperationFailedException(e.getMessage(),OperationFailedException.INTERNAL_SERVER_ERROR);
  }
catch (  NickAlreadyInUseException e) {
    throw new OperationFailedException(e.getMessage(),OperationFailedException.SUBSCRIPTION_ALREADY_EXISTS);
  }
catch (  IrcException e) {
    throw new OperationFailedException(e.getMessage(),OperationFailedException.GENERAL_ERROR);
  }
  if (onConnectInvoked) {
    RegistrationState oldState=parentProvider.getCurrentRegistrationState();
    parentProvider.setCurrentRegistrationState(RegistrationState.REGISTERED);
    parentProvider.fireRegistrationStateChanged(oldState,RegistrationState.REGISTERED,RegistrationStateChangeEvent.REASON_USER_REQUEST,null);
  }
}
Program: 104137
Project: 104137
Buggy source:
/** 
 * Returns a set of all protocol providers.
 * @return a set of all protocol providers.
 */
public Iterator<ProtocolProviderService> getProtocolProviders(){
  return ((Map<ProtocolProviderService,Integer>)protocolProviders.clone()).keySet().iterator();
}

Fixed version (ground truth):
/** 
 * Returns a set of all protocol providers.
 * @return a set of all protocol providers.
 */
public Iterator<ProtocolProviderService> getProtocolProviders(){
  return new LinkedList<ProtocolProviderService>(protocolProviders.keySet()).iterator();
}
Program: 104139
Project: 104139
Buggy source:
public void run(){
  Iterator i=contactItem.getContacts();
  while (i.hasNext()) {
    Contact contact=(Contact)i.next();
    mainFrame.getContactList().moveContact(contact,metaContact);
  }
}

Fixed version (ground truth):
public void run(){
  Iterator<Contact> i=contactItem.getContacts();
  while (i.hasNext()) {
    Contact contact=i.next();
    mainFrame.getContactList().moveContact(contact,metaContact);
  }
}
Program: 104141
Project: 104141
Buggy source:
/** 
 * The reason we need to override this method here comes from the fact that the user id that is standardly returned by the parent method is not sufficient for the user to distinguish this account from other sip accounts with the same user name. Besides we also need to handle the case of registrar-less accounts.
 * @return A String that can be showed to users when referring to thisaccount.
 */
public String getDisplayName(){
  String returnValue=getUserID();
  String protocolName=getAccountPropertyString(ProtocolProviderFactory.PROTOCOL);
  String service=getService();
  if (service == null || service.trim().length() == 0) {
    protocolName="String_Node_Str" + protocolName;
  }
 else {
    returnValue+="String_Node_Str" + service;
  }
  if (protocolName != null && protocolName.trim().length() > 0)   returnValue+="String_Node_Str" + protocolName + "String_Node_Str";
  return returnValue;
}

Fixed version (ground truth):
/** 
 * The reason we need to override this method here comes from the fact that the user id that is standardly returned by the parent method is not sufficient for the user to distinguish this account from other sip accounts with the same user name. Besides we also need to handle the case of registrar-less accounts.
 * @return A String that can be showed to users when referring to thisaccount.
 */
public String getDisplayName(){
  String returnValue=super.getAccountPropertyString(ProtocolProviderFactory.USER_ID);
  String protocolName=getAccountPropertyString(ProtocolProviderFactory.PROTOCOL);
  String service=getService();
  if (service == null || service.trim().length() == 0) {
    protocolName="String_Node_Str" + protocolName;
  }
  if (protocolName != null && protocolName.trim().length() > 0)   returnValue+="String_Node_Str" + protocolName + "String_Node_Str";
  return returnValue;
}
Program: 104142
Project: 104142
Buggy source:
/** 
 * Creates a SIP account id from the specified ide and account properties.
 * @param userID the user id part of the SIP uri identifying this contact.
 * @param accountProperties any other properties necessary for the account.
 * @param serverName the name of the server that the user belongs to.
 */
protected SipAccountID(String userID,Map accountProperties,String serverName){
  super(getUserIDWithoutServerName(userID),accountProperties,(String)accountProperties.get(ProtocolProviderFactory.PROTOCOL),serverName);
}

Fixed version (ground truth):
/** 
 * Creates a SIP account id from the specified ide and account properties.
 * @param userID the user id part of the SIP uri identifying this contact.
 * @param accountProperties any other properties necessary for the account.
 * @param serverName the name of the server that the user belongs to.
 */
protected SipAccountID(String userID,Map accountProperties,String serverName){
  super(stripServerNameFromUserID(userID),accountProperties,(String)accountProperties.get(ProtocolProviderFactory.PROTOCOL),serverName);
}
Program: 104143
Project: 104143
Buggy source:
/** 
 * Sends the <tt>message</tt> to the destination indicated by the <tt>to</tt> contact.
 * @param to the <tt>Contact</tt> to send <tt>message</tt> to
 * @param message the <tt>Message</tt> to send.
 * @throws IllegalStateException if the underlying ICQ stack is notregistered and initialized.
 * @throws IllegalArgumentException if <tt>to</tt> is not an instancebelonging to the underlying implementation.
 */
public void sendInstantMessage(Contact to,Message message) throws IllegalStateException, IllegalArgumentException {
  if (!(to instanceof ContactDictImpl)) {
    throw new IllegalArgumentException("String_Node_Str" + to);
  }
  fireMessageDelivered(message,to);
  this.submitDictQuery((ContactDictImpl)to,message);
}

Fixed version (ground truth):
/** 
 * Sends the <tt>message</tt> to the destination indicated by the <tt>to</tt> contact.
 * @param to the <tt>Contact</tt> to send <tt>message</tt> to
 * @param message the <tt>Message</tt> to send.
 * @throws IllegalStateException if the underlying ICQ stack is notregistered and initialized.
 * @throws IllegalArgumentException if <tt>to</tt> is not an instancebelonging to the underlying implementation.
 */
public void sendInstantMessage(Contact to,Message message) throws IllegalStateException, IllegalArgumentException {
  if (!(to instanceof ContactDictImpl)) {
    throw new IllegalArgumentException("String_Node_Str" + to);
  }
  message=createMessage(Html2Text.extractText(message.getContent()));
  fireMessageDelivered(message,to);
  this.submitDictQuery((ContactDictImpl)to,message);
}
Program: 104144
Project: 104144
Buggy source:
/** 
 * Handles transfers to the chat panel write area from the clip board or a DND drop operation. The <tt>Transferable</tt> parameter contains the data that needs to be imported. <p>
 * @param comp  the component to receive the transfer;
 * @param transferable     the data to import
 * @return  true if the data was inserted into the component and falseotherwise
 * @see #importData(TransferHandler.TransferSupport)
 */
public boolean importData(JComponent comp,Transferable transferable){
  if (comp instanceof JTextComponent) {
    DataFlavor flavor=getFlavor(transferable.getTransferDataFlavors());
    if (flavor != null) {
      InputContext inputContext=comp.getInputContext();
      if (inputContext != null) {
        inputContext.endComposition();
      }
      try {
        BufferedReader reader=new BufferedReader(flavor.getReaderForText(transferable));
        StringBuffer buffToPaste=new StringBuffer();
        String line=null;
        while ((line=reader.readLine()) != null) {
          buffToPaste.append(line).append("String_Node_Str");
        }
        ((JTextComponent)comp).replaceSelection(buffToPaste.toString());
        return true;
      }
 catch (      UnsupportedFlavorException ufe) {
      }
catch (      IOException ioe) {
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Handles transfers to the chat panel write area from the clip board or a DND drop operation. The <tt>Transferable</tt> parameter contains the data that needs to be imported. <p>
 * @param comp  the component to receive the transfer;
 * @param transferable     the data to import
 * @return  true if the data was inserted into the component and falseotherwise
 * @see #importData(TransferHandler.TransferSupport)
 */
public boolean importData(JComponent comp,Transferable transferable){
  if (comp instanceof JTextComponent) {
    DataFlavor flavor=getFlavor(transferable.getTransferDataFlavors());
    if (flavor != null) {
      InputContext inputContext=comp.getInputContext();
      if (inputContext != null) {
        inputContext.endComposition();
      }
      try {
        BufferedReader reader=new BufferedReader(flavor.getReaderForText(transferable));
        StringBuffer buffToPaste=new StringBuffer();
        String line=reader.readLine();
        while (line != null) {
          buffToPaste.append(line);
          line=reader.readLine();
          if (line != null)           buffToPaste.append("String_Node_Str");
        }
        ((JTextComponent)comp).replaceSelection(buffToPaste.toString());
        return true;
      }
 catch (      UnsupportedFlavorException ufe) {
      }
catch (      IOException ioe) {
      }
    }
  }
  return false;
}
Program: 104145
Project: 104145
Buggy source:
protected Iterator getFileList(){
  return this.historyDocuments.keySet().iterator();
}

Fixed version (ground truth):
protected Iterator<String> getFileList(){
  return this.historyDocuments.keySet().iterator();
}
Program: 104146
Project: 104146
Buggy source:
public int compare(Object o1,Object o2){
  if (o1 instanceof HistoryRecord && o2 instanceof HistoryRecord) {
    return ((HistoryRecord)o1).getTimestamp().compareTo(((HistoryRecord)o2).getTimestamp());
  }
 else   return 0;
}

Fixed version (ground truth):
public int compare(HistoryRecord h1,HistoryRecord h2){
  return h1.getTimestamp().compareTo(h2.getTimestamp());
}
Program: 104147
Project: 104147
Buggy source:
/** 
 * If there is keyword restriction and doesn't match the conditions return null. Otherwise return the HistoryRecord corresponding the given nodes.
 * @param propertyNodes NodeList
 * @param timestamp Date
 * @param keywords String[]
 * @param field String
 * @param caseSensitive boolean
 * @return HistoryRecord
 */
private HistoryRecord filterByKeyword(NodeList propertyNodes,Date timestamp,String[] keywords,String field,boolean caseSensitive){
  ArrayList nameVals=new ArrayList();
  int len=propertyNodes.getLength();
  for (int j=0; j < len; j++) {
    Node propertyNode=propertyNodes.item(j);
    if (propertyNode.getNodeType() == Node.ELEMENT_NODE) {
      String nodeName=propertyNode.getNodeName();
      Node nestedNode=propertyNode.getFirstChild();
      if (nestedNode == null)       continue;
      String nodeValue=nestedNode.getNodeValue();
      if (field != null && field.equals(nodeName) && !matchKeyword(nodeValue,keywords,caseSensitive)) {
        return null;
      }
      nameVals.add(nodeName);
      nameVals.add(propertyNode.getFirstChild().getNodeValue());
    }
  }
  String[] propertyNames=new String[nameVals.size() / 2];
  String[] propertyValues=new String[propertyNames.length];
  for (int j=0; j < propertyNames.length; j++) {
    propertyNames[j]=(String)nameVals.get(j * 2);
    propertyValues[j]=(String)nameVals.get(j * 2 + 1);
  }
  return new HistoryRecord(propertyNames,propertyValues,timestamp);
}

Fixed version (ground truth):
/** 
 * If there is keyword restriction and doesn't match the conditions return null. Otherwise return the HistoryRecord corresponding the given nodes.
 * @param propertyNodes NodeList
 * @param timestamp Date
 * @param keywords String[]
 * @param field String
 * @param caseSensitive boolean
 * @return HistoryRecord
 */
private HistoryRecord filterByKeyword(NodeList propertyNodes,Date timestamp,String[] keywords,String field,boolean caseSensitive){
  ArrayList<String> nameVals=new ArrayList<String>();
  int len=propertyNodes.getLength();
  for (int j=0; j < len; j++) {
    Node propertyNode=propertyNodes.item(j);
    if (propertyNode.getNodeType() == Node.ELEMENT_NODE) {
      String nodeName=propertyNode.getNodeName();
      Node nestedNode=propertyNode.getFirstChild();
      if (nestedNode == null)       continue;
      String nodeValue=nestedNode.getNodeValue();
      if (field != null && field.equals(nodeName) && !matchKeyword(nodeValue,keywords,caseSensitive)) {
        return null;
      }
      nameVals.add(nodeName);
      nameVals.add(propertyNode.getFirstChild().getNodeValue());
    }
  }
  String[] propertyNames=new String[nameVals.size() / 2];
  String[] propertyValues=new String[propertyNames.length];
  for (int j=0; j < propertyNames.length; j++) {
    propertyNames[j]=(String)nameVals.get(j * 2);
    propertyValues[j]=(String)nameVals.get(j * 2 + 1);
  }
  return new HistoryRecord(propertyNames,propertyValues,timestamp);
}
Program: 104150
Project: 104150
Buggy source:
/** 
 * Count the number of messages that a search will return Actually only the last file is parsed and its nodes are counted. We accept that the other files are full with max records,  this way we escape parsing all files which will significantly  slow the process and for one search will parse the files twice.
 * @return the number of searched messages
 * @throws UnsupportedOperationException Thrown if an exception occurs during the execution of the query, such as internal IO error.
 */
public int countRecords() throws UnsupportedOperationException {
  int result=0;
  String lastFile=null;
  Iterator filelistIter=this.historyImpl.getFileList();
  while (filelistIter.hasNext()) {
    lastFile=(String)filelistIter.next();
    result+=HistoryWriterImpl.MAX_RECORDS_PER_FILE;
  }
  if (lastFile == null)   return result;
  Document doc=this.historyImpl.getDocumentForFile(lastFile);
  if (doc == null)   return result;
  NodeList nodes=doc.getElementsByTagName("String_Node_Str");
  result+=nodes.getLength();
  return result;
}

Fixed version (ground truth):
/** 
 * Count the number of messages that a search will return Actually only the last file is parsed and its nodes are counted. We accept that the other files are full with max records, this way we escape parsing all files which will significantly slow the process and for one search will parse the files twice.
 * @return the number of searched messages
 * @throws UnsupportedOperationException Thrown if an exception occurs during the execution of the query, such as internal IO error.
 */
public int countRecords() throws UnsupportedOperationException {
  int result=0;
  String lastFile=null;
  Iterator<String> filelistIter=this.historyImpl.getFileList();
  while (filelistIter.hasNext()) {
    lastFile=(String)filelistIter.next();
    result+=HistoryWriterImpl.MAX_RECORDS_PER_FILE;
  }
  if (lastFile == null)   return result;
  Document doc=this.historyImpl.getDocumentForFile(lastFile);
  if (doc == null)   return result;
  NodeList nodes=doc.getElementsByTagName("String_Node_Str");
  result+=nodes.getLength();
  return result;
}
Program: 104151
Project: 104151
Buggy source:
private void fireProgressStateChanged(Date startDate,Date endDate,String[] keywords,int progress){
  ProgressEvent event=new ProgressEvent(this,startDate,endDate,keywords,progress);
synchronized (progressListeners) {
    Iterator iter=progressListeners.iterator();
    while (iter.hasNext()) {
      HistorySearchProgressListener item=(HistorySearchProgressListener)iter.next();
      item.progressChanged(event);
    }
  }
}

Fixed version (ground truth):
private void fireProgressStateChanged(Date startDate,Date endDate,String[] keywords,int progress){
  ProgressEvent event=new ProgressEvent(this,startDate,endDate,keywords,progress);
synchronized (progressListeners) {
    Iterator<HistorySearchProgressListener> iter=progressListeners.iterator();
    while (iter.hasNext()) {
      HistorySearchProgressListener item=(HistorySearchProgressListener)iter.next();
      item.progressChanged(event);
    }
  }
}
Program: 104155
Project: 104155
Buggy source:
/** 
 * Initializes this chat room dialog.
 */
private void init(){
  ChatRoomListUI chatRoomsListUI=new ChatRoomListUI(this);
  JButton createChatRoomButton=new JButton(GuiActivator.getResources().getI18NString(CREATE_CHAT_ROOM));
  JButton joinChatRoomButton=new JButton(GuiActivator.getResources().getI18NString(JOIN_CHAT_ROOM));
  JButton cancelButton=new JButton(GuiActivator.getResources().getI18NString(CLOSE_CHAT_ROOM_DIALOG));
  TransparentPanel buttonPanel=new TransparentPanel();
  this.setTitle(GuiActivator.getResources().getI18NString(MY_CHAT_ROOMS));
  this.getContentPane().add(buttonPanel,BorderLayout.SOUTH);
  this.getContentPane().add(chatRoomsListUI,BorderLayout.CENTER);
  buttonPanel.add(joinChatRoomButton);
  buttonPanel.add(createChatRoomButton);
  buttonPanel.add(cancelButton);
  createChatRoomButton.addActionListener(this);
  joinChatRoomButton.addActionListener(this);
  cancelButton.addActionListener(this);
  createChatRoomButton.setName(CREATE_CHAT_ROOM);
  joinChatRoomButton.setName(JOIN_CHAT_ROOM);
  cancelButton.setName(CLOSE_CHAT_ROOM_DIALOG);
  createChatRoomButton.setMnemonic(GuiActivator.getResources().getI18nMnemonic(CREATE_CHAT_ROOM));
  joinChatRoomButton.setMnemonic(GuiActivator.getResources().getI18nMnemonic(JOIN_CHAT_ROOM));
  cancelButton.setMnemonic(GuiActivator.getResources().getI18nMnemonic(CLOSE_CHAT_ROOM_DIALOG));
}

Fixed version (ground truth):
/** 
 * Initializes this chat room dialog.
 */
private void init(){
  ChatRoomListUI chatRoomsListUI=new ChatRoomListUI(this);
  JButton createChatRoomButton=new JButton(GuiActivator.getResources().getI18NString(CREATE_CHAT_ROOM));
  JButton joinChatRoomButton=new JButton(GuiActivator.getResources().getI18NString(JOIN_CHAT_ROOM));
  TransparentPanel buttonPanel=new TransparentPanel();
  this.setTitle(GuiActivator.getResources().getI18NString(MY_CHAT_ROOMS));
  this.getContentPane().add(buttonPanel,BorderLayout.SOUTH);
  this.getContentPane().add(chatRoomsListUI,BorderLayout.CENTER);
  buttonPanel.add(joinChatRoomButton);
  buttonPanel.add(createChatRoomButton);
  createChatRoomButton.addActionListener(this);
  joinChatRoomButton.addActionListener(this);
  createChatRoomButton.setName(CREATE_CHAT_ROOM);
  joinChatRoomButton.setName(JOIN_CHAT_ROOM);
  createChatRoomButton.setMnemonic(GuiActivator.getResources().getI18nMnemonic(CREATE_CHAT_ROOM));
  joinChatRoomButton.setMnemonic(GuiActivator.getResources().getI18nMnemonic(JOIN_CHAT_ROOM));
}
Program: 104156
Project: 104156
Buggy source:
/** 
 * Handles <tt>ActionEvent</tt>s triggered by a button click.
 */
public void actionPerformed(ActionEvent e){
  JButton sourceButton=(JButton)e.getSource();
  String buttonName=sourceButton.getName();
  if (buttonName.equals(CREATE_CHAT_ROOM)) {
    CreateChatRoomWizard createChatRoomWizard=new CreateChatRoomWizard(mainFrame);
    createChatRoomWizard.showDialog(false);
  }
 else   if (buttonName.equals(JOIN_CHAT_ROOM)) {
    JoinChatRoomWizard joinChatRoomWizard=new JoinChatRoomWizard(mainFrame);
    joinChatRoomWizard.showDialog(false);
  }
 else   if (buttonName.equals(CLOSE_CHAT_ROOM_DIALOG)) {
    this.dispose();
  }
}

Fixed version (ground truth):
/** 
 * Handles <tt>ActionEvent</tt>s triggered by a button click.
 */
public void actionPerformed(ActionEvent e){
  JButton sourceButton=(JButton)e.getSource();
  String buttonName=sourceButton.getName();
  if (buttonName.equals(CREATE_CHAT_ROOM)) {
    CreateChatRoomWizard createChatRoomWizard=new CreateChatRoomWizard(mainFrame);
    createChatRoomWizard.showDialog(false);
  }
 else   if (buttonName.equals(JOIN_CHAT_ROOM)) {
    JoinChatRoomWizard joinChatRoomWizard=new JoinChatRoomWizard(mainFrame);
    joinChatRoomWizard.showDialog(false);
  }
}