nus-yam/ex-repair huggingface dataset:
Program: 104470
Project: 104470
Buggy source:
/** 
 * Sets window size and position.
 */
public void setSizeAndLocation(){
  ConfigurationService configService=GuiActivator.getConfigurationService();
  String className=this.getClass().getName();
  String widthString=configService.getString(className + "String_Node_Str");
  String heightString=configService.getString(className + "String_Node_Str");
  String xString=configService.getString(className + "String_Node_Str");
  String yString=configService.getString(className + "String_Node_Str");
  int width=0;
  int height=0;
  if (widthString != null && heightString != null) {
    width=new Integer(width).intValue();
    height=new Integer(height).intValue();
    if (width > 0 && height > 0)     this.setSize(width,height);
  }
  if (xString != null && yString != null) {
    this.setLocation(new Integer(xString).intValue(),new Integer(yString).intValue());
  }
 else {
    this.setCenterLocation();
  }
}

Fixed version (ground truth):
/** 
 * Sets window size and position.
 */
public void setSizeAndLocation(){
  ConfigurationService configService=GuiActivator.getConfigurationService();
  String className=this.getClass().getName();
  String widthString=configService.getString(className + "String_Node_Str");
  String heightString=configService.getString(className + "String_Node_Str");
  String xString=configService.getString(className + "String_Node_Str");
  String yString=configService.getString(className + "String_Node_Str");
  int width=0;
  int height=0;
  if (widthString != null && heightString != null) {
    width=new Integer(widthString).intValue();
    height=new Integer(heightString).intValue();
    if (width > 0 && height > 0)     this.setSize(width,height);
  }
  if (xString != null && yString != null) {
    this.setLocation(new Integer(xString).intValue(),new Integer(yString).intValue());
  }
 else {
    this.setCenterLocation();
  }
}
Program: 104471
Project: 104471
Buggy source:
/** 
 * Loads an image from a given image path.
 * @param imagePath The identifier of the image.
 * @return The image for the given identifier.
 */
public static byte[] loadIcon(String imagePath){
  InputStream is=JabberStatusEnum.class.getClassLoader().getResourceAsStream(imagePath);
  byte[] icon=null;
  try {
    icon=new byte[is.available()];
    is.read(icon);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + imagePath,e);
  }
  return icon;
}

Fixed version (ground truth):
/** 
 * Loads an image from a given image path.
 * @param imagePath The identifier of the image.
 * @return The image for the given identifier.
 */
public static byte[] loadIcon(String imagePath){
  InputStream is=IcqStatusEnum.class.getClassLoader().getResourceAsStream(imagePath);
  byte[] icon=null;
  try {
    icon=new byte[is.available()];
    is.read(icon);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + imagePath,e);
  }
  return icon;
}
Program: 104474
Project: 104474
Buggy source:
/** 
 * This method parses an XML file, and returns a History object created with the information from it. The parsing is non-validating, so if a malformed XML is passed the results are undefined. The file should be with the following structure: <dbstruct version="1.0"> <id value="idcomponent1"> <id value="idcomponent2"> <id value="idcomponent3"/> </id> </id> <structure> <property name="propertyName" type="textType" /> <property name="propertyName" type="textType" /> <property name="propertyName" type="textType" /> </structure> </dbstruct>
 * @param dbDatFile The file to be parsed.
 * @return A History object corresponding to this dbstruct file.
 * @throws SAXException Thrown if an error occurs during XML parsing.
 * @throws IOException Thrown if an IO error occurs.
 * @throws ParseException Thrown if there is error in the XML data format.
 */
public History loadHistory(File dbDatFile) throws SAXException, IOException, ParseException {
  DocumentBuilder builder=historyService.getDocumentBuilder();
  Document doc=builder.parse(dbDatFile);
  Node root=doc.getFirstChild();
  HistoryID id=loadID(root);
  HistoryRecordStructure structure=loadStructure(root);
  return new HistoryImpl(id,dbDatFile.getParentFile(),structure,historyService);
}

Fixed version (ground truth):
/** 
 * This method parses an XML file, and returns a History object created with the information from it. The parsing is non-validating, so if a malformed XML is passed the results are undefined. The file should be with the following structure: <dbstruct version="1.0"> <id value="idcomponent1"> <id value="idcomponent2"> <id value="idcomponent3"/> </id> </id> <structure> <property name="propertyName" type="textType" /> <property name="propertyName" type="textType" /> <property name="propertyName" type="textType" /> </structure> </dbstruct>
 * @param dbDatFile The file to be parsed.
 * @return A History object corresponding to this dbstruct file.
 * @throws SAXException Thrown if an error occurs during XML parsing.
 * @throws IOException Thrown if an IO error occurs.
 * @throws ParseException Thrown if there is error in the XML data format.
 */
public History loadHistory(File dbDatFile) throws SAXException, IOException, ParseException {
  Document doc=historyService.parse(dbDatFile);
  Node root=doc.getFirstChild();
  HistoryID id=loadID(root);
  HistoryRecordStructure structure=loadStructure(root);
  return new HistoryImpl(id,dbDatFile.getParentFile(),structure,historyService);
}
Program: 104475
Project: 104475
Buggy source:
/** 
 * Checks whether the given xml is valid
 * @param str String
 * @return boolean
 */
