nus-yam/ex-repair huggingface dataset:
Program: 104571
Project: 104571
Buggy source:
public void actionPerformed(ActionEvent e){
  JButton button=(JButton)e.getSource();
  String buttonName=button.getName();
  if (buttonName.equals("String_Node_Str")) {
  }
 else   if (buttonName.equals("String_Node_Str")) {
    mainFrame.getConfigFrame().setCalculatedSize();
    mainFrame.getConfigFrame().setVisible(true);
  }
 else   if (buttonName.equals("String_Node_Str")) {
    ContactListModel listModel=(ContactListModel)mainFrame.getTabbedPane().getContactListPanel().getContactList().getModel();
    if (listModel.showOffline()) {
      listModel.setShowOffline(false);
      listModel.removeOfflineContacts();
    }
 else {
      listModel.setShowOffline(true);
      listModel.addOfflineContacts();
    }
  }
 else   if (buttonName.equals("String_Node_Str")) {
  }
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  JButton button=(JButton)e.getSource();
  String buttonName=button.getName();
  if (buttonName.equals("String_Node_Str")) {
  }
 else   if (buttonName.equals("String_Node_Str")) {
    mainFrame.getConfigFrame().setCalculatedSize();
    mainFrame.getConfigFrame().setVisible(true);
  }
 else   if (buttonName.equals("String_Node_Str")) {
    ContactList contactList=mainFrame.getTabbedPane().getContactListPanel().getContactList();
    ContactListModel listModel=(ContactListModel)contactList.getModel();
    if (listModel.showOffline()) {
      listModel.setShowOffline(false);
      listModel.removeOfflineContacts();
    }
 else {
      int currentlySelectedIndex=contactList.getSelectedIndex();
      Object selectedObject=listModel.getElementAt(currentlySelectedIndex);
      listModel.setShowOffline(true);
      listModel.addOfflineContacts();
      if (selectedObject != null) {
        if (selectedObject instanceof MetaContact) {
          contactList.setSelectedIndex(listModel.indexOf((MetaContact)selectedObject));
        }
 else {
          contactList.setSelectedIndex(listModel.indexOf((MetaContactGroup)selectedObject));
        }
      }
    }
  }
 else   if (buttonName.equals("String_Node_Str")) {
  }
}
Program: 104573
Project: 104573
Buggy source:
/** 
 * Removes all offline contacts from the contact list.
 */
public void removeOfflineContacts(){
  Vector offlineContactsCopy=new Vector();
  int size=this.getSize();
  for (int i=0; i < size; i++) {
    Object element=this.getElementAt(i);
    if (element instanceof MetaContact) {
      MetaContact contactNode=(MetaContact)element;
      if (!getMetaContactStatus(contactNode).isOnline()) {
        int index=indexOf(contactNode);
        this.contentRemoved(index,index);
        offlineContactsCopy.add(contactNode);
      }
    }
  }
  this.offlineContacts=offlineContactsCopy;
}

Fixed version (ground truth):
/** 
 * Removes all offline contacts from the contact list.
 */
public void removeOfflineContacts(){
  Vector offlineContactsCopy=new Vector();
  int size=this.getSize();
  for (int i=0; i < size; i++) {
    Object element=this.getElementAt(i);
    if (element instanceof MetaContact) {
      MetaContact contactNode=(MetaContact)element;
      if (!getMetaContactStatus(contactNode).isOnline()) {
        int index=indexOf(contactNode);
        this.contentRemoved(index,index);
        offlineContactsCopy.add(contactNode);
      }
    }
  }
  for (int j=0; j < closedGroups.size(); j++) {
    MetaContactGroup closedGroup=(MetaContactGroup)closedGroups.get(j);
    removeClosedOfflineContacts(closedGroup,offlineContactsCopy);
  }
  this.offlineContacts=offlineContactsCopy;
}
Program: 104574
Project: 104574
Buggy source:
/** 
 * Closes the given group by hiding all containing contacts.
 * @param group The group to close.
 */
public void closeGroup(MetaContactGroup group){
  contentRemoved(this.indexOf(group.getMetaContact(0)),this.indexOf(group.getMetaContact(group.countChildContacts() - 1)));
  this.closedGroups.add(group);
}

Fixed version (ground truth):
/** 
 * Closes the given group by hiding all containing contacts.
 * @param group The group to close.
 */
public void closeGroup(MetaContactGroup group){
  if (countSubgroupContacts(group) > 0) {
    contentRemoved(this.indexOf(group.getMetaContact(0)),this.indexOf(group.getMetaContact(countSubgroupContacts(group) - 1)));
    this.closedGroups.add(group);
  }
}
Program: 104575
Project: 104575
Buggy source:
/** 
 * Opens the given group by showing all containing contacts.
 * @param group The group to open.
 */
public void openGroup(MetaContactGroup group){
  this.closedGroups.remove(group);
  contentAdded(this.indexOf(group.getMetaContact(0)),this.indexOf(group.getMetaContact(group.countChildContacts() - 1)));
}

Fixed version (ground truth):
/** 
 * Opens the given group by showing all containing contacts.
 * @param group The group to open.
 */
public void openGroup(MetaContactGroup group){
  this.closedGroups.remove(group);
  contentAdded(this.indexOf(group.getMetaContact(0)),this.indexOf(group.getMetaContact(countSubgroupContacts(group) - 1)));
}
Program: 104576
Project: 104576
Buggy source:
/** 
 * Adds all offline contacts back to the contact list.
 */
public void addOfflineContacts(){
  Vector contacts=(Vector)this.offlineContacts.clone();
  this.offlineContacts.removeAllElements();
  for (int i=0; i < contacts.size(); i++) {
    MetaContact contact=(MetaContact)contacts.get(i);
    this.offlineContacts.remove(contact);
    int index=this.indexOf(contact);
    contentAdded(index,index);
  }
}

Fixed version (ground truth):
/** 
 * Adds all offline contacts back to the contact list.
 */
public void addOfflineContacts(){
  Vector contacts=(Vector)this.offlineContacts.clone();
  this.offlineContacts.removeAllElements();
  for (int i=0; i < contacts.size(); i++) {
    MetaContact contact=(MetaContact)contacts.get(i);
    if (!isGroupClosed(contact.getParentMetaContactGroup())) {
      int index=this.indexOf(contact);
      contentAdded(index,index);
    }
  }
}
Program: 104577
Project: 104577
Buggy source:
/** 
 * Indicates that a MetaContactGroup has been added.
 * @param evt The MetaContactGroupEvent event.
 */
