nus-yam/ex-repair huggingface dataset:
Program: 4040
Project: 4040
Buggy source:
private void configureList(EventList<VisualSearchResult> eventList){
  resultsList=new ConfigurableTable<VisualSearchResult>(false);
  resultsList.setEventList(eventList);
  resultsList.setTableFormat(new ListViewTableFormat());
  ListViewTableCellEditor renderer=new ListViewTableCellEditor(actionRenderer);
  resultsList.setDefaultRenderer(VisualSearchResult.class,renderer);
  ListViewTableCellEditor editor=new ListViewTableCellEditor(actionEditor);
  resultsList.setDefaultEditor(VisualSearchResult.class,editor);
  resultsList.setRowHeight(ListViewTableCellEditor.HEIGHT);
  resultsList.setColumnWidth(0,ListViewTableCellEditor.WIDTH);
  resultsList.setRowHeight(42);
}

Fixed version (ground truth):
private void configureList(final EventList<VisualSearchResult> eventList){
  resultsList=new ConfigurableTable<VisualSearchResult>(false);
  resultsList.setEventList(eventList);
  ListViewTableFormat tableFormat=new ListViewTableFormat();
  resultsList.setTableFormat(tableFormat);
  ListViewTableCellEditor renderer=new ListViewTableCellEditor(actionRenderer);
  resultsList.setDefaultRenderer(VisualSearchResult.class,renderer);
  ListViewTableCellEditor editor=new ListViewTableCellEditor(actionEditor);
  resultsList.setDefaultEditor(VisualSearchResult.class,editor);
  int columnIndex=0;
  resultsList.setColumnWidth(columnIndex,tableFormat.getInitialColumnWidth(columnIndex));
  resultsList.setRowHeight(ListViewTableCellEditor.HEIGHT);
  resultsList.addMouseListener(new MouseAdapter(){
    @Override public void mousePressed(    MouseEvent e){
      if (e.getButton() == 3) {
        int row=resultsList.rowAtPoint(e.getPoint());
        VisualSearchResult vsr=eventList.get(row);
        JComponent component=(JComponent)e.getSource();
        Window window=(Window)component.getTopLevelAncestor();
        SearchResultMenu menu=new SearchResultMenu(window,vsr);
        menu.show(component,e.getX(),e.getY());
      }
    }
  }
);
}
Program: 4041
Project: 4041
Buggy source:
public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column){
  JPanel panel=(JPanel)getTableCellEditorComponent(table,value,isSelected,row,column);
  return panel;
}

Fixed version (ground truth):
public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column){
  return (JPanel)getTableCellEditorComponent(table,value,isSelected,row,column);
}
Program: 4042
Project: 4042
Buggy source:
private JPanel makePanel(){
  JPanel panel=new JPanel(new GridBagLayout()){
    @Override public void setBackground(    Color bg){
      super.setBackground(bg);
      if (actionComponent != null) {
        actionComponent.setBackground(bg);
      }
    }
  }
;
  panel.setPreferredSize(new Dimension(WIDTH,HEIGHT));
  GridBagConstraints gbc=new GridBagConstraints();
  gbc.anchor=GridBagConstraints.WEST;
  gbc.weightx=0;
  panel.add(makeLeftPanel(),gbc);
  gbc.anchor=GridBagConstraints.EAST;
  gbc.weightx=1;
  panel.add(makeCenterPanel(),gbc);
  gbc.weightx=0;
  actionPanel.setOpaque(false);
  panel.add(actionPanel,gbc);
  panel.addMouseListener(new MouseAdapter(){
    @Override public void mousePressed(    MouseEvent e){
      if (e.getButton() == 3) {
        JComponent component=(JComponent)e.getSource();
        Window window=(Window)component.getTopLevelAncestor();
        SearchResultMenu menu=new SearchResultMenu(window,vsr);
        menu.show(component,e.getX(),e.getY());
      }
    }
  }
);
  return panel;
}

Fixed version (ground truth):
private JPanel makePanel(){
  final JPanel panel=new JPanel(new GridBagLayout()){
    @Override public void setBackground(    Color bg){
      super.setBackground(bg);
      if (actionComponent != null) {
        actionComponent.setBackground(bg);
      }
    }
  }
;
  panel.setPreferredSize(new Dimension(WIDTH,HEIGHT));
  GridBagConstraints gbc=new GridBagConstraints();
  gbc.anchor=GridBagConstraints.WEST;
  gbc.weightx=0;
  panel.add(makeLeftPanel(),gbc);
  gbc.anchor=GridBagConstraints.EAST;
  gbc.weightx=1;
  panel.add(makeCenterPanel(),gbc);
  gbc.weightx=0;
  actionPanel.setOpaque(false);
  panel.add(actionPanel,gbc);
  return panel;
}
Program: 4043
Project: 4043
Buggy source:
public Component getTableCellEditorComponent(JTable table,Object value,boolean isSelected,int row,int column){
  vsr=(VisualSearchResult)value;
  MediaType mediaType=MediaType.getMediaTypeForExtension(vsr.getFileExtension());
  schema=mediaType == null ? "String_Node_Str" : mediaType.toString();
  similarCount=vsr.getSimiliarResults().size();
  if (thePanel == null)   thePanel=makePanel();
  actionComponent=actionEditor.getTableCellEditorComponent(table,value,isSelected,row,column);
  actionPanel.removeAll();
  actionPanel.add(actionComponent);
  populatePanel((VisualSearchResult)value);
  setBackground(isSelected);
  return thePanel;
}

Fixed version (ground truth):
public Component getTableCellEditorComponent(JTable table,Object value,boolean isSelected,int row,int column){
  this.table=table;
  this.row=row;
  vsr=(VisualSearchResult)value;
  MediaType mediaType=MediaType.getMediaTypeForExtension(vsr.getFileExtension());
  schema=mediaType == null ? "String_Node_Str" : mediaType.toString();
  similarCount=vsr.getSimiliarResults().size();
  if (thePanel == null)   thePanel=makePanel();
  actionComponent=actionEditor.getTableCellEditorComponent(table,value,isSelected,row,column);
  actionPanel.removeAll();
  actionPanel.add(actionComponent);
  populatePanel((VisualSearchResult)value);
  setBackground(isSelected);
  return thePanel;
}
Program: 4044
Project: 4044
Buggy source:
private void setBackground(boolean isSelected){
  if (thePanel == null)   return;
  Color color=isSelected ? new Color(220,220,255) : Color.WHITE;
  thePanel.setBackground(color);
  int childCount=thePanel.getComponentCount();
  for (int i=0; i < childCount; i++) {
    Component child=thePanel.getComponent(i);
    child.setBackground(color);
  }
}