private boolean isValidXML(String str){
  try {
    this.historyServiceImpl.getDocumentBuilder().parse(new ByteArrayInputStream(str.getBytes("String_Node_Str")));
  }
 catch (  Exception ex) {
    log.error("String_Node_Str" + str + "String_Node_Str"+ ex.getMessage());
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Checks whether the given xml is valid
 * @param str String
 * @return boolean
 */
private boolean isValidXML(String str){
  try {
    this.historyServiceImpl.parse(new ByteArrayInputStream(str.getBytes("String_Node_Str")));
  }
 catch (  Exception ex) {
    log.error("String_Node_Str" + str + "String_Node_Str"+ ex.getMessage());
    return false;
  }
  return true;
}
Program: 104476
Project: 104476
Buggy source:
/** 
 * Returns the fixed document as xml Document if file cannot be fixed return null
 * @param file File the file trying to fix
 * @return Document the fixed doc
 * @throws Exception
 */
public Document getFixedDocument(File file){
  log.info("String_Node_Str" + file);
  StringBuffer resultDocStr=new StringBuffer("String_Node_Str");
  try {
    BufferedReader inReader=new BufferedReader(new FileReader(file));
    String line=null;
    while ((line=inReader.readLine()) != null) {
      if (line.indexOf("String_Node_Str") == -1) {
        continue;
      }
      String record=getRecordNodeString(line,inReader).toString();
      if (record != null && isValidXML(record)) {
        resultDocStr.append(record);
      }
    }
  }
 catch (  Exception ex1) {
    log.error("String_Node_Str" + ex1.getLocalizedMessage());
  }
  resultDocStr.append("String_Node_Str");
  try {
    Document result=this.historyServiceImpl.getDocumentBuilder().parse(new ByteArrayInputStream(resultDocStr.toString().getBytes("String_Node_Str")));
    log.trace("String_Node_Str");
    XMLUtils.writeXML(result,file);
    return result;
  }
 catch (  Exception ex) {
    System.out.println("String_Node_Str" + ex.getMessage());
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Returns the fixed document as xml Document if file cannot be fixed return null
 * @param file File the file trying to fix
 * @return Document the fixed doc
 * @throws Exception
 */
public Document getFixedDocument(File file){
  log.info("String_Node_Str" + file);
  StringBuffer resultDocStr=new StringBuffer("String_Node_Str");
  try {
    BufferedReader inReader=new BufferedReader(new FileReader(file));
    String line=null;
    while ((line=inReader.readLine()) != null) {
      if (line.indexOf("String_Node_Str") == -1) {
        continue;
      }
      String record=getRecordNodeString(line,inReader).toString();
      if (record != null && isValidXML(record)) {
        resultDocStr.append(record);
      }
    }
  }
 catch (  Exception ex1) {
    log.error("String_Node_Str" + ex1.getLocalizedMessage());
  }
  resultDocStr.append("String_Node_Str");
  try {
    Document result=this.historyServiceImpl.parse(new ByteArrayInputStream(resultDocStr.toString().getBytes("String_Node_Str")));
    log.trace("String_Node_Str");
    XMLUtils.writeXML(result,file);
    return result;
  }
 catch (  Exception ex) {
    System.out.println("String_Node_Str" + ex.getMessage());
    return null;
  }
}
Program: 104477
Project: 104477
Buggy source:
protected Document getDocumentForFile(String filename) throws InvalidParameterException, RuntimeException {
  Document retVal=null;
synchronized (this.historyDocuments) {
    if (!this.historyDocuments.containsKey(filename)) {
      throw new InvalidParameterException("String_Node_Str" + "String_Node_Str");
    }
    Object obj=this.historyDocuments.get(filename);
    if (obj instanceof Document) {
      retVal=(Document)obj;
    }
 else     if (obj instanceof File) {
      File file=(File)obj;
      DocumentBuilder builder=this.historyServiceImpl.getDocumentBuilder();
      try {
        retVal=builder.parse(file);
      }
 catch (      Exception e) {
        log.error("String_Node_Str");
        retVal=getFixedDocument(file);
        if (retVal == null)         return null;
      }
      if (historyServiceImpl.isCacheEnabled())       this.historyDocuments.put(filename,retVal);
    }
 else {
    }
  }
  return retVal;
}

Fixed version (ground truth):
protected Document getDocumentForFile(String filename) throws InvalidParameterException, RuntimeException {
  Document retVal=null;
synchronized (this.historyDocuments) {
    if (!this.historyDocuments.containsKey(filename)) {
      throw new InvalidParameterException("String_Node_Str" + "String_Node_Str");
    }
    Object obj=this.historyDocuments.get(filename);
    if (obj instanceof Document) {
      retVal=(Document)obj;
    }
 else     if (obj instanceof File) {
      File file=(File)obj;
      try {
        retVal=this.historyServiceImpl.parse(file);
      }
 catch (      Exception e) {
        log.error("String_Node_Str");
        retVal=getFixedDocument(file);
        if (retVal == null)         return null;
      }
      if (historyServiceImpl.isCacheEnabled())       this.historyDocuments.put(filename,retVal);
    }
 else {
    }
  }
  return retVal;
}
Program: 104478
Project: 104478
Buggy source:
/** 
 * Writes the symbol corresponding to a choosen smiley icon to the write message area at the end of the current text.
 */
public void actionPerformed(ActionEvent e){
  JButton imageButton=(JButton)e.getSource();
  String buttonText=imageButton.getToolTipText();
  for (int i=0; i < this.imageList.size(); i++) {
    Smiley smiley=(Smiley)this.imageList.get(i);
    if (buttonText.equals(smiley.getSmileyStrings()[0])) {
      ChatPanel chatPanel=this.chatWindow.getCurrentChatPanel();
      chatPanel.addTextInWriteArea(smiley.getSmileyStrings()[0] + "String_Node_Str");
      chatPanel.requestFocusInWriteArea();
    }
  }
}

Fixed version (ground truth):
/** 
 * Writes the symbol corresponding to a choosen smiley icon to the write message area at the end of the current text.
 */
public void actionPerformed(ActionEvent e){
  JMenuItem smileyItem=(JMenuItem)e.getSource();
  String buttonText=smileyItem.getToolTipText();
  for (int i=0; i < this.imageList.size(); i++) {
    Smiley smiley=(Smiley)this.imageList.get(i);
    if (buttonText.equals(smiley.getSmileyStrings()[0])) {
      ChatPanel chatPanel=this.chatWindow.getCurrentChatPanel();
      chatPanel.addTextInWriteArea(smiley.getSmileyStrings()[0] + "String_Node_Str");
      chatPanel.requestFocusInWriteArea();
    }
  }
}
Program: 104479
Project: 104479
Buggy source:
/** 
 * Creates an instance of this <tt>SmiliesSelectorBox</tt> and initializes the panel with the smiley icons given by the incoming imageList.
 * @param imageList The pack of smiley icons.
 */
public SmiliesSelectorBox(ArrayList imageList,ChatWindow chatWindow){
  this.imageList=imageList;
  this.chatWindow=chatWindow;
  this.selectorBox.setUI(new SIPCommChatSelectorMenuUI());
  this.selectorBox.setPreferredSize(new Dimension(24,24));
  this.selectorBox.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
  this.selectorBox.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.SMILIES_ICON)));
  this.calculateGridDimensions(imageList.size());
  this.selectorBox.getPopupMenu().setLayout(new GridLayout(this.gridRowCount,this.gridColCount,5,5));
  for (int i=0; i < imageList.size(); i++) {
    Smiley smiley=(Smiley)this.imageList.get(i);
    ChatToolbarButton imageButton=new ChatToolbarButton(ImageLoader.getImage(smiley.getImageID()));
    imageButton.setToolTipText(smiley.getSmileyStrings()[0]);
    imageButton.addActionListener(this);
    this.selectorBox.add(imageButton);
  }
  this.add(selectorBox);
}

Fixed version (ground truth):
/** 
 * Creates an instance of this <tt>SmiliesSelectorBox</tt> and initializes the panel with the smiley icons given by the incoming imageList.
 * @param imageList The pack of smiley icons.
 */
public SmiliesSelectorBox(ArrayList imageList,ChatWindow chatWindow){
  this.imageList=imageList;
  this.chatWindow=chatWindow;
  this.selectorBox.setUI(new SIPCommChatSelectorMenuUI());
  this.selectorBox.setPreferredSize(new Dimension(24,24));
  this.selectorBox.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
  this.selectorBox.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.SMILIES_ICON)));
  this.calculateGridDimensions(imageList.size());
  this.selectorBox.getPopupMenu().setLayout(new GridLayout(this.gridRowCount,this.gridColCount,5,5));
  for (int i=0; i < imageList.size(); i++) {
    Smiley smiley=(Smiley)this.imageList.get(i);
    JMenuItem smileyItem=new JMenuItem(new ImageIcon(ImageLoader.getImage(smiley.getImageID())));
    smileyItem.setPreferredSize(new Dimension(28,28));
    smileyItem.setMargin(new Insets(2,-5,2,0));
    smileyItem.setToolTipText(smiley.getSmileyStrings()[0]);
    smileyItem.addActionListener(this);
    this.selectorBox.add(smileyItem);
  }
  this.add(selectorBox);
}
Program: 104480
Project: 104480
Buggy source:
/** 
 * The method is called by a ProtocolProvider implementation whenver a change in the registration state of the corresponding provider had occurred.
 * @param evt ProviderStatusChangeEvent the event describing the statuschange.
 */