public void metaContactGroupAdded(MetaContactGroupEvent evt){
  MetaContactGroup sourceGroup=evt.getSourceMetaContactGroup();
  this.groupAdded(sourceGroup);
  this.ensureIndexIsVisible(0);
}

Fixed version (ground truth):
/** 
 * Indicates that a MetaContactGroup has been added.
 * @param evt The MetaContactGroupEvent event.
 */
public void metaContactGroupAdded(MetaContactGroupEvent evt){
  MetaContactGroup sourceGroup=evt.getSourceMetaContactGroup();
  this.groupAdded(sourceGroup);
  this.revalidate();
}
Program: 104578
Project: 104578
Buggy source:
/** 
 * Creates an instance of this operation set.
 * @param icqProvider a ref to the <tt>ProtocolProviderServiceIcqImpl</tt>that created us and that we'll use for retrieving the underlying aim connection.
 */
OperationSetBasicInstantMessagingIcqImpl(ProtocolProviderServiceIcqImpl icqProvider){
  this.icqProvider=icqProvider;
  icqProvider.addRegistrationStateChangeListener(providerRegListener);
}

Fixed version (ground truth):
/** 
 * Creates an instance of this operation set.
 * @param icqProvider a ref to the <tt>ProtocolProviderServiceIcqImpl</tt>that created us and that we'll use for retrieving the underlying aim connection.
 */
OperationSetBasicInstantMessagingIcqImpl(ProtocolProviderServiceIcqImpl icqProvider){
  this.icqProvider=icqProvider;
  icqProvider.addRegistrationStateChangeListener(providerRegListener);
  channelFourCmdFactory.addCommandHandler(IcbmChannelFourCommand.MTYPE_PLAIN,new PlainMessageHandler());
}
Program: 104579
Project: 104579
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) {
    System.out.println("String_Node_Str");
    icqProvider.getAimConnection().getIcbmService().addIcbmListener(joustSimIcbmListener);
    opSetPersPresence=(OperationSetPersistentPresenceIcqImpl)icqProvider.getSupportedOperationSets().get(OperationSetPersistentPresence.class.getName());
    retreiveOfflineMessages();
  }
}

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) {
    System.out.println("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();
  }
}
Program: 104580
Project: 104580
Buggy source:
/** 
 * Adds the specified group to the end of the list of sub groups.
 * @param group the group to add.
 */
void addSubGroup(ContactGroupIcqImpl group){
  addSubGroup(countContacts(),group);
}

Fixed version (ground truth):
/** 
 * Adds the specified group to the end of the list of sub groups.
 * @param group the group to add.
 */
void addSubGroup(ContactGroupIcqImpl group){
  addSubGroup(countContacts() + countSubgroups(),group);
}
Program: 104581
Project: 104581
Buggy source:
/** 
 * Updates the status of the given metacontact in all opened chats containing this contact.
 * @param metaContact
 */
public void updateChatContactStatus(MetaContact metaContact){
  ContactListModel listModel=(ContactListModel)this.getContactList().getModel();
  if (!Constants.TABBED_CHAT_WINDOW) {
  }
 else   if (tabbedChatWindow != null && tabbedChatWindow.getTabCount() > 0) {
    Hashtable contactTabsTable=tabbedChatWindow.getContactTabsTable();
    ChatPanel chatPanel=(ChatPanel)contactTabsTable.get(metaContact.getMetaUID());
    if (chatPanel != null) {
      tabbedChatWindow.setTabIcon(metaContact,listModel.getMetaContactStatusIcon(metaContact));
      chatPanel.updateContactStatus(listModel.getMetaContactStatus(metaContact));
    }
  }
}

Fixed version (ground truth):
/** 
 * Updates the status of the given metacontact in all opened chats containing this contact.
 * @param metaContact
 */
public void updateChatContactStatus(MetaContact metaContact){
  ContactListModel listModel=(ContactListModel)this.getContactList().getModel();
  if (!Constants.TABBED_CHAT_WINDOW) {
    if (contactMsgWindows.containsKey(metaContact)) {
      ChatWindow msgWindow=(ChatWindow)contactMsgWindows.get(metaContact);
      msgWindow.getCurrentChatPanel().updateContactStatus(listModel.getMetaContactStatus(metaContact));
    }
  }
 else   if (tabbedChatWindow != null) {
    Hashtable contactTabsTable=tabbedChatWindow.getContactTabsTable();
    ChatPanel chatPanel=(ChatPanel)contactTabsTable.get(metaContact.getMetaUID());
    if (chatPanel != null) {
      if (tabbedChatWindow.getTabCount() > 0) {
        tabbedChatWindow.setTabIcon(metaContact,listModel.getMetaContactStatusIcon(metaContact));
      }
      chatPanel.updateContactStatus(listModel.getMetaContactStatus(metaContact));
    }
  }
}
Program: 104584
Project: 104584
Buggy source:
/** 
 * Converts the specified icqstatus to one of the status fields of the IcqStatusEnum class.
 * @param icqStatus the icqStatus as retured in FullUserInfo by the joscarstack
 * @return a PresenceStatus instance representation of the "long" icqStatusparameter. The returned result is one of the IcqStatusEnum fields.
 */
private IcqStatusEnum icqStatusLongToPresenceStatus(long icqStatus){
  if (icqStatus == -1) {
    return IcqStatusEnum.OFFLINE;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_AWAY) != 0) {
    return IcqStatusEnum.AWAY;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_DND) != 0) {
    return IcqStatusEnum.DO_NOT_DISTURB;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_FFC) != 0) {
    return IcqStatusEnum.FREE_FOR_CHAT;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_INVISIBLE) != 0) {
    return IcqStatusEnum.INVISIBLE;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_NA) != 0) {
    return IcqStatusEnum.NOT_AVAILABLE;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_OCCUPIED) != 0) {
    return IcqStatusEnum.OCCUPIED;
  }
 else   if ((icqStatus & ICQ_ONLINE_MASK) == 0) {
    return IcqStatusEnum.OFFLINE;
  }
  return IcqStatusEnum.ONLINE;
}