Fixed version (ground truth):
private void setBackground(boolean isSelected){
  if (thePanel == null)   return;
  Color color=isSelected ? SELECTED_COLOR : Color.WHITE;
  thePanel.setBackground(color);
  int childCount=thePanel.getComponentCount();
  for (int i=0; i < childCount; i++) {
    Component child=thePanel.getComponent(i);
    child.setBackground(color);
  }
}
Program: 4045
Project: 4045
Buggy source:
@Override public int getInitialColumnWidth(int index){
  return 100;
}

Fixed version (ground truth):
@Override public int getInitialColumnWidth(int index){
  return ListViewTableCellEditor.WIDTH;
}
Program: 4046
Project: 4046
Buggy source:
private void changeState(TabState tabState){
  if (currentState != tabState) {
    this.currentState=tabState;
switch (tabState) {
case SELECTED:
      FontUtils.removeUnderline(mainButton);
    FontUtils.removeUnderline(additionalText);
  mainButton.setForeground(props.getSelectionColor());
additionalText.setForeground(props.getSelectionColor());
this.setBackgroundPainter(props.getSelectedPainter());
removeButton.setIcon(removeSelectedIcon);
break;
case BACKGROUND:
FontUtils.underline(mainButton);
FontUtils.underline(additionalText);
mainButton.setForeground(props.getNormalColor());
additionalText.setForeground(props.getNormalColor());
this.setBackgroundPainter(props.getNormalPainter());
removeButton.setIcon(removeBackgroundIcon);
break;
case ROLLOVER:
setBackgroundPainter(props.getHighlightPainter());
removeButton.setIcon(removeSelectedIcon);
break;
}
}
}

Fixed version (ground truth):
private void changeState(TabState tabState){
  if (currentState != tabState) {
    this.currentState=tabState;
switch (tabState) {
case SELECTED:
      FontUtils.removeUnderline(mainButton);
    FontUtils.removeUnderline(additionalText);
  mainButton.setForeground(props.getSelectionColor());
additionalText.setForeground(props.getSelectionColor());
this.setBackgroundPainter(props.getSelectedPainter());
removeButton.setIcon(removeSelectedIcon);
break;
case BACKGROUND:
underline();
mainButton.setForeground(props.getNormalColor());
additionalText.setForeground(props.getNormalColor());
this.setBackgroundPainter(props.getNormalPainter());
removeButton.setIcon(removeBackgroundIcon);
break;
case ROLLOVER:
setBackgroundPainter(props.getHighlightPainter());
removeButton.setIcon(removeSelectedIcon);
break;
}
}
}
Program: 4047
Project: 4047
Buggy source:
public void listChanged(ListEvent event){
  EventList list=event.getSourceList();
  VisualSearchResult vsr=(VisualSearchResult)list.get(list.size() - 1);
  String extension=vsr.getFileExtension();
  MediaType mediaType=MediaType.getMediaTypeForExtension(extension);
  String schema=mediaType == null ? "String_Node_Str" : mediaType.toString();
  String title=schemaToTitleMap.get(schema);
  if (!isAll) {
    if (title.endsWith("String_Node_Str")) {
      title=title.substring(0,title.length() - 1);
    }
    title+="String_Node_Str";
  }
  FancyTab tab=getTab(title);
  if (tab == null) {
    System.err.println("String_Node_Str" + title + '"');
  }
 else {
    tab.setVisible(true);
  }
}

Fixed version (ground truth):
public void listChanged(ListEvent event){
  EventList list=event.getSourceList();
  VisualSearchResult vsr=(VisualSearchResult)list.get(list.size() - 1);
  String extension=vsr.getFileExtension();
  MediaType mediaType=MediaType.getMediaTypeForExtension(extension);
  String schema=mediaType == null ? "String_Node_Str" : mediaType.toString();
  String title=schemaToTitleMap.get(schema);
  if (!isAll) {
    if (title.endsWith("String_Node_Str")) {
      title=title.substring(0,title.length() - 1);
    }
    title+="String_Node_Str";
  }
  FancyTab tab=getTab(title);
  if (tab == null) {
    System.err.println("String_Node_Str" + title + '"');
  }
 else {
    tab.underline();
    tab.setVisible(true);
  }
}
Program: 4048
Project: 4048
Buggy source:
private void configureList(final EventList<VisualSearchResult> eventList){
  resultsList=new ConfigurableTable<VisualSearchResult>(false);
  resultsList.setEventList(eventList);
  ListViewTableFormat tableFormat=new ListViewTableFormat();
  resultsList.setTableFormat(tableFormat);
  ListViewTableCellEditor renderer=new ListViewTableCellEditor(actionRenderer);
  resultsList.setDefaultRenderer(VisualSearchResult.class,renderer);
  ListViewTableCellEditor editor=new ListViewTableCellEditor(actionEditor);
  resultsList.setDefaultEditor(VisualSearchResult.class,editor);
  int columnIndex=0;
  resultsList.setColumnWidth(columnIndex,tableFormat.getInitialColumnWidth(columnIndex));
  resultsList.setRowHeight(ListViewTableCellEditor.HEIGHT);
  resultsList.addMouseListener(new MouseAdapter(){
    @Override public void mousePressed(    MouseEvent e){
      if (e.getButton() == 3) {
        int row=resultsList.rowAtPoint(e.getPoint());
        VisualSearchResult vsr=eventList.get(row);
        JComponent component=(JComponent)e.getSource();
        Window window=(Window)component.getTopLevelAncestor();
        SearchResultMenu menu=new SearchResultMenu(window,vsr);
        menu.show(component,e.getX(),e.getY());
      }
    }
  }
);
}

Fixed version (ground truth):
private void configureList(final EventList<VisualSearchResult> eventList){
  resultsList=new ConfigurableTable<VisualSearchResult>(false){
  }
;
  resultsList.setEventList(eventList);
  ListViewTableFormat tableFormat=new ListViewTableFormat();
  resultsList.setTableFormat(tableFormat);
  ListViewTableCellEditor renderer=new ListViewTableCellEditor(actionRenderer);
  resultsList.setDefaultRenderer(VisualSearchResult.class,renderer);
  ListViewTableCellEditor editor=new ListViewTableCellEditor(actionEditor);
  resultsList.setDefaultEditor(VisualSearchResult.class,editor);
  int columnIndex=0;
  resultsList.setColumnWidth(columnIndex,tableFormat.getInitialColumnWidth(columnIndex));
  resultsList.setRowHeight(ListViewTableCellEditor.HEIGHT);
  resultsList.addMouseListener(new MouseAdapter(){
    @Override public void mousePressed(    MouseEvent e){
      if (e.getButton() == 3) {
        int row=resultsList.rowAtPoint(e.getPoint());
        VisualSearchResult vsr=eventList.get(row);
        JComponent component=(JComponent)e.getSource();
        Window window=(Window)component.getTopLevelAncestor();
        SearchResultMenu menu=new SearchResultMenu(window,vsr);
        menu.show(component,e.getX(),e.getY());
      }
    }
  }
);
}
Program: 4049
Project: 4049
Buggy source:
@EventSubscriber public void handleAddConversation(ConversationStartedEvent event){
  Friend friend=event.getFriend();
  LOG.debugf("String_Node_Str",friend.getName());
  ConversationPane chatPane=chats.get(friend.getName());
  if (chatPane == null) {
    chatPane=conversationFactory.create(event.getWriter(),friend);
    chats.put(friend.getName(),chatPane);
  }
  if (conversationPanel.getComponent(0) != chatPane && event.isLocallyInitiated()) {
    setConversationPanel(chatPane);
  }
  chatPane.handleDisplay();
  event.unlock();
  LOG.debug("String_Node_Str");
}