public void registrationStateChanged(RegistrationStateChangeEvent evt){
  logger.debug("String_Node_Str" + evt.getOldState() + "String_Node_Str"+ evt.getNewState());
  if (evt.getNewState() == RegistrationState.REGISTERED) {
    logger.debug("String_Node_Str");
    icqProvider.getAimConnection().getIcbmService().addIcbmListener(joustSimIcbmListener);
    opSetPersPresence=(OperationSetPersistentPresenceIcqImpl)icqProvider.getSupportedOperationSets().get(OperationSetPersistentPresence.class.getName());
    icqProvider.getAimConnection().getIcbmService().getOscarConnection().getSnacProcessor().getCmdFactoryMgr().getDefaultFactoryList().registerAll(channelFourCmdFactory);
    retreiveOfflineMessages();
    if (keepAliveSendTask == null) {
      keepAliveSendTask=new KeepAliveSendTask();
      keepAliveTimer.scheduleAtFixedRate(keepAliveSendTask,KEEPALIVE_INTERVAL,KEEPALIVE_INTERVAL);
    }
  }
}

Fixed version (ground truth):
/** 
 * The method is called by a ProtocolProvider implementation whenver a change in the registration state of the corresponding provider had occurred.
 * @param evt ProviderStatusChangeEvent the event describing the statuschange.
 */
public void registrationStateChanged(RegistrationStateChangeEvent evt){
  logger.debug("String_Node_Str" + evt.getOldState() + "String_Node_Str"+ evt.getNewState());
  if (evt.getNewState() == RegistrationState.REGISTERED) {
    logger.debug("String_Node_Str");
    icqProvider.getAimConnection().getIcbmService().addIcbmListener(joustSimIcbmListener);
    opSetPersPresence=(OperationSetPersistentPresenceIcqImpl)icqProvider.getSupportedOperationSets().get(OperationSetPersistentPresence.class.getName());
    icqProvider.getAimConnection().getIcbmService().getOscarConnection().getSnacProcessor().getCmdFactoryMgr().getDefaultFactoryList().registerAll(channelFourCmdFactory);
    retreiveOfflineMessages();
    if (keepAliveSendTask == null) {
      keepAliveSendTask=new KeepAliveSendTask();
      keepAliveTimer=new Timer();
      keepAliveTimer.scheduleAtFixedRate(keepAliveSendTask,KEEPALIVE_INTERVAL,KEEPALIVE_INTERVAL);
    }
  }
 else   if (evt.getNewState() == RegistrationState.UNREGISTERED) {
    if (keepAliveSendTask != null) {
      keepAliveSendTask.cancel();
      keepAliveTimer.cancel();
      keepAliveSendTask=null;
      keepAliveTimer=null;
    }
  }
}
Program: 104481
Project: 104481
Buggy source:
/** 
 * Creates a RegistrationStateChange event corresponding to the specified old and new states and notifies all currently registered listeners.
 * @param oldState the state that the provider had before the changeoccurred
 * @param newState the state that the provider is currently in.
 * @param reasonCode a value corresponding to one of the REASON_XXX fieldsof the RegistrationStateChangeEvent class, indicating the reason for this state transition.
 * @param reason a String further explaining the reason code or null ifno such explanation is necessary.
 */