Fixed version (ground truth):
/** 
 * Converts the specified icqstatus to one of the status fields of the IcqStatusEnum class.
 * @param icqStatus the icqStatus as retured in FullUserInfo by the joscarstack
 * @return a PresenceStatus instance representation of the "long" icqStatusparameter. The returned result is one of the IcqStatusEnum fields.
 */
private IcqStatusEnum icqStatusLongToPresenceStatus(long icqStatus){
  if (icqStatus == -1) {
    return IcqStatusEnum.OFFLINE;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_AWAY) != 0) {
    return IcqStatusEnum.AWAY;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_DND) != 0) {
    return IcqStatusEnum.DO_NOT_DISTURB;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_FFC) != 0) {
    return IcqStatusEnum.FREE_FOR_CHAT;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_INVISIBLE) != 0) {
    return IcqStatusEnum.INVISIBLE;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_NA) != 0) {
    return IcqStatusEnum.NOT_AVAILABLE;
  }
 else   if ((icqStatus & FullUserInfo.ICQSTATUS_OCCUPIED) != 0) {
    return IcqStatusEnum.OCCUPIED;
  }
  return IcqStatusEnum.ONLINE;
}
Program: 104585
Project: 104585
Buggy source:
/** 
 * Creates the contactlist scroll panel defining the parent frame.
 * @param mainFrame The parent frame.
 */
public ContactListPanel(MainFrame mainFrame){
  this.mainFrame=mainFrame;
  this.getViewport().add(treePanel);
  this.treePanel.setBackground(Color.WHITE);
  this.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
}

Fixed version (ground truth):
/** 
 * Creates the contactlist scroll panel defining the parent frame.
 * @param mainFrame The parent frame.
 */
public ContactListPanel(MainFrame mainFrame){
  this.mainFrame=mainFrame;
  this.getViewport().add(treePanel);
  this.treePanel.setBackground(Color.WHITE);
  this.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  this.getVerticalScrollBar().setUnitIncrement(30);
}
Program: 104586
Project: 104586
Buggy source:
/** 
 * Updates the status of the given metacontact in all opened chats containing this contact.
 * @param metaContact
 */
public void updateChatContactStatus(MetaContact metaContact){
  ContactListModel listModel=(ContactListModel)this.getContactList().getModel();
  if (!Constants.TABBED_CHAT_WINDOW) {
  }
 else   if (tabbedChatWindow != null) {
    Hashtable contactTabsTable=tabbedChatWindow.getContactTabsTable();
    ChatPanel chatPanel=(ChatPanel)contactTabsTable.get(metaContact.getDisplayName());
    if (chatPanel != null) {
      int contactTabIndex=tabbedChatWindow.getTabInex(metaContact);
      tabbedChatWindow.setTabIcon(contactTabIndex,listModel.getMetaContactStatusIcon(metaContact));
      chatPanel.updateContactStatus(listModel.getMetaContactStatus(metaContact));
    }
  }
}

Fixed version (ground truth):
/** 
 * Updates the status of the given metacontact in all opened chats containing this contact.
 * @param metaContact
 */
public void updateChatContactStatus(MetaContact metaContact){
  ContactListModel listModel=(ContactListModel)this.getContactList().getModel();
  if (!Constants.TABBED_CHAT_WINDOW) {
  }
 else   if (tabbedChatWindow != null && tabbedChatWindow.getTabCount() > 0) {
    Hashtable contactTabsTable=tabbedChatWindow.getContactTabsTable();
    ChatPanel chatPanel=(ChatPanel)contactTabsTable.get(metaContact.getDisplayName());
    if (chatPanel != null) {
      int contactTabIndex=tabbedChatWindow.getTabInex(metaContact);
      tabbedChatWindow.setTabIcon(contactTabIndex,listModel.getMetaContactStatusIcon(metaContact));
      chatPanel.updateContactStatus(listModel.getMetaContactStatus(metaContact));
    }
  }
}
Program: 104587
Project: 104587
Buggy source:
public ChatConversationPanel(ChatPanel chatPanel){
  super();
  this.chatEditorPane.setContentType("String_Node_Str");
  this.chatEditorPane.setEditable(false);
  this.chatEditorPane.setEditorKit(editorKit);
  this.document=(HTMLDocument)this.chatEditorPane.getDocument();
  Constants.loadStyle(document.getStyleSheet());
  this.initEditor();
  this.chatEditorPane.addHyperlinkListener(this);
  this.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  this.setWheelScrollingEnabled(true);
  this.getViewport().add(chatEditorPane);
}

Fixed version (ground truth):
public ChatConversationPanel(ChatPanel chatPanel){
  super();
  this.chatEditorPane.setContentType("String_Node_Str");
  this.chatEditorPane.setEditable(false);
  this.chatEditorPane.setEditorKit(editorKit);
  this.document=(HTMLDocument)this.chatEditorPane.getDocument();
  Constants.loadStyle(document.getStyleSheet());
  this.initEditor();
  this.chatEditorPane.addHyperlinkListener(this);
  this.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  this.setWheelScrollingEnabled(true);
  this.getViewport().add(chatEditorPane);
  this.getVerticalScrollBar().setUnitIncrement(30);
}
Program: 104588
Project: 104588
Buggy source:
public ChatWritePanel(ChatPanel chatPanel){
  super();
  this.chatPanel=chatPanel;
  this.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  this.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  this.editorPane.getDocument().addUndoableEditListener(this);
  this.enableKeyboardEvents();
  this.getViewport().add(editorPane,BorderLayout.CENTER);
}

Fixed version (ground truth):
public ChatWritePanel(ChatPanel chatPanel){
  super();
  this.chatPanel=chatPanel;
  this.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  this.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  this.editorPane.getDocument().addUndoableEditListener(this);
  this.enableKeyboardEvents();
  this.getViewport().add(editorPane,BorderLayout.CENTER);
  this.getVerticalScrollBar().setUnitIncrement(30);
}
Program: 104590
Project: 104590
Buggy source:
/** 
 * Creates a chat panel which is added to the  given chat window.
 * @param chatWindow The parent window of this chat panel.
 */