Fixed version (ground truth):
@EventSubscriber public void handleAddConversation(ConversationStartedEvent event){
  Friend friend=event.getFriend();
  LOG.debugf("String_Node_Str",friend.getName());
  ConversationPane chatPane=chats.get(friend.getID());
  if (chatPane == null) {
    chatPane=conversationFactory.create(event.getWriter(),friend);
    chats.put(friend.getID(),chatPane);
  }
  if (conversationPanel.getComponent(0) != chatPane && event.isLocallyInitiated()) {
    setConversationPanel(chatPane);
  }
  chatPane.handleDisplay();
  event.unlock();
  LOG.debug("String_Node_Str");
}
Program: 4050
Project: 4050
Buggy source:
@EventSubscriber public void handleCloseChat(CloseChatEvent event){
  closeChat(event.getFriend().getName());
  setConversationPanel(new JPanel());
}

Fixed version (ground truth):
@EventSubscriber public void handleCloseChat(CloseChatEvent event){
  closeChat(event.getFriend().getID());
  setConversationPanel(new JPanel());
}
Program: 4051
Project: 4051
Buggy source:
@Override public void removeSelectedBuddy(){
  Friend selectedFriend=getSelectedFriend();
  if (selectedFriend != null) {
    new RemoveBuddyEvent(selectedFriend).publish();
  }
}

Fixed version (ground truth):
@Override public void removeSelectedBuddy(){
  removeBuddy(getSelectedFriend());
}
Program: 4052
Project: 4052
Buggy source:
@EventSubscriber public void handlePresenceUpdate(PresenceUpdateEvent event){
  LOG.debugf("String_Node_Str",event.getPresence().getJID(),event.getPresence().getType());
  final Presence presence=event.getPresence();
  FriendImpl friend=idToFriendMap.get(presence.getJID());
switch (presence.getType()) {
case available:
    if (friend == null) {
      final FriendImpl newFriend=new FriendImpl(event.getUser(),presence);
      presence.setIncomingChatListener(new IncomingChatListener(){
        public MessageReader incomingChat(        MessageWriter writer){
          LOG.debugf("String_Node_Str",presence.getJID());
          MessageWriter writerWrapper=new MessageWriterImpl(myID,newFriend,writer);
          ConversationStartedEvent event=new ConversationStartedEvent(newFriend,writerWrapper,false);
          event.publish();
          event.await();
          return new MessageReaderImpl(newFriend);
        }
      }
);
      friend=newFriend;
      friends.add(friend);
      idToFriendMap.put(presence.getJID(),friend);
    }
  friend.setStatus(presence.getStatus());
friend.setMode(presence.getMode());
break;
case unavailable:
if (friend != null) {
friends.remove(idToFriendMap.remove(presence.getJID()));
}
break;
}
friendsCountUpdater.setFriendsCount(friends.size());
}

Fixed version (ground truth):
@EventSubscriber public void handlePresenceUpdate(PresenceUpdateEvent event){
  LOG.debugf("String_Node_Str",event.getPresence().getJID(),event.getPresence().getType());
  final Presence presence=event.getPresence();
  final User user=event.getUser();
  FriendImpl friend=idToFriendMap.get(user.getId());
switch (presence.getType()) {
case available:
    if (friend == null) {
      final FriendImpl newFriend=new FriendImpl(user,presence);
      presence.setIncomingChatListener(new IncomingChatListener(){
        public MessageReader incomingChat(        MessageWriter writer){
          LOG.debugf("String_Node_Str",presence.getJID());
          MessageWriter writerWrapper=new MessageWriterImpl(myID,newFriend,writer);
          ConversationStartedEvent event=new ConversationStartedEvent(newFriend,writerWrapper,false);
          event.publish();
          event.await();
          return new MessageReaderImpl(newFriend);
        }
      }
);
      friend=newFriend;
      friends.add(friend);
      idToFriendMap.put(user.getId(),friend);
    }
  friend.setStatus(presence.getStatus());
friend.setMode(presence.getMode());
break;
case unavailable:
if (friend != null) {
friends.remove(idToFriendMap.remove(user.getId()));
}
break;
}
friendsCountUpdater.setFriendsCount(friends.size());
}
Program: 4054
Project: 4054
Buggy source:
/** 
 * This method splits the given Bucket into two new Buckets. There are a few conditions in which cases we do split and in which cases we don't.
 */