void fireRegistrationStateChanged(RegistrationState oldState,RegistrationState newState,int reasonCode,String reason){
  RegistrationStateChangeEvent event=new RegistrationStateChangeEvent(this,oldState,newState,reasonCode,reason);
  logger.debug("String_Node_Str" + event + "String_Node_Str"+ registrationListeners.size()+ "String_Node_Str");
  Iterator listeners=null;
synchronized (registrationListeners) {
    listeners=new ArrayList(registrationListeners).iterator();
  }
  while (listeners.hasNext()) {
    RegistrationStateChangeListener listener=(RegistrationStateChangeListener)listeners.next();
    listener.registrationStateChanged(event);
  }
  logger.trace("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Creates a RegistrationStateChange event corresponding to the specified old and new states and notifies all currently registered listeners.
 * @param oldState the state that the provider had before the changeoccurred
 * @param newState the state that the provider is currently in.
 * @param reasonCode a value corresponding to one of the REASON_XXX fieldsof the RegistrationStateChangeEvent class, indicating the reason for this state transition.
 * @param reason a String further explaining the reason code or null ifno such explanation is necessary.
 */
void fireRegistrationStateChanged(RegistrationState oldState,RegistrationState newState,int reasonCode,String reason){
  RegistrationStateChangeEvent event=new RegistrationStateChangeEvent(this,oldState,newState,reasonCode,reason);
  if (newState.equals(RegistrationState.CONNECTION_FAILED) && isRegistered()) {
    unregister();
  }
  logger.debug("String_Node_Str" + event + "String_Node_Str"+ registrationListeners.size()+ "String_Node_Str");
  Iterator listeners=null;
synchronized (registrationListeners) {
    listeners=new ArrayList(registrationListeners).iterator();
  }
  while (listeners.hasNext()) {
    RegistrationStateChangeListener listener=(RegistrationStateChangeListener)listeners.next();
    listener.registrationStateChanged(event);
  }
  logger.trace("String_Node_Str");
}
Program: 104482
Project: 104482
Buggy source:
/** 
 * Shows the dialog.
 * @return The return code that should indicate what was the choice ofthe user. If the user chooses cancel, the return code is the  CANCEL_RETURN_CODE.
 */
public void showDialog(){
  setVisible(true);
}

Fixed version (ground truth):
/** 
 * Shows the dialog.
 * @return The return code that should indicate what was the choice ofthe user. If the user chooses cancel, the return code is the  CANCEL_RETURN_CODE.
 */
public void showDialog(){
  this.pack();
  this.setVisible(true);
}
Program: 104484
Project: 104484
Buggy source:
public CallComboBox(CallManager callManager){
  this.callManager=callManager;
  this.setUI(new SIPCommCallComboBoxUI());
  this.addActionListener(this);
  JTextField textField=(JTextField)this.getEditor().getEditorComponent();
  textField.addFocusListener(this);
  textField.getDocument().addDocumentListener(this);
  textField.getActionMap().put("String_Node_Str",new CreateCallAction());
  textField.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0),"String_Node_Str");
}

Fixed version (ground truth):
public CallComboBox(CallManager callManager){
  this.callManager=callManager;
  this.setUI(new SIPCommCallComboBoxUI());
  this.addActionListener(this);
  JTextField textField=(JTextField)this.getEditor().getEditorComponent();
  textField.getDocument().addDocumentListener(this);
  textField.getActionMap().put("String_Node_Str",new CreateCallAction());
  textField.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0),"String_Node_Str");
}
Program: 104485
Project: 104485
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);
    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();
    if (o == null || !(o instanceof MetaContact))     callManager.getCallButton().setEnabled(false);
  }
}
Program: 104486
Project: 104486
Buggy source:
/** 
 * Sets the showOffline variable to indicate whether or not  offline contacts should be shown.
 * @param showOffline true if offline contacts should be shown, false otherwise.
 */
public void setShowOffline(boolean showOffline){
  this.showOffline=showOffline;
  this.contentChanged(0,getSize() - 1);
}

Fixed version (ground truth):
/** 
 * Sets the showOffline variable to indicate whether or not  offline contacts should be shown.
 * @param showOffline true if offline contacts should be shown, false otherwise.
 */
public void setShowOffline(boolean showOffline){
  int size=getSize();
  this.showOffline=showOffline;
  this.contentChanged(0,size - 1);
}
Program: 104487
Project: 104487
Buggy source:
public void run(){
  getChatWindow().setTitle(getMetaContact().getDisplayName());
  chatWindow.setCurrentChatPanel(ChatPanel.this);
  chatWindow.getMainToolBar().changeHistoryButtonsSate(ChatPanel.this);
  writeMessagePanel.getEditorPane().requestFocus();
}

Fixed version (ground truth):
public void run(){
  chatWindow.setCurrentChatPanel(ChatPanel.this);
  writeMessagePanel.getEditorPane().requestFocus();
}
Program: 104488
Project: 104488
Buggy source:
/** 
 * Loads history period dates for the current chat.
 */
private void loadHistoryPeriod(){
  MessageHistoryService msgHistory=GuiActivator.getMsgHistoryService();
  Collection firstMessage=msgHistory.findFirstMessagesAfter(metaContact,new Date(0),1);
  if (firstMessage.size() > 0) {
    Iterator i=firstMessage.iterator();
    Object o=i.next();
    if (o instanceof MessageDeliveredEvent) {
      MessageDeliveredEvent evt=(MessageDeliveredEvent)o;
      this.firstHistoryMsgTimestamp=evt.getTimestamp();
    }
 else     if (o instanceof MessageReceivedEvent) {
      MessageReceivedEvent evt=(MessageReceivedEvent)o;
      this.firstHistoryMsgTimestamp=evt.getTimestamp();
    }
    Collection lastMessage=msgHistory.findLastMessagesBefore(metaContact,new Date(Long.MAX_VALUE),1);
    Iterator i1=lastMessage.iterator();
    Object o1=i1.next();
    if (o1 instanceof MessageDeliveredEvent) {
      MessageDeliveredEvent evt=(MessageDeliveredEvent)o1;
      this.lastHistoryMsgTimestamp=evt.getTimestamp();
    }
 else     if (o1 instanceof MessageReceivedEvent) {
      MessageReceivedEvent evt=(MessageReceivedEvent)o1;
      this.lastHistoryMsgTimestamp=evt.getTimestamp();
    }
  }
}

Fixed version (ground truth):
/** 
 * Loads history period dates for the current chat.
 */