public ChatPanel(ChatWindow chatWindow,OperationSetBasicInstantMessaging imOperationSet){
  super(new BorderLayout());
  this.chatWindow=chatWindow;
  this.imOperationSet=imOperationSet;
  conversationPanel=new ChatConversationPanel(this);
  sendPanel=new ChatSendPanel(this);
  writeMessagePanel=new ChatWritePanel(this);
  this.topSplitPane.setResizeWeight(1.0D);
  this.messagePane.setResizeWeight(1.0D);
  this.chatConferencePanel.setPreferredSize(new Dimension(120,100));
  this.chatConferencePanel.setMinimumSize(new Dimension(120,100));
  this.writeMessagePanel.setPreferredSize(new Dimension(400,100));
  this.writeMessagePanel.setMinimumSize(new Dimension(400,100));
  this.init();
}

Fixed version (ground truth):
/** 
 * Creates a chat panel which is added to the  given chat window.
 * @param chatWindow The parent window of this chat panel.
 */
public ChatPanel(ChatWindow chatWindow,OperationSetBasicInstantMessaging imOperationSet){
  super(new BorderLayout());
  this.chatWindow=chatWindow;
  this.imOperationSet=imOperationSet;
  conversationPanel=new ChatConversationPanel(this);
  sendPanel=new ChatSendPanel(this);
  writeMessagePanel=new ChatWritePanel(this);
  this.topSplitPane.setResizeWeight(1.0D);
  this.messagePane.setResizeWeight(1.0D);
  this.chatConferencePanel.setPreferredSize(new Dimension(120,100));
  this.chatConferencePanel.setMinimumSize(new Dimension(120,100));
  this.writeMessagePanel.setPreferredSize(new Dimension(400,100));
  this.writeMessagePanel.setMinimumSize(new Dimension(400,100));
  this.init();
  addComponentListener(new TabSelectionFocusGainListener());
}
Program: 104591
Project: 104591
Buggy source:
public void actionPerformed(ActionEvent e){
  if (chatTabbedPane != null) {
    if (chatTabbedPane.getSelectedIndex() != 0) {
      ChatWindow.this.chatTabbedPane.setSelectedIndex(chatTabbedPane.getSelectedIndex() - 1);
    }
 else {
      ChatWindow.this.chatTabbedPane.setSelectedIndex(chatTabbedPane.getTabCount() - 1);
    }
  }
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  if (chatTabbedPane != null) {
    int selectedIndex=chatTabbedPane.getSelectedIndex();
    if (selectedIndex != 0) {
      setSelectedContactTab(selectedIndex - 1);
    }
 else {
      setSelectedContactTab(chatTabbedPane.getTabCount() - 1);
    }
  }
}
Program: 104592
Project: 104592
Buggy source:
/** 
 * Selects the chat tab which corresponds to the given MetaContact.
 * @param contact The MetaContact to select.
 */
public void setSelectedContactTab(MetaContact contact){
  if (this.contactTabsTable != null && !this.contactTabsTable.isEmpty()) {
    int selectedIndex=((ChatPanel)this.contactTabsTable.get(contact.getDisplayName())).getTabIndex();
    this.chatTabbedPane.setSelectedIndex(selectedIndex);
  }
}

Fixed version (ground truth):
public void setSelectedContactTab(int index){
  Enumeration chatsTable=this.contactTabsTable.elements();
  while (chatsTable.hasMoreElements()) {
    ChatPanel chatPanel=(ChatPanel)chatsTable.nextElement();
    if (chatPanel.getTabIndex() == index) {
      this.setCurrentChatPanel(chatPanel);
      this.chatTabbedPane.setSelectedIndex(index);
      this.setVisible(true);
      getWriteMessagePanel().getEditorPane().requestFocus();
      break;
    }
  }
}
Program: 104595
Project: 104595
Buggy source:
public void actionPerformed(ActionEvent e){
  if (chatTabbedPane != null && chatTabbedPane.getSelectedIndex() != 0) {
    ChatWindow.this.chatTabbedPane.setSelectedIndex(chatTabbedPane.getSelectedIndex() - 1);
  }
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  if (chatTabbedPane != null) {
    if (chatTabbedPane.getSelectedIndex() != 0) {
      ChatWindow.this.chatTabbedPane.setSelectedIndex(chatTabbedPane.getSelectedIndex() - 1);
    }
 else {
      ChatWindow.this.chatTabbedPane.setSelectedIndex(chatTabbedPane.getTabCount() - 1);
    }
  }
}
Program: 104597
Project: 104597
Buggy source:
/** 
 * Removes the chat tab with the given tab index.
 * @param index
 */
public void removeContactTab(int index){
  String title=chatTabbedPane.getTitleAt(index);
  if (chatTabbedPane.getTabCount() > 1)   this.contactTabsTable.remove(title);
  Enumeration contactTabs=this.contactTabsTable.elements();
  while (contactTabs.hasMoreElements()) {
    ChatPanel chatPanel=(ChatPanel)contactTabs.nextElement();
    int tabIndex=chatPanel.getTabIndex();
    if (tabIndex > index) {
      chatPanel.setTabIndex(tabIndex - 1);
    }
  }
  int selectedIndex=chatTabbedPane.getSelectedIndex();
  if (selectedIndex > index) {
    chatTabbedPane.setSelectedIndex(selectedIndex - 1);
  }
  if (chatTabbedPane.getTabCount() > 1)   chatTabbedPane.remove(index);
  if (chatTabbedPane.getTabCount() == 1) {
    String onlyTabtitle=chatTabbedPane.getTitleAt(0);
    this.getContentPane().remove(chatTabbedPane);
    this.chatTabbedPane.removeAll();
    ChatPanel chatPanel=(ChatPanel)this.contactTabsTable.get(onlyTabtitle);
    this.getContentPane().add(chatPanel,BorderLayout.CENTER);
    this.setCurrentChatPanel(chatPanel);
    this.setTitle(onlyTabtitle);
  }
}

Fixed version (ground truth):
/** 
 * Removes the tab with the given index.
 * @param index Tab index.
 */