protected synchronized boolean split(Bucket bucket){
  boolean containsLocalNode=bucket.contains(getLocalNode().getNodeID());
  if (containsLocalNode || bucket.isInSmallestSubtree() || !bucket.isTooDeep()) {
    if (LOG.isTraceEnabled()) {
      LOG.trace("String_Node_Str" + bucket);
    }
    List<Bucket> buckets=bucket.split();
    assert(buckets.size() == 2);
    Bucket left=buckets.get(0);
    Bucket right=buckets.get(1);
    Bucket oldLeft=bucketTrie.put(left.getBucketID(),left);
    assert(oldLeft == bucket);
    Bucket oldRight=bucketTrie.put(right.getBucketID(),right);
    assert(oldRight == null);
    fireSplitBucket(bucket,left,right);
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * This method splits the given Bucket into two new Buckets. There are a few conditions in which cases we do split and in which cases we don't.
 */
protected synchronized boolean split(Bucket bucket){
  if (canSplit(bucket)) {
    if (LOG.isTraceEnabled()) {
      LOG.trace("String_Node_Str" + bucket);
    }
    List<Bucket> buckets=bucket.split();
    assert(buckets.size() == 2);
    Bucket left=buckets.get(0);
    Bucket right=buckets.get(1);
    Bucket oldLeft=bucketTrie.put(left.getBucketID(),left);
    assert(oldLeft == bucket);
    Bucket oldRight=bucketTrie.put(right.getBucketID(),right);
    assert(oldRight == null);
    fireSplitBucket(bucket,left,right);
    return true;
  }
  return false;
}
Program: 4055
Project: 4055
Buggy source:
public synchronized void add(Contact node){
  if (localNode.equals(node)) {
    String msg="String_Node_Str" + node;
    if (LOG.isErrorEnabled()) {
      LOG.error(msg);
    }
    ErrorService.error(new IllegalArgumentException(msg));
    return;
  }
  if (node.isFirewalled()) {
    if (LOG.isTraceEnabled()) {
      LOG.trace(node + "String_Node_Str");
    }
    return;
  }
  if (!ContactUtils.isSameAddressSpace(localNode,node)) {
    if (LOG.isErrorEnabled()) {
      LOG.error(node + "String_Node_Str" + localNode);
    }
    return;
  }
  consecutiveFailures=0;
  KUID nodeId=node.getNodeID();
  Bucket bucket=bucketTrie.select(nodeId);
  Contact existing=bucket.get(nodeId);
  if (existing != null) {
    updateContactInBucket(bucket,existing,node);
  }
 else   if (!bucket.isActiveFull()) {
    if (isOkayToAdd(bucket,node)) {
      addContactToBucket(bucket,node);
    }
 else {
      addContactToBucketCache(bucket,node);
    }
  }
 else   if (split(bucket)) {
    add(node);
  }
 else {
    replaceContactInBucket(bucket,node);
  }
}

Fixed version (ground truth):
public synchronized void add(Contact node){
  if (localNode.equals(node)) {
    String msg="String_Node_Str" + node;
    if (LOG.isErrorEnabled()) {
      LOG.error(msg);
    }
    ErrorService.error(new IllegalArgumentException(msg));
    return;
  }
  if (node.isFirewalled()) {
    if (LOG.isTraceEnabled()) {
      LOG.trace(node + "String_Node_Str");
    }
    return;
  }
  if (!ContactUtils.isSameAddressSpace(localNode,node)) {
    if (LOG.isErrorEnabled()) {
      LOG.error(node + "String_Node_Str" + localNode);
    }
    return;
  }
  consecutiveFailures=0;
  KUID nodeId=node.getNodeID();
  Bucket bucket=bucketTrie.select(nodeId);
  Contact existing=bucket.get(nodeId);
  if (existing != null) {
    updateContactInBucket(bucket,existing,node);
  }
 else   if (!bucket.isActiveFull()) {
    if (isOkayToAdd(bucket,node)) {
      addContactToBucket(bucket,node);
    }
 else {
      if (!canSplit(bucket)) {
        addContactToBucketCache(bucket,node);
      }
    }
  }
 else   if (split(bucket)) {
    add(node);
  }
 else {
    replaceContactInBucket(bucket,node);
  }
}
Program: 4057
Project: 4057
Buggy source:
public void testUpdateUptimeHistory(){
  RefreshTimer refreshTimer=new RefreshTimer();
  StringArraySetting uptimeHistory=ApplicationSettings.LAST_N_UPTIMES;
  assertEquals(new String[0],uptimeHistory.getValue());
  for (int i=0; i < 5; i++) {
    refreshTimer.updateUptimeHistory(i,10,10);
    assertEquals(new String[0],uptimeHistory.getValue());
  }
  refreshTimer.updateUptimeHistory(10,10,2);
  assertEquals(new String[]{"String_Node_Str"},uptimeHistory.getValue());
  refreshTimer.updateUptimeHistory(20,10,2);
  assertEquals(new String[]{"String_Node_Str"},uptimeHistory.getValue());
  refreshTimer.updateUptimeHistory(10,10,2);
  assertEquals(new String[]{"String_Node_Str","String_Node_Str"},uptimeHistory.getValue());
  refreshTimer.updateUptimeHistory(10,10,2);
  assertEquals(new String[]{"String_Node_Str","String_Node_Str"},uptimeHistory.getValue());
  refreshTimer.updateUptimeHistory(30,10,2);
  assertEquals(new String[]{"String_Node_Str","String_Node_Str"},uptimeHistory.getValue());
  refreshTimer.updateUptimeHistory(10,10,1);
  assertEquals(new String[]{"String_Node_Str"},uptimeHistory.getValue());
  refreshTimer.updateUptimeHistory(20,10,1);
  assertEquals(new String[]{"String_Node_Str"},uptimeHistory.getValue());
  refreshTimer.updateUptimeHistory(30,10,2);
  assertEquals(new String[]{"String_Node_Str"},uptimeHistory.getValue());
}

Fixed version (ground truth):
public void testUpdateUptimeHistory(){
  RefreshTimer refreshTimer=new RefreshTimer();
  StringArraySetting uptimeHistory=ApplicationSettings.LAST_N_UPTIMES;
  assertEquals(new String[0],uptimeHistory.getValue());
  for (int i=0; i < 5; i++) {
    refreshTimer.updateUptimeHistory(i,10,10);
    assertEquals(new String[0],uptimeHistory.getValue());
  }
  refreshTimer.updateUptimeHistory(10,10,2);
  assertEquals(new String[]{"String_Node_Str"},uptimeHistory.getValue());
  refreshTimer.updateUptimeHistory(20,10,2);
  assertEquals(new String[]{"String_Node_Str"},uptimeHistory.getValue());
  refreshTimer=new RefreshTimer();
  refreshTimer.updateUptimeHistory(10,10,2);
  assertEquals(new String[]{"String_Node_Str","String_Node_Str"},uptimeHistory.getValue());
  refreshTimer=new RefreshTimer();
  refreshTimer.updateUptimeHistory(10,10,2);
  assertEquals(new String[]{"String_Node_Str","String_Node_Str"},uptimeHistory.getValue());
  refreshTimer.updateUptimeHistory(30,10,2);
  assertEquals(new String[]{"String_Node_Str","String_Node_Str"},uptimeHistory.getValue());
  refreshTimer=new RefreshTimer();
  refreshTimer.updateUptimeHistory(10,10,1);
  assertEquals(new String[]{"String_Node_Str"},uptimeHistory.getValue());
  refreshTimer.updateUptimeHistory(20,10,1);
  assertEquals(new String[]{"String_Node_Str"},uptimeHistory.getValue());
  refreshTimer.updateUptimeHistory(30,10,2);
  assertEquals(new String[]{"String_Node_Str"},uptimeHistory.getValue());
}
Program: 4058
Project: 4058
Buggy source:
JLabel createAdditionalText(){
  final JLabel label=new JLabel();
  label.setVisible(false);
  if (tabActions.getMoreTextAction() != null) {
    label.setOpaque(false);
    label.setFont(props.getTextFont());
    String name=(String)tabActions.getMoreTextAction().getValue(Action.NAME);
    if (name != null) {
      label.setText("String_Node_Str" + name + "String_Node_Str");
      label.setVisible(true);
    }
    tabActions.getMoreTextAction().addPropertyChangeListener(new PropertyChangeListener(){
      @Override public void propertyChange(      PropertyChangeEvent evt){
        if (evt.getPropertyName().equals(Action.NAME)) {
          label.setText("String_Node_Str" + (String)evt.getNewValue() + "String_Node_Str");
          label.setVisible(true);
        }
      }
    }
);
  }
  return label;
}

Fixed version (ground truth):
JLabel createAdditionalText(){
  final JLabel label=new JLabel();
  label.setVisible(false);
  if (tabActions.getMoreTextAction() != null) {
    label.setOpaque(false);
    label.setFont(mainButton.getFont());
    String name=(String)tabActions.getMoreTextAction().getValue(Action.NAME);
    if (name != null) {
      label.setText("String_Node_Str" + name + "String_Node_Str");
      label.setVisible(true);
    }
    tabActions.getMoreTextAction().addPropertyChangeListener(new PropertyChangeListener(){
      @Override public void propertyChange(      PropertyChangeEvent evt){
        if (evt.getPropertyName().equals(Action.NAME)) {
          label.setText("String_Node_Str" + (String)evt.getNewValue() + "String_Node_Str");
          label.setVisible(true);
        }
      }
    }
);
  }
  return label;
}
Program: 4059
Project: 4059
Buggy source:
SearchTabItems(SearchCategory category,SearchTabListener listener){
  this.listener=listener;
  this.searchTabs=new ArrayList<SearchTabAction>();
  searchTabs.add(new SearchTabAction("String_Node_Str",SearchCategory.ALL));
  searchTabs.add(new SearchTabAction("String_Node_Str",SearchCategory.AUDIO));
  searchTabs.add(new SearchTabAction("String_Node_Str",SearchCategory.VIDEO));
  searchTabs.add(new SearchTabAction("String_Node_Str",SearchCategory.IMAGES));
  searchTabs.add(new SearchTabAction("String_Node_Str",SearchCategory.DOCUMENTS));
  for (  SearchTabAction action : searchTabs) {
    if (category == action.getCategory()) {
      action.putValue(Action.SELECTED_KEY,true);
      listener.categorySelected(category);
    }
 else     if (category != SearchCategory.ALL) {
      action.setEnabled(false);
    }
  }
  setLayout(new GridBagLayout());
  setBackground(Color.LIGHT_GRAY);
  GridBagConstraints gbc=new GridBagConstraints();
  gbc.gridwidth=GridBagConstraints.RELATIVE;
  FancyTabList ttp=new FancyTabList(TabActionMap.createMapForMainActions(searchTabs));
  ttp.setFlowedLayout(new Insets(0,2,0,5));
  ttp.setHighlightPainter(new RectanglePainter<JXButton>(2,2,0,2,5,5,true,Color.WHITE,0f,Color.WHITE));
  add(ttp,gbc);
  gbc.gridwidth=GridBagConstraints.REMAINDER;
  gbc.weightx=1;
  add(Box.createGlue(),gbc);
}

Fixed version (ground truth):
SearchTabItems(SearchCategory category,SearchTabListener listener){
  this.listener=listener;
  this.searchTabs=new ArrayList<TabActionMap>();
  searchTabs.add(newTabActionMap(new SearchTabAction("String_Node_Str",SearchCategory.ALL)));
  searchTabs.add(newTabActionMap(new SearchTabAction("String_Node_Str",SearchCategory.AUDIO)));
  searchTabs.add(newTabActionMap(new SearchTabAction("String_Node_Str",SearchCategory.VIDEO)));
  searchTabs.add(newTabActionMap(new SearchTabAction("String_Node_Str",SearchCategory.IMAGES)));
  searchTabs.add(newTabActionMap(new SearchTabAction("String_Node_Str",SearchCategory.DOCUMENTS)));
  for (  TabActionMap map : searchTabs) {
    SearchTabAction action=(SearchTabAction)map.getMainAction();
    if (category == action.getCategory()) {
      action.putValue(Action.SELECTED_KEY,true);
      listener.categorySelected(category);
    }
 else     if (category != SearchCategory.ALL) {
      action.setEnabled(false);
    }
  }
  setLayout(new GridBagLayout());
  setBackground(Color.LIGHT_GRAY);
  GridBagConstraints gbc=new GridBagConstraints();
  gbc.gridwidth=GridBagConstraints.RELATIVE;
  FancyTabList ttp=new FancyTabList(searchTabs);
  ttp.setFlowedLayout(new Insets(0,2,0,5));
  ttp.setHighlightPainter(new RectanglePainter<JXButton>(2,2,0,2,5,5,true,Color.WHITE,0f,Color.WHITE));
  add(ttp,gbc);
  gbc.gridwidth=GridBagConstraints.REMAINDER;
  gbc.weightx=1;
  add(Box.createGlue(),gbc);
}
Program: 4060
Project: 4060
Buggy source:
private void updateStriping(){
  int length=0;
  for (  DownloadTable table : tables) {
    if (table.getRowCount() > 0 && table.isVisible()) {
      if (length % 2 == 0) {
        table.setHighlighters(evenTableHighlighter);
      }
 else {
        table.setHighlighters(oddTableHighlighter);
      }
      table.addMenuRowHighlighter();
      length+=table.getRowCount();
    }
  }
}

Fixed version (ground truth):
private void updateStriping(){
  int length=0;
  for (  DownloadTable table : tables) {
    if (table.getRowCount() > 0 && table.isVisible()) {
      if (length % 2 == 0) {
        table.setHighlighters(evenTableHighlighter);
      }
 else {
        table.setHighlighters(oddTableHighlighter);
      }
      length+=table.getRowCount();
    }
  }
}
Program: 4061
Project: 4061
Buggy source:
@Override public Component prepareEditor(TableCellEditor editor,int row,int column){
  Component comp=super.prepareEditor(editor,row,column);
  ComponentAdapter adapter=getComponentAdapter(row,column);
  if (compoundHighlighter != null) {
    comp=compoundHighlighter.highlight(comp,adapter);
  }
  return comp;
}

Fixed version (ground truth):
@Override public Component prepareEditor(TableCellEditor editor,int row,int column){
  Component comp=super.prepareEditor(editor,row,column);
  ComponentAdapter adapter=getComponentAdapter(row,column);
  if (compoundHighlighter != null) {
    comp=compoundHighlighter.highlight(comp,adapter);
  }
  adjustMenuShowingColor(comp,(DownloadItem)getValueAt(row,column));
  return comp;
}
Program: 4063
Project: 4063
Buggy source:
private void update(){
  downloadItems.getReadWriteLock().readLock().lock();
  try {
    for (    DownloadItem item : downloadItems) {
      if (item instanceof CoreDownloadItem)       ((CoreDownloadItem)item).fireDataChanged();
    }
  }
  finally {
    downloadItems.getReadWriteLock().readLock().unlock();
  }
}

Fixed version (ground truth):
private void update(){
}
Program: 4064
Project: 4064
Buggy source:
@Override public void handleEvent(DownloadStatusEvent event){
  support.firePropertyChange("String_Node_Str",null,getState());
}

Fixed version (ground truth):
@Override public void handleEvent(DownloadStatusEvent event){
  fireDataChanged();
}
Program: 4065
Project: 4065
Buggy source:
public CoreDownloadItem(Downloader downloader,QueueTimeCalculator queueTimeCalculator){
  this.downloader=downloader;
  this.queueTimeCalculator=queueTimeCalculator;
  downloader.addListener(new EventListener<DownloadStatusEvent>(){
    @Override public void handleEvent(    DownloadStatusEvent event){
      support.firePropertyChange("String_Node_Str",null,getState());
    }
  }
);
}

Fixed version (ground truth):
public CoreDownloadItem(Downloader downloader,QueueTimeCalculator queueTimeCalculator){
  this.downloader=downloader;
  this.queueTimeCalculator=queueTimeCalculator;
  downloader.addListener(new EventListener<DownloadStatusEvent>(){
    @Override public void handleEvent(    DownloadStatusEvent event){
      fireDataChanged();
    }
  }
);
}
Program: 4066
Project: 4066
Buggy source:
private void update(){
  downloadItems.getReadWriteLock().writeLock().lock();
  try {
    if (downloadItems.size() > 0) {
      downloadItems.set(0,downloadItems.get(0));
    }
  }
  finally {
    downloadItems.getReadWriteLock().writeLock().unlock();
  }
}

Fixed version (ground truth):
private void update(){
  downloadItems.getReadWriteLock().readLock().lock();
  try {
    for (    DownloadItem item : downloadItems) {
      if (item instanceof CoreDownloadItem)       ((CoreDownloadItem)item).fireDataChanged();
    }
  }
  finally {
    downloadItems.getReadWriteLock().readLock().unlock();
  }
}
Program: 4067
Project: 4067
Buggy source:
public long getRemainingQueueTime(DownloadItem queueItem){
  if (queueItem.getState() != DownloadState.LOCAL_QUEUED) {
    return DownloadItem.UNKNOWN_TIME;
  }
  int priority=queueItem.getLocalQueuePriority();
  int index=priority - 1;
  downloadingList.getReadWriteLock().readLock().lock();
  try {
    if (index >= downloadingList.size()) {
      return DownloadItem.UNKNOWN_TIME;
    }
    return downloadingList.get(index).getRemainingDownloadTime();
  }
  finally {
    downloadingList.getReadWriteLock().readLock().unlock();
  }
}

Fixed version (ground truth):
public long getRemainingQueueTime(DownloadItem queueItem){
  if (queueItem.getState() != DownloadState.LOCAL_QUEUED) {
    return DownloadItem.UNKNOWN_TIME;
  }
  int priority=queueItem.getLocalQueuePriority();
  int index=priority - 1;
  downloadingList.getReadWriteLock().readLock().lock();
  try {
    if (index >= downloadingList.size()) {
      return DownloadItem.UNKNOWN_TIME;
    }
    System.out.println(downloadingList.get(index).getRemainingDownloadTime());
    return downloadingList.get(index).getRemainingDownloadTime();
  }
  finally {
    downloadingList.getReadWriteLock().readLock().unlock();
  }
}
Program: 4068
Project: 4068
Buggy source:
public void run(){
  while (isRunning() && getCurrentSize() < getTotalSize()) {
    setCurrentSize(getCurrentSize() + 5);
    try {
      sleep(500);
    }
 catch (    InterruptedException e) {
    }
  }
}

Fixed version (ground truth):
public void run(){
  while (isRunning() && getCurrentSize() < getTotalSize()) {
    setCurrentSize(getCurrentSize() + 5);
    setRemainingQueueTime(getRemainingQueueTime() - 1);
    try {
      sleep(500);
    }
 catch (    InterruptedException e) {
    }
  }
}
Program: 4069
Project: 4069
Buggy source:
@Override public long getRemainingQueueTime(){
  return 0;
}

Fixed version (ground truth):
@Override public long getRemainingQueueTime(){
  System.out.println("String_Node_Str" + remainingQueueTime);
  return remainingQueueTime;
}
Program: 4070
Project: 4070
Buggy source:
public long getRemainingDownloadTime(){
  return 4123;
}

Fixed version (ground truth):
public long getRemainingDownloadTime(){
  return (long)((getTotalSize() - getCurrentSize()) / getDownloadSpeed());
}
Program: 4071
Project: 4071
Buggy source:
private synchronized void start(){
  new Thread(){
    public void run(){
      while (isRunning() && getCurrentSize() < getTotalSize()) {
        setCurrentSize(getCurrentSize() + 5);
        try {
          sleep(500);
        }
 catch (        InterruptedException e) {
        }
      }
    }
  }
.start();
}

Fixed version (ground truth):
private synchronized void start(){
  new Thread(){
    public void run(){
      while (isRunning() && getCurrentSize() < getTotalSize()) {
        setCurrentSize(getCurrentSize() + 5);
        setRemainingQueueTime(getRemainingQueueTime() - 1);
        try {
          sleep(500);
        }
 catch (        InterruptedException e) {
        }
      }
    }
  }
.start();
}
Program: 4072
Project: 4072
Buggy source:
public void pauseAll(){
  commonBaseList.getReadWriteLock().writeLock().lock();
  try {
    for (    DownloadItem item : commonBaseList) {
      if (item.getState().isPausable()) {
        item.pause();
      }
    }
  }
  finally {
    commonBaseList.getReadWriteLock().writeLock().unlock();
  }
}

Fixed version (ground truth):
public void pauseAll(){
  commonBaseList.getReadWriteLock().readLock().lock();
  try {
    for (    DownloadItem item : commonBaseList) {
      if (item.getState().isPausable()) {
        item.pause();
      }
    }
  }
  finally {
    commonBaseList.getReadWriteLock().readLock().unlock();
  }
}
Program: 4073
Project: 4073
Buggy source:
public void resumeAll(){
  commonBaseList.getReadWriteLock().writeLock().lock();
  try {
    for (    DownloadItem item : commonBaseList) {
      if (item.getState().isResumable()) {
        item.resume();
      }
    }
  }
  finally {
    commonBaseList.getReadWriteLock().writeLock().unlock();
  }
}

Fixed version (ground truth):
public void resumeAll(){
  commonBaseList.getReadWriteLock().readLock().lock();
  try {
    for (    DownloadItem item : commonBaseList) {
      if (item.getState().isResumable()) {
        item.resume();
      }
    }
  }
  finally {
    commonBaseList.getReadWriteLock().readLock().unlock();
  }
}
Program: 4074
Project: 4074
Buggy source:
/** 
 * Binds editor to downloadItems so that the editor automatically updates when downloadItems changes and popup menus work.  This is required for Editors
 */
public void initializeEditor(EventList<DownloadItem> downloadItems){
  this.downloadItems=downloadItems;
  downloadItems.addListEventListener(new ListEventListener<DownloadItem>(){
    @Override public void listChanged(    ListEvent<DownloadItem> listChanges){
      SwingUtils.invokeLater(new Runnable(){
        @Override public void run(){
          updateEditor();
        }
      }
);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Binds editor to downloadItems so that the editor automatically updates when downloadItems changes and popup menus work.  This is required for Editors
 */
public void initializeEditor(EventList<DownloadItem> downloadItems){
  this.downloadItems=downloadItems;
  downloadItems.addListEventListener(new ListEventListener<DownloadItem>(){
    @Override public void listChanged(    ListEvent<DownloadItem> listChanges){
      SwingUtils.invokeLater(new Runnable(){
        @Override public void run(){
          if (isVisible()) {
            updateEditor();
          }
        }
      }
);
    }
  }
);
}
Program: 4075
Project: 4075
Buggy source:
@Override public void run(){
  updateEditor();
}

Fixed version (ground truth):
@Override public void run(){
  if (isVisible()) {
    updateEditor();
  }
}
Program: 4076
Project: 4076
Buggy source:
@Override public void listChanged(ListEvent<DownloadItem> listChanges){
  SwingUtils.invokeLater(new Runnable(){
    @Override public void run(){
      updateEditor();
    }
  }
);
}

Fixed version (ground truth):
@Override public void listChanged(ListEvent<DownloadItem> listChanges){
  SwingUtils.invokeLater(new Runnable(){
    @Override public void run(){
      if (isVisible()) {
        updateEditor();
      }
    }
  }
);
}
Program: 4077
Project: 4077
Buggy source:
public Downloader getDownloader(){
  return downloader;
}

Fixed version (ground truth):
private Downloader getDownloader(){
  return downloader;
}
Program: 4078
Project: 4078
Buggy source:
@Override public void cancel(){
  downloader.stop();
}

Fixed version (ground truth):
@Override public void cancel(){
  cancelled=true;
  support.firePropertyChange("String_Node_Str",null,getState());
  downloader.stop();
}
Program: 4079
Project: 4079
Buggy source:
@Override public double getCurrentSize(){
  return downloader.getAmountRead();
}

Fixed version (ground truth):
@Override public double getCurrentSize(){
  if (getState() == DownloadState.DONE) {
    return getTotalSize();
  }
 else {
    return downloader.getAmountRead();
  }
}
Program: 4080
Project: 4080
Buggy source:
@Override public DownloadState getState(){
  return convertState(downloader.getState());
}

Fixed version (ground truth):
@Override public DownloadState getState(){
  if (cancelled) {
    return DownloadState.CANCELLED;
  }
  return convertState(downloader.getState());
}
Program: 4081
Project: 4081
Buggy source:
private static DownloadState convertState(DownloadStatus status){
switch (status) {
case SAVING:
case HASHING:
    return DownloadState.FINISHING;
case DOWNLOADING:
case FETCHING:
case IDENTIFY_CORRUPTION:
  return DownloadState.DOWNLOADING;
case CONNECTING:
case RESUMING:
case INITIALIZING:
case WAITING_FOR_GNET_RESULTS:
case QUERYING_DHT:
case BUSY:
case WAITING_FOR_CONNECTIONS:
case ITERATIVE_GUESSING:
return DownloadState.CONNECTING;
case COMPLETE:
return DownloadState.DONE;
case REMOTE_QUEUED:
return DownloadState.REMOTE_QUEUED;
case QUEUED:
return DownloadState.LOCAL_QUEUED;
case PAUSED:
return DownloadState.PAUSED;
case WAITING_FOR_USER:
case GAVE_UP:
return DownloadState.STALLED;
case ABORTED:
return DownloadState.CANCELLED;
case DISK_PROBLEM:
case CORRUPT_FILE:
case RECOVERY_FAILED:
case INVALID:
return DownloadState.ERROR;
default :
return DownloadState.DOWNLOADING;
}
}

Fixed version (ground truth):
private DownloadState convertState(DownloadStatus status){
switch (status) {
case SAVING:
case HASHING:
    if (getTotalSize() > finishingThreshold) {
      return DownloadState.FINISHING;
    }
 else {
      return DownloadState.DONE;
    }
case DOWNLOADING:
case FETCHING:
case IDENTIFY_CORRUPTION:
  return DownloadState.DOWNLOADING;
case CONNECTING:
case RESUMING:
case INITIALIZING:
case WAITING_FOR_GNET_RESULTS:
case QUERYING_DHT:
case BUSY:
case WAITING_FOR_CONNECTIONS:
case ITERATIVE_GUESSING:
return DownloadState.CONNECTING;
case COMPLETE:
return DownloadState.DONE;
case REMOTE_QUEUED:
return DownloadState.REMOTE_QUEUED;
case QUEUED:
return DownloadState.LOCAL_QUEUED;
case PAUSED:
return DownloadState.PAUSED;
case WAITING_FOR_USER:
case GAVE_UP:
return DownloadState.STALLED;
case ABORTED:
return DownloadState.CANCELLED;
case DISK_PROBLEM:
case CORRUPT_FILE:
case RECOVERY_FAILED:
case INVALID:
return DownloadState.ERROR;
default :
return DownloadState.DOWNLOADING;
}
}
Program: 4082
Project: 4082
Buggy source:
public CoreDownloadItem(Downloader downloader){
  this.downloader=downloader;
}

Fixed version (ground truth):
public CoreDownloadItem(Downloader downloader){
  this.downloader=downloader;
  downloader.addListener(new EventListener<DownloadStatusEvent>(){
    @Override public void handleEvent(    DownloadStatusEvent event){
      support.firePropertyChange("String_Node_Str",null,getState());
    }
  }
);
}
Program: 4083
Project: 4083
Buggy source:
@Override public EventList<DownloadItem> getDownloads(){
  return downloadItems;
}

Fixed version (ground truth):
@Override public EventList<DownloadItem> getDownloads(){
  System.out.println(this);
  return downloadItems;
}
Program: 4084
Project: 4084
Buggy source:
public DownloadMediator(DownloadListManager downloadManager){
  commonBaseList=downloadManager.getDownloads();
  searchBar=new JTextField();
  filteredList=new FilterList<DownloadItem>(commonBaseList,new TextComponentMatcherEditor<DownloadItem>(searchBar,new DownloadItemTextFilterator(),true));
}

Fixed version (ground truth):
public DownloadMediator(DownloadListManager downloadManager){
  commonBaseList=new FilterList<DownloadItem>(downloadManager.getDownloads(),new DownloadStateExcluder(DownloadState.CANCELLED));
  searchBar=new JTextField();
  filteredList=new FilterList<DownloadItem>(commonBaseList,new TextComponentMatcherEditor<DownloadItem>(searchBar,new DownloadItemTextFilterator(),true));
}
Program: 4085
Project: 4085
Buggy source:
public void pauseAll(){
  for (  DownloadItem item : commonBaseList) {
    if (item.getState().isPausable()) {
      item.pause();
    }
  }
}

Fixed version (ground truth):
public void pauseAll(){
  commonBaseList.getReadWriteLock().readLock().lock();
  try {
    for (    DownloadItem item : commonBaseList) {
      if (item.getState().isPausable()) {
        item.pause();
      }
    }
  }
  finally {
    commonBaseList.getReadWriteLock().readLock().unlock();
  }
}
Program: 4086
Project: 4086
Buggy source:
public void resumeAll(){
  for (  DownloadItem item : commonBaseList) {
    if (item.getState().isResumable()) {
      item.resume();
    }
  }
}

Fixed version (ground truth):
public void resumeAll(){
  commonBaseList.getReadWriteLock().readLock().lock();
  try {
    for (    DownloadItem item : commonBaseList) {
      if (item.getState().isResumable()) {
        item.resume();
      }
    }
  }
  finally {
    commonBaseList.getReadWriteLock().readLock().unlock();
  }
}
Program: 4087
Project: 4087
Buggy source:
/** 
 * Create the panel
 */
public DownloadSummaryPanel(final EventList<DownloadItem> itemList){
  GuiUtils.assignResources(this);
  this.itemList=itemList;
  setLayout(new BorderLayout());
  titleLabel=new JLabel();
  titleLabel.setHorizontalTextPosition(SwingConstants.LEFT);
  FontUtils.changeStyle(titleLabel,Font.BOLD);
  add(titleLabel,BorderLayout.NORTH);
  table=new JTable(new DownloadTableModel(itemList));
  table.setShowHorizontalLines(false);
  table.setShowVerticalLines(false);
  warningList=new FilterList<DownloadItem>(itemList,new DownloadStateMatcher(DownloadState.ERROR,DownloadState.STALLED));
  itemList.addListEventListener(new ListEventListener<DownloadItem>(){
    @Override public void listChanged(    ListEvent<DownloadItem> listChanges){
      updateTitle();
      adjustVisibility();
    }
  }
);
  table.setDefaultRenderer(DownloadItem.class,new DownloadStatusPanelRenderer());
  add(table,BorderLayout.CENTER);
  updateTitle();
  adjustVisibility();
}

Fixed version (ground truth):
/** 
 * Create the panel
 */
public DownloadSummaryPanel(final EventList<DownloadItem> itemList){
  GuiUtils.assignResources(this);
  setLayout(new BorderLayout());
  this.allList=itemList;
  unfinishedList=new FilterList<DownloadItem>(itemList,new DownloadStateExcluder(DownloadState.DONE));
  warningList=new FilterList<DownloadItem>(itemList,new DownloadStateMatcher(DownloadState.ERROR,DownloadState.STALLED));
  titleLabel=new JLabel();
  titleLabel.setHorizontalTextPosition(SwingConstants.LEFT);
  FontUtils.changeStyle(titleLabel,Font.BOLD);
  add(titleLabel,BorderLayout.NORTH);
  table=new JTable(new DownloadTableModel(unfinishedList));
  table.setShowHorizontalLines(false);
  table.setShowVerticalLines(false);
  allList.addListEventListener(new ListEventListener<DownloadItem>(){
    @Override public void listChanged(    ListEvent<DownloadItem> listChanges){
      updateTitle();
      adjustVisibility();
    }
  }
);
  table.setDefaultRenderer(DownloadItem.class,new DownloadStatusPanelRenderer());
  add(table,BorderLayout.CENTER);
  updateTitle();
  adjustVisibility();
}
Program: 4088
Project: 4088
Buggy source:
private void adjustVisibility(){
  setVisible(itemList.size() > 0);
}

Fixed version (ground truth):
private void adjustVisibility(){
  setVisible(allList.size() > 0);
}
Program: 4089
Project: 4089
Buggy source:
private void updateTitle(){
  titleLabel.setText(I18n.tr("String_Node_Str",itemList.size()));
  if (warningList.size() > 0) {
    titleLabel.setIcon(warningIcon);
  }
 else {
    titleLabel.setIcon(null);
  }
}

Fixed version (ground truth):
private void updateTitle(){
  titleLabel.setText(I18n.tr("String_Node_Str",unfinishedList.size()));
  if (warningList.size() > 0) {
    titleLabel.setIcon(warningIcon);
  }
 else {
    titleLabel.setIcon(null);
  }
}
Program: 4090
Project: 4090
Buggy source:
/** 
 * Creates a DownloadTable and adds it to a collapsible pane with the title 
 * @param model the model of the table
 * @param title the title of the panel displaying this table
 * @param state
 */
private void addTable(EventList<DownloadItem> list,String title,DownloadState... states){
  final JXCollapsiblePane collapsePane=new JXCollapsiblePane();
  collapsePane.setLayout(new BorderLayout());
  FilterList<DownloadItem> filterList=new FilterList<DownloadItem>(list,new DownloadStateMatcher(states));
  final JXTable table=new DownloadTable(filterList);
  tables.add(table);
  table.getSelectionModel().addListSelectionListener(new MultiTableSelectionListener());
  collapsePane.add(table,BorderLayout.CENTER);
  final JPanel titlePanel=new JPanel(new VerticalLayout());
  JLabel titleLabel=new JLabel(title);
  titleLabel.addMouseListener(getClickListener(collapsePane.getActionMap().get(JXCollapsiblePane.TOGGLE_ACTION)));
  titlePanel.add(titleLabel);
  titlePanel.add(new JSeparator());
  titles.add(titlePanel);
  tablePanel.add(titlePanel);
  tablePanel.add(collapsePane);
}

Fixed version (ground truth):
/** 
 * Creates a DownloadTable and adds it to a collapsible pane with the title 
 * @param model the model of the table
 * @param title the title of the panel displaying this table
 * @param state
 */
private void addTable(EventList<DownloadItem> list,String title,DownloadState... states){
  final JXCollapsiblePane collapsePane=new JXCollapsiblePane();
  collapsePane.setLayout(new BorderLayout());
  EventList<DownloadItem> filterList=new FilterList<DownloadItem>(list,new DownloadStateMatcher(states));
  final JXTable table=new DownloadTable(filterList);
  tables.add(table);
  table.getSelectionModel().addListSelectionListener(new MultiTableSelectionListener());
  collapsePane.add(table,BorderLayout.CENTER);
  final JPanel titlePanel=new JPanel(new VerticalLayout());
  JLabel titleLabel=new JLabel(title);
  titleLabel.addMouseListener(getClickListener(collapsePane.getActionMap().get(JXCollapsiblePane.TOGGLE_ACTION)));
  titlePanel.add(titleLabel);
  titlePanel.add(new JSeparator());
  titles.add(titlePanel);
  tablePanel.add(titlePanel);
  tablePanel.add(collapsePane);
}