private void loadHistoryPeriod(){
  MessageHistoryService msgHistory=GuiActivator.getMsgHistoryService();
  Collection firstMessage=msgHistory.findFirstMessagesAfter(metaContact,new Date(0),1);
  if (firstMessage.size() > 0) {
    Iterator i=firstMessage.iterator();
    Object o=i.next();
    if (o instanceof MessageDeliveredEvent) {
      MessageDeliveredEvent evt=(MessageDeliveredEvent)o;
      this.firstHistoryMsgTimestamp=evt.getTimestamp();
    }
 else     if (o instanceof MessageReceivedEvent) {
      MessageReceivedEvent evt=(MessageReceivedEvent)o;
      this.firstHistoryMsgTimestamp=evt.getTimestamp();
    }
    Collection lastMessage=msgHistory.findLastMessagesBefore(metaContact,new Date(Long.MAX_VALUE),1);
    Iterator i1=lastMessage.iterator();
    Object o1=i1.next();
    if (o1 instanceof MessageDeliveredEvent) {
      MessageDeliveredEvent evt=(MessageDeliveredEvent)o1;
      this.lastHistoryMsgTimestamp=evt.getTimestamp();
    }
 else     if (o1 instanceof MessageReceivedEvent) {
      MessageReceivedEvent evt=(MessageReceivedEvent)o1;
      this.lastHistoryMsgTimestamp=evt.getTimestamp();
    }
  }
  this.chatWindow.getMainToolBar().changeHistoryButtonsState(this);
}
Program: 104489
Project: 104489
Buggy source:
public void componentShown(ComponentEvent e){
  Component component=e.getComponent();
  Container parent=component.getParent();
  if (parent instanceof JTabbedPane) {
    JTabbedPane tabbedPane=(JTabbedPane)parent;
    if (tabbedPane.getSelectedComponent() == component) {
      SwingUtilities.invokeLater(new Runnable(){
        public void run(){
          getChatWindow().setTitle(getMetaContact().getDisplayName());
          chatWindow.setCurrentChatPanel(ChatPanel.this);
          chatWindow.getMainToolBar().changeHistoryButtonsSate(ChatPanel.this);
          writeMessagePanel.getEditorPane().requestFocus();
        }
      }
);
    }
  }
}

Fixed version (ground truth):
public void componentShown(ComponentEvent e){
  Component component=e.getComponent();
  Container parent=component.getParent();
  if (parent instanceof JTabbedPane) {
    JTabbedPane tabbedPane=(JTabbedPane)parent;
    if (tabbedPane.getSelectedComponent() == component) {
      SwingUtilities.invokeLater(new Runnable(){
        public void run(){
          chatWindow.setCurrentChatPanel(ChatPanel.this);
          writeMessagePanel.getEditorPane().requestFocus();
        }
      }
);
    }
  }
}
Program: 104490
Project: 104490
Buggy source:
/** 
 * Sets the currently selected chat panel.
 * @param currentChatPanel The chat panel which is currently selected.
 */
public void setCurrentChatPanel(ChatPanel currentChatPanel){
  this.currentChatPanel=currentChatPanel;
}

Fixed version (ground truth):
/** 
 * Sets the currently selected chat panel.
 * @param currentChatPanel The chat panel which is currently selected.
 */
public void setCurrentChatPanel(ChatPanel currentChatPanel){
  this.currentChatPanel=currentChatPanel;
  this.setTitle(currentChatPanel.getMetaContact().getDisplayName());
  this.getMainToolBar().changeHistoryButtonsState(currentChatPanel);
}
Program: 104492
Project: 104492
Buggy source:
public void run(){
  conversationPanel.clear();
  chatPanel.processHistory(msgHistory,"String_Node_Str");
  conversationPanel.setDefaultContent();
  changeHistoryButtonsSate(chatPanel);
}

Fixed version (ground truth):
public void run(){
  conversationPanel.clear();
  chatPanel.processHistory(msgHistory,"String_Node_Str");
  conversationPanel.setDefaultContent();
  changeHistoryButtonsState(chatPanel);
}
Program: 104495
Project: 104495
Buggy source:
/** 
 * Selects the contact tab given by <code>index</code>.
 * @param index The index of the tab to select.
 */
public void setSelectedContactTab(int index){
  ChatPanel chatPanel=(ChatPanel)this.chatTabbedPane.getComponentAt(index);
  this.setCurrentChatPanel(chatPanel);
  this.chatTabbedPane.setSelectedIndex(index);
  this.setTitle(chatPanel.getMetaContact().getDisplayName());
  this.setVisible(true);
  chatPanel.requestFocusInWriteArea();
}

Fixed version (ground truth):
/** 
 * Selects the contact tab given by <code>index</code>.
 * @param index The index of the tab to select.
 */
public void setSelectedContactTab(int index){
  ChatPanel chatPanel=(ChatPanel)this.chatTabbedPane.getComponentAt(index);
  this.setCurrentChatPanel(chatPanel);
  this.chatTabbedPane.setSelectedIndex(index);
  this.setTitle(chatPanel.getMetaContact().getDisplayName());
  chatPanel.requestFocusInWriteArea();
}
Program: 104496
Project: 104496
Buggy source:
public void windowDeiconified(WindowEvent e){
  String title=getTitle();
  if (title.endsWith("String_Node_Str")) {
    setTitle(title.substring(0,title.length() - 1));
  }
}

Fixed version (ground truth):
public void windowDeiconified(WindowEvent e){
  String title=getTitle();
  if (title.startsWith("String_Node_Str")) {
    setTitle(title.substring(1,title.length()));
  }
}
Program: 104497
Project: 104497
Buggy source:
public void contactPresenceStatusChanged(ContactPresenceStatusChangeEvent evt){
  ContactListPanel clistPanel=tabbedPane.getContactListPanel();
  Contact sourceContact=evt.getSourceContact();
  MetaContact metaContact=contactList.findMetaContactByContact(sourceContact);
  if (metaContact != null) {
    if (!evt.getOldStatus().equals(evt.getNewStatus())) {
      clistPanel.getContactList().refreshAll();
      clistPanel.updateChatContactStatus(metaContact,sourceContact);
    }
  }
}

Fixed version (ground truth):
public void contactPresenceStatusChanged(ContactPresenceStatusChangeEvent evt){
  ContactListPanel clistPanel=tabbedPane.getContactListPanel();
  Contact sourceContact=evt.getSourceContact();
  MetaContact metaContact=contactList.findMetaContactByContact(sourceContact);
  if (metaContact != null) {
    if (!evt.getOldStatus().equals(evt.getNewStatus())) {
      clistPanel.getContactList().modifyContact(metaContact);
      clistPanel.updateChatContactStatus(metaContact,sourceContact);
    }
  }
}
Program: 104498
Project: 104498
Buggy source:
/** 
 * Removes the given call panel tab.
 * @param callPanel the CallPanel to remove
 */