public void removeContactTab(int index){
  String title=chatTabbedPane.getTitleAt(index);
  if (title != null) {
    if (chatTabbedPane.getTabCount() > 1)     this.contactTabsTable.remove(title);
    Enumeration contactTabs=this.contactTabsTable.elements();
    while (contactTabs.hasMoreElements()) {
      ChatPanel chatPanel=(ChatPanel)contactTabs.nextElement();
      int tabIndex=chatPanel.getTabIndex();
      if (tabIndex > index) {
        chatPanel.setTabIndex(tabIndex - 1);
      }
    }
    int selectedIndex=chatTabbedPane.getSelectedIndex();
    if (selectedIndex > index) {
      chatTabbedPane.setSelectedIndex(selectedIndex - 1);
    }
    if (chatTabbedPane.getTabCount() > 1)     chatTabbedPane.remove(index);
    if (chatTabbedPane.getTabCount() == 1) {
      String onlyTabtitle=chatTabbedPane.getTitleAt(0);
      this.getContentPane().remove(chatTabbedPane);
      this.chatTabbedPane.removeAll();
      ChatPanel chatPanel=(ChatPanel)this.contactTabsTable.get(onlyTabtitle);
      this.getContentPane().add(chatPanel,BorderLayout.CENTER);
      this.setCurrentChatPanel(chatPanel);
      this.setTitle(onlyTabtitle);
    }
  }
}
Program: 104599
Project: 104599
Buggy source:
/** 
 * Creates a ChatPanel for the given contact and adds it directly to the chat window.
 */
public void addChat(MetaContact contact){
  OperationSetBasicInstantMessaging contactIMOperationSet=this.mainFrame.getProtocolIM(contact.getDefaultContact().getProtocolProvider());
  this.setCurrentChatPanel(new ChatPanel(this,contactIMOperationSet));
  this.currentChatPanel.addContactToChat(contact);
  this.getContentPane().add(this.currentChatPanel,BorderLayout.CENTER);
  this.windowTitle+=contact.getDisplayName() + "String_Node_Str";
  this.setTitle(this.windowTitle);
}

Fixed version (ground truth):
/** 
 * Creates a ChatPanel for the given contact and  adds it directly to the chat window.
 */
public void addChat(MetaContact contact,PresenceStatus status){
  OperationSetBasicInstantMessaging contactIMOperationSet=this.mainFrame.getProtocolIM(contact.getDefaultContact().getProtocolProvider());
  this.setCurrentChatPanel(new ChatPanel(this,contactIMOperationSet));
  this.currentChatPanel.addContactToChat(contact,status);
  this.getContentPane().add(this.currentChatPanel,BorderLayout.CENTER);
  this.windowTitle+=contact.getDisplayName() + "String_Node_Str";
  this.setTitle(this.windowTitle);
}
Program: 104601
Project: 104601
Buggy source:
public EditMenu(){
  super(Messages.getString("String_Node_Str"));
  this.add(cutMenuItem);
  this.add(copyMenuItem);
  this.add(pasteMenuItem);
}

Fixed version (ground truth):
public EditMenu(ChatWindow chatWindow){
  super(Messages.getString("String_Node_Str"));
  this.chatWindow=chatWindow;
  this.cutMenuItem.setName("String_Node_Str");
  this.copyMenuItem.setName("String_Node_Str");
  this.pasteMenuItem.setName("String_Node_Str");
  this.cutMenuItem.addActionListener(this);
  this.copyMenuItem.addActionListener(this);
  this.pasteMenuItem.addActionListener(this);
  this.add(cutMenuItem);
  this.add(copyMenuItem);
  this.add(pasteMenuItem);
}
Program: 104602
Project: 104602
Buggy source:
public MessageWindowMenuBar(ChatWindow parentWindow){
  this.parentWindow=parentWindow;
  fileMenu=new FileMenu(this.parentWindow);
  this.init();
}

Fixed version (ground truth):
public MessageWindowMenuBar(ChatWindow parentWindow){
  this.parentWindow=parentWindow;
  fileMenu=new FileMenu(this.parentWindow);
  editMenu=new EditMenu(this.parentWindow);
  this.init();
}
Program: 104604
Project: 104604
Buggy source:
/** 
 * Highlights the tab with the given index.
 * @param tabIndex The tab index.
 */
public void highlightTab(int tabIndex){
  if (!paneUI.isTabHighlighted(tabIndex))   this.paneUI.tabAddHightlight(tabIndex);
  this.repaint();
}

Fixed version (ground truth):
/** 
 * Highlights the tab with the given index.
 * @param tabIndex The tab index.
 */
public void highlightTab(int tabIndex){
  if (!paneUI.isTabHighlighted(tabIndex) && this.getSelectedIndex() != tabIndex)   this.paneUI.tabAddHightlight(tabIndex);
  this.repaint();
}
Program: 104605
Project: 104605
Buggy source:
/** 
 * Overrides setSelectedIndex in JTabbedPane in order to remove the  hightlight if the tab which is selected is highlighted.
 */
public void setSelectedIndex(int tabIndex){
  if (paneUI.isTabHighlighted(tabIndex)) {
    paneUI.tabRemoveHighlight(tabIndex);
  }
  super.setSelectedIndex(tabIndex);
}

Fixed version (ground truth):
/** 
 * Overrides setSelectedIndex in JTabbedPane in order to remove the  hightlight if the tab which is selected.
 */
public void setSelectedIndex(int tabIndex){
  if (paneUI.isTabHighlighted(tabIndex)) {
    paneUI.tabRemoveHighlight(tabIndex);
  }
  super.setSelectedIndex(tabIndex);
}
Program: 104606
Project: 104606
Buggy source:
/** 
 * Shows message to the user when message delivery failed.
 */
public void messageDeliveryFailed(MessageDeliveryFailedEvent evt){
}

Fixed version (ground truth):
/** 
 * Shows message to the user when message delivery failed.
 */
public void messageDeliveryFailed(MessageDeliveryFailedEvent evt){
  String msg=Messages.getString("String_Node_Str",evt.getDestinationContact().getDisplayName());
  String title=Messages.getString("String_Node_Str");
  JOptionPane.showMessageDialog(this,msg,title,JOptionPane.WARNING_MESSAGE);
}
Program: 104607
Project: 104607
Buggy source:
public static String getString(String key){
  try {
    return RESOURCE_BUNDLE.getString(key);
  }
 catch (  MissingResourceException e) {
    return '!' + key + '!';
  }
}

Fixed version (ground truth):
public static String getString(String key,String param){
  try {
    String sourceString=RESOURCE_BUNDLE.getString(key);
    return sourceString.replaceAll("String_Node_Str",param);
  }
 catch (  MissingResourceException e) {
    return '!' + key + '!';
  }
}
Program: 104608
Project: 104608
Buggy source:
/** 
 * Indicates that a MetaContactGroup has been added.
 */
public void metaContactGroupAdded(MetaContactGroupEvent evt){
  MetaContactGroup sourceGroup=evt.getSourceMetaContactGroup();
  this.groupAdded(sourceGroup);
}

Fixed version (ground truth):
/** 
 * Indicates that a MetaContactGroup has been added.
 */
public void metaContactGroupAdded(MetaContactGroupEvent evt){
  MetaContactGroup sourceGroup=evt.getSourceMetaContactGroup();
  this.groupAdded(sourceGroup);
  this.ensureIndexIsVisible(this.listModel.getSize() - 1);
}
Program: 104609
Project: 104609
Buggy source:
/** 
 * Refreshes the jlist when a group is added.
 * @param group The group which is added.
 */
private void groupAdded(MetaContactGroup group){
  int index=this.listModel.indexOf(group);
  this.listModel.contentAdded(index,index);
  this.ensureIndexIsVisible(index);
  Iterator childContacts=group.getChildContacts();
  while (childContacts.hasNext()) {
    MetaContact contact=(MetaContact)childContacts.next();
    int contactIndex=this.listModel.indexOf(contact);
    this.listModel.contentAdded(contactIndex,contactIndex);
    this.ensureIndexIsVisible(contactIndex);
  }
  Iterator subGroups=group.getSubgroups();
  while (subGroups.hasNext()) {
    MetaContactGroup subGroup=(MetaContactGroup)subGroups.next();
    this.groupAdded(subGroup);
  }
}

Fixed version (ground truth):
/** 
 * Refreshes the jlist when a group is added.
 * @param group The group which is added.
 */
private void groupAdded(MetaContactGroup group){
  int index=this.listModel.indexOf(group);
  this.listModel.contentAdded(index,index);
  Iterator childContacts=group.getChildContacts();
  while (childContacts.hasNext()) {
    MetaContact contact=(MetaContact)childContacts.next();
    int contactIndex=this.listModel.indexOf(contact);
    this.listModel.contentAdded(contactIndex,contactIndex);
  }
  Iterator subGroups=group.getSubgroups();
  while (subGroups.hasNext()) {
    MetaContactGroup subGroup=(MetaContactGroup)subGroups.next();
    this.groupAdded(subGroup);
  }
}
Program: 104610
Project: 104610
Buggy source:
/** 
 * Indicates that a MetaContactGroup has been added.
 */
public void metaContactGroupAdded(MetaContactGroupEvent evt){
  MetaContactGroup sourceGroup=evt.getSourceMetaContactGroup();
  this.groupAdded(sourceGroup);
  this.ensureIndexIsVisible(this.listModel.getSize() - 1);
}

Fixed version (ground truth):
/** 
 * Indicates that a MetaContactGroup has been added.
 */
public void metaContactGroupAdded(MetaContactGroupEvent evt){
  MetaContactGroup sourceGroup=evt.getSourceMetaContactGroup();
  this.groupAdded(sourceGroup);
  this.ensureIndexIsVisible(0);
}
Program: 104611
Project: 104611
Buggy source:
/** 
 * Delivers a <tt>TypingNotificationEvent</tt> to all registered listeners.
 * @param sourceContact the contact who has sent the notification.
 * @param evtCode the code of the event to deliver.
 */
private void fireTypingNotificationsEvent(Contact sourceContact,int evtCode){
  TypingNotificationEvent evt=new TypingNotificationEvent(sourceContact,evtCode);
synchronized (typingNotificationsListeners) {
    for (int i=0; i < typingNotificationsListeners.size(); i++) {
      ((TypingNotificationsListener)typingNotificationsListeners.get(i)).typingNotificationReceifed(evt);
    }
  }
}

Fixed version (ground truth):
/** 
 * Delivers a <tt>TypingNotificationEvent</tt> to all registered listeners.
 * @param sourceContact the contact who has sent the notification.
 * @param evtCode the code of the event to deliver.
 */
private void fireTypingNotificationsEvent(Contact sourceContact,int evtCode){
  logger.debug("String_Node_Str" + typingNotificationsListeners.size() + "String_Node_Str"+ sourceContact.getAddress()+ "String_Node_Str"+ evtCode);
  TypingNotificationEvent evt=new TypingNotificationEvent(sourceContact,evtCode);
synchronized (typingNotificationsListeners) {
    for (int i=0; i < typingNotificationsListeners.size(); i++) {
      ((TypingNotificationsListener)typingNotificationsListeners.get(i)).typingNotificationReceifed(evt);
    }
  }
}
Program: 104612
Project: 104612
Buggy source:
public void gotTypingState(Conversation conversation,TypingInfo typingInfo){
  Contact sourceContact=opSetPersPresence.findContactByID(conversation.getBuddy().getFormatted());
  if (sourceContact == null) {
    logger.debug("String_Node_Str" + "String_Node_Str" + conversation.getBuddy());
  }
  fireTypingNotificationsEvent(sourceContact,typingStateToInt(typingInfo.getTypingState()));
}

Fixed version (ground truth):
public void gotTypingState(Conversation conversation,TypingInfo typingInfo){
  Contact sourceContact=opSetPersPresence.findContactByID(conversation.getBuddy().getFormatted());
  if (sourceContact == null) {
    logger.debug("String_Node_Str" + "String_Node_Str" + conversation.getBuddy());
    sourceContact=opSetPersPresence.createVolatileContact(conversation.getBuddy());
  }
  fireTypingNotificationsEvent(sourceContact,typingStateToInt(typingInfo.getTypingState()));
}
Program: 104614
Project: 104614
Buggy source:
/** 
 * Load default smilies pack
 * @return the ArrayList of all smilies.
 */