public void removeCallPanel(CallPanel callPanel){
  Timer timer=new Timer(5000,new RemoveCallPanelListener(callPanel));
  timer.setRepeats(false);
  timer.start();
}

Fixed version (ground truth):
/** 
 * Removes the given call panel tab.
 * @param callPanel the CallPanel to remove
 */
private void removeCallPanel(CallPanel callPanel){
  this.activeCalls.remove(callPanel.getCall());
  mainFrame.removeCallPanel(callPanel);
  updateButtonsStateAccordingToSelectedPanel();
}
Program: 104499
Project: 104499
Buggy source:
/** 
 * Implements CallListener.callEnded. Stops sounds that are playing at the moment if there're any. Removes the call panel and disables the hangup button.
 */
public void callEnded(CallEvent event){
  SoundLoader.getSound(SoundLoader.BUSY).stop();
  SoundLoader.stop(Constants.getDefaultIncomingCallAudio());
  Call sourceCall=event.getSourceCall();
  if (activeCalls.get(sourceCall) != null) {
    CallPanel callPanel=(CallPanel)activeCalls.get(sourceCall);
    this.removeCallPanel(callPanel);
  }
}

Fixed version (ground truth):
/** 
 * Implements CallListener.callEnded. Stops sounds that are playing at the moment if there're any. Removes the call panel and disables the hangup button.
 */
public void callEnded(CallEvent event){
  SoundLoader.getSound(SoundLoader.BUSY).stop();
  SoundLoader.stop(Constants.getDefaultIncomingCallAudio());
  Call sourceCall=event.getSourceCall();
  if (activeCalls.get(sourceCall) != null) {
    CallPanel callPanel=(CallPanel)activeCalls.get(sourceCall);
    this.removeCallPanelWait(callPanel);
  }
}
Program: 104500
Project: 104500
Buggy source:
public void actionPerformed(ActionEvent e){
  activeCalls.remove(callPanel.getCall());
  mainFrame.removeCallPanel(callPanel);
  updateButtonsStateAccordingToSelectedPanel();
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  removeCallPanel(callPanel);
}
Program: 104501
Project: 104501
Buggy source:
/** 
 * Implements the CallChangeListener.callParticipantRemoved method. When a call participant is removed from our call remove it from the call panel.
 */
public void callParticipantRemoved(CallParticipantEvent evt){
  if (evt.getSourceCall() == call) {
    CallParticipant participant=evt.getSourceCallParticipant();
    CallParticipantPanel participantPanel=(CallParticipantPanel)participantsPanels.get(participant);
    if (participantPanel != null) {
      CallParticipantState state=participant.getState();
      participantPanel.setState(state.getStateString());
      participantPanel.stopCallTimer();
      GuiCallParticipantRecord participantRecord=new GuiCallParticipantRecord(participantPanel.getName(),participantPanel.getCallType(),participantPanel.getStartTime(),participantPanel.getEndTime());
      callManager.getMainFrame().getCallList().addItem(participantRecord,1);
      this.participantsPanels.remove(participant);
      if (participantsPanels.size() != 0) {
        Timer timer=new Timer(5000,new RemoveParticipantPanelListener(participantPanel));
        timer.setRepeats(false);
        timer.start();
      }
      this.revalidate();
      this.repaint();
    }
  }
}

Fixed version (ground truth):
/** 
 * Implements the CallChangeListener.callParticipantRemoved method. When a call participant is removed from our call remove it from the call panel.
 */
public void callParticipantRemoved(CallParticipantEvent evt){
  if (evt.getSourceCall() == call) {
    CallParticipant participant=evt.getSourceCallParticipant();
    CallParticipantPanel participantPanel=(CallParticipantPanel)participantsPanels.get(participant);
    if (participantPanel != null) {
      CallParticipantState state=participant.getState();
      participantPanel.setState(state.getStateString());
      participantPanel.stopCallTimer();
      GuiCallParticipantRecord participantRecord=new GuiCallParticipantRecord(participantPanel.getParticipantName(),participantPanel.getCallType(),participantPanel.getStartTime(),participantPanel.getEndTime());
      callManager.getMainFrame().getCallListManager().addCallRecord(1,participantRecord);
      this.participantsPanels.remove(participant);
      if (participantsPanels.size() != 0) {
        Timer timer=new Timer(5000,new RemoveParticipantPanelListener(participantPanel));
        timer.setRepeats(false);
        timer.start();
      }
      this.revalidate();
      this.repaint();
    }
  }
}
Program: 104502
Project: 104502
Buggy source:
/** 
 * Creates a <tt>CallParticipantPanel</tt> for the given call participant.
 * @param participant the call participant
 * @param callType the call type. INCOMING_CALL or OUTGOING_CALL
 */
public CallParticipantPanel(CallParticipant participant){
  super(new BorderLayout());
  this.stateLabel=new JLabel(participant.getState().getStateString(),JLabel.CENTER);
  this.startDate=new Date(System.currentTimeMillis());
  this.timer=new Timer(1000,new CallTimerListener());
  this.timer.setRepeats(true);
  if (participant.getDisplayName() != null)   nameLabel.setText(participant.getDisplayName());
 else   nameLabel.setText(participant.getAddress());
  namePanel.add(nameLabel);
  namePanel.add(stateLabel);
  namePanel.add(timeLabel);
  contactPanel.add(photoLabel,BorderLayout.CENTER);
  contactPanel.add(namePanel,BorderLayout.SOUTH);
  this.add(contactPanel,BorderLayout.NORTH);
  this.setPreferredSize(new Dimension(100,200));
}

Fixed version (ground truth):
/** 
 * Creates a <tt>CallParticipantPanel</tt> for the given call participant.
 * @param participant the call participant
 * @param callType the call type. INCOMING_CALL or OUTGOING_CALL
 */
public CallParticipantPanel(CallParticipant participant){
  super(new BorderLayout());
  this.stateLabel=new JLabel(participant.getState().getStateString(),JLabel.CENTER);
  this.startDate=new Date(System.currentTimeMillis());
  this.timer=new Timer(1000,new CallTimerListener());
  this.timer.setRepeats(true);
  if (participant.getDisplayName() != null)   participantName=participant.getDisplayName();
 else   participantName=participant.getAddress();
  this.nameLabel.setText(participantName);
  namePanel.add(nameLabel);
  namePanel.add(stateLabel);
  namePanel.add(timeLabel);
  contactPanel.add(photoLabel,BorderLayout.CENTER);
  contactPanel.add(namePanel,BorderLayout.SOUTH);
  this.add(contactPanel,BorderLayout.NORTH);
  this.setPreferredSize(new Dimension(100,200));
}
Program: 104503
Project: 104503
Buggy source:
/** 
 * Connects and logins again to the server
 */
void reregister(){
  try {
    logger.trace("String_Node_Str");
    this.unregister(false);
    connectAndLogin(authority);
  }
 catch (  OperationFailedException ex) {
    logger.error("String_Node_Str",ex);
    fireRegistrationStateChanged(getRegistrationState(),RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_INTERNAL_ERROR,null);
  }
catch (  XMPPException ex) {
    logger.error("String_Node_Str",ex);
    int reason=RegistrationStateChangeEvent.REASON_NOT_SPECIFIED;
    if (ex.getWrappedThrowable() instanceof UnknownHostException)     reason=RegistrationStateChangeEvent.REASON_SERVER_NOT_FOUND;
    fireRegistrationStateChanged(getRegistrationState(),RegistrationState.CONNECTION_FAILED,reason,null);
  }
}

Fixed version (ground truth):
/** 
 * Connects and logins again to the server
 */
void reregister(){
  try {
    logger.trace("String_Node_Str");
    this.unregister(false);
    this.reconnecting=true;
    connectAndLogin(authority);
  }
 catch (  OperationFailedException ex) {
    logger.error("String_Node_Str",ex);
    fireRegistrationStateChanged(getRegistrationState(),RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_INTERNAL_ERROR,null);
  }
catch (  XMPPException ex) {
    logger.error("String_Node_Str",ex);
    int reason=RegistrationStateChangeEvent.REASON_NOT_SPECIFIED;
    if (ex.getWrappedThrowable() instanceof UnknownHostException)     reason=RegistrationStateChangeEvent.REASON_SERVER_NOT_FOUND;
    fireRegistrationStateChanged(getRegistrationState(),RegistrationState.CONNECTION_FAILED,reason,null);
  }
}
Program: 104504
Project: 104504
Buggy source:
public void connectionClosedOnError(Exception exception){
  logger.error("String_Node_Str" + exception.getLocalizedMessage());
  reregister();
}

Fixed version (ground truth):
public void connectionClosedOnError(Exception exception){
  logger.error("String_Node_Str" + exception.getLocalizedMessage());
  if (!reconnecting)   reregister();
 else   reconnecting=false;
}
Program: 104506
Project: 104506
Buggy source:
/** 
 * Convienence method that displays a modal wizard dialog and blocks until the dialog has completed.
 * @return Indicates how the dialog was closed. Compare this value againstthe RETURN_CODE constants at the beginning of the class.
 */
public int showDialog(boolean modal){
  if (modal)   wizardDialog.setModal(true);
  wizardDialog.pack();
  wizardDialog.setVisible(true);
  return returnCode;
}

Fixed version (ground truth):
/** 
 * Convienence method that displays a modal wizard dialog and blocks until the dialog has completed.
 * @return Indicates how the dialog was closed. Compare this value againstthe RETURN_CODE constants at the beginning of the class.
 */
public void showDialog(boolean modal){
  if (modal)   wizardDialog.setModal(true);
  wizardDialog.pack();
  wizardDialog.setVisible(true);
}
Program: 104507
Project: 104507
Buggy source:
/** 
 * If the user presses the close box on the dialog's window, treat it as a cancel.
 * @param e The event passed in from AWT.
 */
public void windowClosing(WindowEvent e){
  returnCode=CANCEL_RETURN_CODE;
}

Fixed version (ground truth):
/** 
 * If the user presses the close box on the dialog's window, treat it as a cancel.
 * @param e The event passed in from AWT.
 */
public void windowClosing(WindowEvent e){
  fireWizardEvent(WizardEvent.CANCEL);
}
Program: 104508
Project: 104508
Buggy source:
/** 
 * Closes the dialog and sets the return code to the integer parameter.
 * @param code The return code.
 */
void close(int code){
  WizardPage oldPanelDescriptor=wizardModel.getCurrentWizardPage();
  if (oldPanelDescriptor != null)   oldPanelDescriptor.pageHiding();
  if (this.containsPage(WizardPage.DEFAULT_PAGE_IDENTIFIER)) {
    this.unregisterWizardPage(WizardPage.DEFAULT_PAGE_IDENTIFIER);
  }
  if (this.containsPage(WizardPage.SUMMARY_PAGE_IDENTIFIER)) {
    this.unregisterWizardPage(WizardPage.SUMMARY_PAGE_IDENTIFIER);
  }
  this.removeWizzardIcon();
  returnCode=code;
  wizardDialog.dispose();
}

Fixed version (ground truth):
/** 
 * Closes the dialog and sets the return code to the integer parameter.
 * @param code The return code.
 */
void close(int code){
  WizardPage oldPanelDescriptor=wizardModel.getCurrentWizardPage();
  if (oldPanelDescriptor != null)   oldPanelDescriptor.pageHiding();
  if (this.containsPage(WizardPage.DEFAULT_PAGE_IDENTIFIER)) {
    this.unregisterWizardPage(WizardPage.DEFAULT_PAGE_IDENTIFIER);
  }
  if (this.containsPage(WizardPage.SUMMARY_PAGE_IDENTIFIER)) {
    this.unregisterWizardPage(WizardPage.SUMMARY_PAGE_IDENTIFIER);
  }
  this.removeWizzardIcon();
  this.fireWizardEvent(WizardEvent.SUCCESS);
  wizardDialog.dispose();
}
Program: 104509
Project: 104509
Buggy source:
/** 
 * Handles the <tt>MetaContactGroupEvent</tt>. Refreshes the list model when the contact list groups has been reordered. Moves the selection index to the index of the contact that was selected before the reordered event. This way the selection depends on the contact and not on the index.
 */
public void childContactsReordered(MetaContactGroupEvent evt){
  this.refresh();
  if (currentlySelectedContact != null)   this.setSelectedValue(currentlySelectedContact,false);
}