public static ArrayList getDefaultSmiliesPack(){
  ArrayList defaultPackList=new ArrayList();
  defaultPackList.add(new Smily(ImageLoader.SMILY1.getId(),new String[]{"String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY2.getId(),new String[]{"String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY3.getId(),new String[]{"String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY4.getId(),new String[]{"String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY5.getId(),new String[]{"String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY6.getId(),new String[]{"String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY7.getId(),new String[]{"String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY8.getId(),new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY9.getId(),new String[]{"String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY10.getId(),new String[]{"String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY11.getId(),new String[]{"String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY12.getId(),new String[]{"String_Node_Str","String_Node_Str"}));
  return defaultPackList;
}

Fixed version (ground truth):
/** 
 * Load default smilies pack
 * @return the ArrayList of all smilies.
 */
public static ArrayList getDefaultSmiliesPack(){
  ArrayList defaultPackList=new ArrayList();
  defaultPackList.add(new Smily(ImageLoader.SMILY1,new String[]{"String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY2,new String[]{"String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY3,new String[]{"String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY4,new String[]{"String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY5,new String[]{"String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY6,new String[]{"String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY7,new String[]{"String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY8,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY9,new String[]{"String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY10,new String[]{"String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY11,new String[]{"String_Node_Str","String_Node_Str"}));
  defaultPackList.add(new Smily(ImageLoader.SMILY12,new String[]{"String_Node_Str","String_Node_Str"}));
  return defaultPackList;
}
Program: 104615
Project: 104615
Buggy source:
public ImageID getImageID(){
  return imageID;
}

Fixed version (ground truth):
public ImageID getImageID(){
  return this.imageID;
}
Program: 104616
Project: 104616
Buggy source:
public Smily(String imagePath,String[] smilyStrings){
  this.setImageID(imageID);
  this.setSmilyStrings(smilyStrings);
}

Fixed version (ground truth):
public Smily(ImageID imageID,String[] smilyStrings){
  this.imageID=imageID;
  this.setSmilyStrings(smilyStrings);
}
Program: 104617
Project: 104617
Buggy source:
public String getImagePath(){
  return Images.getString(this.imageID.getId());
}

Fixed version (ground truth):
public String getImagePath(){
  return Images.getString(this.getImageID().getId());
}
Program: 104618
Project: 104618
Buggy source:
@Override public Object execute(Object[] parameters){
  ParametersParameterAccessor accessor=new ParametersParameterAccessor(queryMethod.getParameters(),parameters);
  CriteriaQuery query=createQuery(accessor);
  if (queryMethod.isPageQuery()) {
    return elasticsearchOperations.queryForPage(query,queryMethod.getEntityInformation().getJavaType());
  }
  return elasticsearchOperations.queryForObject(query,queryMethod.getEntityInformation().getJavaType());
}

Fixed version (ground truth):
@Override public Object execute(Object[] parameters){
  ParametersParameterAccessor accessor=new ParametersParameterAccessor(queryMethod.getParameters(),parameters);
  CriteriaQuery query=createQuery(accessor);
  if (queryMethod.isPageQuery()) {
    query.setPageable(accessor.getPageable());
    return elasticsearchOperations.queryForPage(query,queryMethod.getEntityInformation().getJavaType());
  }
  return elasticsearchOperations.queryForObject(query,queryMethod.getEntityInformation().getJavaType());
}
Program: 104619
Project: 104619
Buggy source:
@Override public Object execute(Object[] parameters){
  ParametersParameterAccessor accessor=new ParametersParameterAccessor(queryMethod.getParameters(),parameters);
  StringQuery stringQuery=createQuery(accessor);
  if (queryMethod.isPageQuery()) {
    return elasticsearchOperations.queryForPage(stringQuery,queryMethod.getEntityInformation().getJavaType());
  }
  return elasticsearchOperations.queryForObject(stringQuery,queryMethod.getEntityInformation().getJavaType());
}

Fixed version (ground truth):
@Override public Object execute(Object[] parameters){
  ParametersParameterAccessor accessor=new ParametersParameterAccessor(queryMethod.getParameters(),parameters);
  StringQuery stringQuery=createQuery(accessor);
  if (queryMethod.isPageQuery()) {
    stringQuery.setPageable(accessor.getPageable());
    return elasticsearchOperations.queryForPage(stringQuery,queryMethod.getEntityInformation().getJavaType());
  }
  return elasticsearchOperations.queryForObject(stringQuery,queryMethod.getEntityInformation().getJavaType());
}
Program: 104621
Project: 104621
Buggy source:
private SearchRequestBuilder prepareSearch(Query query){
  Assert.notNull(query.getIndices(),"String_Node_Str");
  Assert.notNull(query.getTypes(),"String_Node_Str");
  int startRecord=0;
  SearchRequestBuilder searchRequestBuilder=client.prepareSearch(toArray(query.getIndices())).setSearchType(DFS_QUERY_THEN_FETCH).setTypes(toArray(query.getTypes()));
  if (query.getPageable() != null) {
    startRecord=((query.getPageable().getPageNumber() - 1) * query.getPageable().getPageSize());
    searchRequestBuilder.setSize(query.getPageable().getPageSize());
  }
  searchRequestBuilder.setFrom(startRecord < 0 ? 0 : startRecord);
  if (!query.getFields().isEmpty()) {
    searchRequestBuilder.addFields(toArray(query.getFields()));
  }
  if (query.getSort() != null) {
    for (    Sort.Order order : query.getSort()) {
      searchRequestBuilder.addSort(order.getProperty(),order.getDirection() == Sort.Direction.DESC ? SortOrder.DESC : SortOrder.ASC);
    }
  }
  return searchRequestBuilder;
}

Fixed version (ground truth):
private SearchRequestBuilder prepareSearch(Query query){
  Assert.notNull(query.getIndices(),"String_Node_Str");
  Assert.notNull(query.getTypes(),"String_Node_Str");
  int startRecord=0;
  SearchRequestBuilder searchRequestBuilder=client.prepareSearch(toArray(query.getIndices())).setSearchType(DFS_QUERY_THEN_FETCH).setTypes(toArray(query.getTypes()));
  if (query.getPageable() != null) {
    startRecord=query.getPageable().getPageNumber() * query.getPageable().getPageSize();
    searchRequestBuilder.setSize(query.getPageable().getPageSize());
  }
  searchRequestBuilder.setFrom(startRecord);
  if (!query.getFields().isEmpty()) {
    searchRequestBuilder.addFields(toArray(query.getFields()));
  }
  if (query.getSort() != null) {
    for (    Sort.Order order : query.getSort()) {
      searchRequestBuilder.addSort(order.getProperty(),order.getDirection() == Sort.Direction.DESC ? SortOrder.DESC : SortOrder.ASC);
    }
  }
  return searchRequestBuilder;
}
Program: 104622
Project: 104622
Buggy source:
private SearchRequestBuilder prepareSearch(Query query){
  Assert.notNull(query.getIndices(),"String_Node_Str");
  Assert.notNull(query.getTypes(),"String_Node_Str");
  int startRecord=0;
  SearchRequestBuilder searchRequestBuilder=client.prepareSearch(toArray(query.getIndices())).setSearchType(DFS_QUERY_THEN_FETCH).setTypes(toArray(query.getTypes()));
  if (query.getPageable() != null) {
    startRecord=query.getPageable().getPageNumber() * query.getPageable().getPageSize();
    searchRequestBuilder.setSize(query.getPageable().getPageSize());
  }
  searchRequestBuilder.setFrom(startRecord);
  if (!query.getFields().isEmpty()) {
    searchRequestBuilder.addFields(toArray(query.getFields()));
  }
  if (query.getSort() != null) {
    for (    Sort.Order order : query.getSort()) {
      searchRequestBuilder.addSort(order.getProperty(),order.getDirection() == Sort.Direction.DESC ? SortOrder.DESC : SortOrder.ASC);
    }
  }
  return searchRequestBuilder;
}

Fixed version (ground truth):
private SearchRequestBuilder prepareSearch(Query query){
  Assert.notNull(query.getIndices(),"String_Node_Str");
  Assert.notNull(query.getTypes(),"String_Node_Str");
  int startRecord=0;
  SearchRequestBuilder searchRequestBuilder=client.prepareSearch(toArray(query.getIndices())).setSearchType(DFS_QUERY_THEN_FETCH).setTypes(toArray(query.getTypes()));
  if (query.getPageable() != null) {
    startRecord=((query.getPageable().getPageNumber() - 1) * query.getPageable().getPageSize());
    searchRequestBuilder.setSize(query.getPageable().getPageSize());
  }
  searchRequestBuilder.setFrom(startRecord < 0 ? 0 : startRecord);
  if (!query.getFields().isEmpty()) {
    searchRequestBuilder.addFields(toArray(query.getFields()));
  }
  if (query.getSort() != null) {
    for (    Sort.Order order : query.getSort()) {
      searchRequestBuilder.addSort(order.getProperty(),order.getDirection() == Sort.Direction.DESC ? SortOrder.DESC : SortOrder.ASC);
    }
  }
  return searchRequestBuilder;
}
Program: 104623
Project: 104623
Buggy source:
private IndexRequestBuilder prepareIndex(IndexQuery query){
  try {
    ElasticsearchPersistentEntity persistentEntity=getPersistentEntityFor(query.getObject().getClass());
    IndexRequestBuilder indexRequestBuilder=client.prepareIndex(persistentEntity.getIndexName(),persistentEntity.getIndexType(),query.getId()).setSource(objectMapper.writeValueAsString(query.getObject()));
    if (query.getVersion() != null) {
      indexRequestBuilder.setVersion(query.getVersion());
    }
    return indexRequestBuilder;
  }
 catch (  IOException e) {
    throw new ElasticsearchException("String_Node_Str" + query.getId() + "String_Node_Str",e);
  }
}

Fixed version (ground truth):
private IndexRequestBuilder prepareIndex(IndexQuery query){
  try {
    ElasticsearchPersistentEntity persistentEntity=getPersistentEntityFor(query.getObject().getClass());
    IndexRequestBuilder indexRequestBuilder=client.prepareIndex(persistentEntity.getIndexName(),persistentEntity.getIndexType(),query.getId()).setSource(objectMapper.writeValueAsString(query.getObject()));
    if (query.getVersion() != null) {
      indexRequestBuilder.setVersion(query.getVersion());
      indexRequestBuilder.setVersionType(EXTERNAL);
    }
    return indexRequestBuilder;
  }
 catch (  IOException e) {
    throw new ElasticsearchException("String_Node_Str" + query.getId() + "String_Node_Str",e);
  }
}
Program: 104624
Project: 104624
Buggy source:
public SimpleElasticsearchRepository(ElasticsearchEntityInformation<T,String> metadata,ElasticsearchOperations elasticsearchOperations){
  this(elasticsearchOperations);
  Assert.notNull(metadata);
  this.entityInformation=metadata;
  setEntityClass(this.entityInformation.getJavaType());
}

Fixed version (ground truth):
public SimpleElasticsearchRepository(ElasticsearchEntityInformation<T,String> metadata,ElasticsearchOperations elasticsearchOperations){
  this(elasticsearchOperations);
  Assert.notNull(metadata);
  this.entityInformation=metadata;
  setEntityClass(this.entityInformation.getJavaType());
  createIndex();
}
Program: 104625
Project: 104625
Buggy source:
@PostConstruct public void createIndex(){
  elasticsearchOperations.createIndex(getEntityClass());
}

Fixed version (ground truth):
private void createIndex(){
  elasticsearchOperations.createIndex(getEntityClass());
}
Program: 104626
Project: 104626
Buggy source:
@Test public void shouldDoBulkIndexDocument(){
  String documentId=randomNumeric(5);
  SampleEntity sampleEntity1=new SampleEntity();
  sampleEntity1.setId(documentId);
  sampleEntity1.setMessage("String_Node_Str");
  SampleEntity sampleEntity2=new SampleEntity();
  sampleEntity2.setId(documentId);
  sampleEntity2.setMessage("String_Node_Str");
  repository.save(Arrays.asList(sampleEntity1,sampleEntity2));
  SampleEntity entityFromElasticSearch=repository.findOne(documentId);
  assertThat(entityFromElasticSearch,is(notNullValue()));
}

Fixed version (ground truth):
@Test public void shouldDoBulkIndexDocument(){
  String documentId1=randomNumeric(5);
  SampleEntity sampleEntity1=new SampleEntity();
  sampleEntity1.setId(documentId1);
  sampleEntity1.setMessage("String_Node_Str");
  sampleEntity1.setVersion(System.currentTimeMillis());
  String documentId2=randomNumeric(5);
  SampleEntity sampleEntity2=new SampleEntity();
  sampleEntity2.setId(documentId2);
  sampleEntity2.setMessage("String_Node_Str");
  sampleEntity2.setVersion(System.currentTimeMillis());
  repository.save(Arrays.asList(sampleEntity1,sampleEntity2));
  SampleEntity entity1FromElasticSearch=repository.findOne(documentId1);
  assertThat(entity1FromElasticSearch,is(notNullValue()));
  SampleEntity entity2FromElasticSearch=repository.findOne(documentId2);
  assertThat(entity2FromElasticSearch,is(notNullValue()));
}