Fixed version (ground truth):
/** 
 * Handles the <tt>MetaContactGroupEvent</tt>. Refreshes the list model when the contact list groups has been reordered. Moves the selection index to the index of the contact that was selected before the reordered event. This way the selection depends on the contact and not on the index.
 */
public void childContactsReordered(MetaContactGroupEvent evt){
  if (currentlySelectedContact != null)   this.setSelectedValue(currentlySelectedContact,false);
  this.refresh();
}
Program: 104510
Project: 104510
Buggy source:
public void contactPresenceStatusChanged(ContactPresenceStatusChangeEvent evt){
  ContactListPanel clistPanel=tabbedPane.getContactListPanel();
  clistPanel.getContactList().refresh();
  Contact sourceContact=evt.getSourceContact();
  MetaContact metaContact=contactList.findMetaContactByContact(sourceContact);
  if (metaContact != null) {
    if (!evt.getOldStatus().equals(evt.getNewStatus()))     clistPanel.updateChatContactStatus(metaContact,sourceContact);
  }
}

Fixed version (ground truth):
public void contactPresenceStatusChanged(ContactPresenceStatusChangeEvent evt){
  ContactListPanel clistPanel=tabbedPane.getContactListPanel();
  Contact sourceContact=evt.getSourceContact();
  MetaContact metaContact=contactList.findMetaContactByContact(sourceContact);
  if (metaContact != null) {
    if (!evt.getOldStatus().equals(evt.getNewStatus()))     clistPanel.updateChatContactStatus(metaContact,sourceContact);
  }
}
Program: 104511
Project: 104511
Buggy source:
/** 
 * Handles the <tt>MetaContactGroupEvent</tt>. Refreshes the list model when a new meta contact group has been added.
 */
public void metaContactGroupAdded(MetaContactGroupEvent evt){
  this.refresh();
}

Fixed version (ground truth):
/** 
 * Handles the <tt>MetaContactGroupEvent</tt>. Refreshes the list model when a new meta contact group has been added.
 */
public void metaContactGroupAdded(MetaContactGroupEvent evt){
  this.refreshAll();
}
Program: 104512
Project: 104512
Buggy source:
/** 
 * Handles the <tt>ProtoContactEvent</tt>. Refreshes the list when a protocol contact has been added.
 */
public void protoContactAdded(ProtoContactEvent evt){
  int index=this.listModel.indexOf(evt.getNewParent());
  this.listModel.contentChanged(index,index);
}

Fixed version (ground truth):
/** 
 * Handles the <tt>ProtoContactEvent</tt>. Refreshes the list when a protocol contact has been added.
 */
public void protoContactAdded(ProtoContactEvent evt){
  this.refreshAll();
}
Program: 104513
Project: 104513
Buggy source:
/** 
 * Handles the <tt>MetaContactEvent</tt>. Refreshes the list when a meta contact has been removed.
 */
public void metaContactRemoved(MetaContactEvent evt){
  this.refresh();
}

Fixed version (ground truth):
/** 
 * Handles the <tt>MetaContactEvent</tt>. Refreshes the list when a meta contact has been removed.
 */
public void metaContactRemoved(MetaContactEvent evt){
  this.refreshAll();
}
Program: 104514
Project: 104514
Buggy source:
public void run(){
  ContactInfoPanel contactInfoPanel=new ContactInfoPanel(mainFrame,contactItem);
  SwingUtilities.convertPointToScreen(p,ContactList.this);
  contactInfoPanel.setPopupLocation(p.x - 140,p.y - 15);
  contactInfoPanel.setVisible(true);
  contactInfoPanel.requestFocusInWindow();
}

Fixed version (ground truth):
public void run(){
  while (refreshEnabled) {
synchronized (refreshLock) {
      if (isModified) {
        try {
          refreshLock.wait(5000);
        }
 catch (        InterruptedException e) {
          logger.error("String_Node_Str",e);
        }
      }
    }
    if (isModified) {
      if (groupsToModify.size() > 0) {
        for (int i=0; i < groupsToModify.size(); i++) {
          MetaContactGroup group=(MetaContactGroup)groupsToModify.get(i);
          this.refreshGroup(group);
        }
        groupsToModify.removeAllElements();
      }
 else {
        this.refreshAll();
      }
      isModified=false;
    }
  }
}
Program: 104515
Project: 104515
Buggy source:
/** 
 * Handles the <tt>MetaContactMovedEvent</tt>. Refreshes the list when a meta contact has been moved.
 */
public void metaContactMoved(MetaContactMovedEvent evt){
  this.refresh();
}

Fixed version (ground truth):
/** 
 * Handles the <tt>MetaContactMovedEvent</tt>. Refreshes the list when a meta contact has been moved.
 */
public void metaContactMoved(MetaContactMovedEvent evt){
  this.refreshAll();
}
Program: 104516
Project: 104516
Buggy source:
/** 
 * Handles the <tt>MetaContactGroupEvent</tt>. Refreshes the list model when the contact list groups has been reordered. Moves the selection index to the index of the contact that was selected before the reordered event. This way the selection depends on the contact and not on the index.
 */
public void childContactsReordered(MetaContactGroupEvent evt){
  if (currentlySelectedContact != null)   this.setSelectedValue(currentlySelectedContact,false);
  this.refresh();
}

Fixed version (ground truth):
/** 
 * Handles the <tt>MetaContactGroupEvent</tt>. Refreshes the list model when the contact list groups has been reordered. Moves the selection index to the index of the contact that was selected before the reordered event. This way the selection depends on the contact and not on the index.
 */
public void childContactsReordered(MetaContactGroupEvent evt){
  this.refreshGroup(evt.getSourceMetaContactGroup());
}
Program: 104517
Project: 104517
Buggy source:
/** 
 * Handles the <tt>ProtoContactEvent</tt>. Refreshes the list when a protocol contact has been moved.
 */
public void protoContactMoved(ProtoContactEvent evt){
  this.refresh();
}

Fixed version (ground truth):
/** 
 * Handles the <tt>ProtoContactEvent</tt>. Refreshes the list when a protocol contact has been moved.
 */
public void protoContactMoved(ProtoContactEvent evt){
  this.refreshAll();
}