nus-yam/ex-repair huggingface dataset:
Program: 3836
Project: 3836
Buggy source:
@Inject SchemaReplyCollectionMapper(LimeXMLReplyCollectionFactory limeXMLReplyCollectionFactory,Provider<LimeXMLSchemaRepository> limeXMLSchemaRepository){
  this.limeXMLReplyCollectionFactory=limeXMLReplyCollectionFactory;
  this.limeXMLSchemaRepository=limeXMLSchemaRepository;
  mapper=new HashMap<String,LimeXMLReplyCollection>();
}

Fixed version (ground truth):
@Inject SchemaReplyCollectionMapper(LimeXMLReplyCollectionFactory limeXMLReplyCollectionFactory,Provider<LimeXMLSchemaRepository> limeXMLSchemaRepository){
  this.limeXMLReplyCollectionFactory=limeXMLReplyCollectionFactory;
  this.limeXMLSchemaRepository=limeXMLSchemaRepository;
  mapper=new ConcurrentHashMap<String,LimeXMLReplyCollection>();
}
Program: 3837
Project: 3837
Buggy source:
/** 
 * Notifies all the LimeXMLReplyCollections that the initial loading has completed.
 */
private synchronized void finishLoading(){
  Collection<LimeXMLReplyCollection> replies=getCollections();
  for (  LimeXMLReplyCollection col : replies)   col.loadFinished();
}

Fixed version (ground truth):
/** 
 * Notifies all the LimeXMLReplyCollections that the initial loading has completed.
 */
private void finishLoading(){
  Collection<LimeXMLReplyCollection> replies=getCollections();
  for (  LimeXMLReplyCollection col : replies)   col.loadFinished();
}
Program: 3838
Project: 3838
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  File currentSong=PlayerUtils.getCurrentSongFile();
  List<LocalFileItem> items=new ArrayList<LocalFileItem>(selectedLocalFileItems.get());
  for (  LocalFileItem item : items) {
    if (item.getFile().equals(currentSong)) {
      PlayerUtils.stop();
    }
    if (!item.isIncomplete()) {
      libraryManager.getLibraryManagedList().removeFile(item.getFile());
    }
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  File currentSong=PlayerUtils.getCurrentSongFile();
  List<LocalFileItem> selected=selectedLocalFileItems.get();
  final List<File> toRemove=new ArrayList<File>(selected.size());
  for (  LocalFileItem item : selected) {
    if (item.getFile().equals(currentSong)) {
      PlayerUtils.stop();
    }
    if (!item.isIncomplete()) {
      toRemove.add(item.getFile());
    }
  }
  if (!toRemove.isEmpty()) {
    BackgroundExecutorService.execute(new Runnable(){
      @Override public void run(){
        for (        File file : toRemove) {
          libraryManager.getLibraryManagedList().removeFile(file);
        }
      }
    }
);
  }
}
Program: 3840
Project: 3840
Buggy source:
@Override public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  Component renderer=super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
  if (renderer instanceof JLabel) {
    int count=uniqueList.getCount((Category)value);
    StringBuilder buf=new StringBuilder();
    buf.append(value.toString()).append("String_Node_Str").append(count).append("String_Node_Str");
    ((JLabel)renderer).setText(buf.toString());
    ((JLabel)renderer).setBorder(border);
    ((JLabel)renderer).setOpaque(false);
  }
  return renderer;
}

Fixed version (ground truth):
@Override public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  Component renderer=super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
  if (renderer instanceof JLabel) {
    int count=uniqueList.getCount((Category)value);
    StringBuilder buf=new StringBuilder();
    buf.append(value.toString()).append("String_Node_Str").append(count).append("String_Node_Str");
    ((JLabel)renderer).setText(buf.toString());
    ((JLabel)renderer).setBackground(background);
    ((JLabel)renderer).setBorder(border);
  }
  return renderer;
}
Program: 3841
Project: 3841
Buggy source:
@Override public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  Component renderer=super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
  if ((renderer instanceof JLabel) && (value != null)) {
    int count=uniqueList.getCount(value);
    StringBuilder buf=new StringBuilder();
    buf.append(value.toString()).append("String_Node_Str").append(count).append("String_Node_Str");
    ((JLabel)renderer).setText(buf.toString());
    ((JLabel)renderer).setBorder(border);
    ((JLabel)renderer).setOpaque(false);
  }
  return renderer;
}

Fixed version (ground truth):
@Override public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  Component renderer=super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
  if ((renderer instanceof JLabel) && (value != null)) {
    int count=uniqueList.getCount(value);
    StringBuilder buf=new StringBuilder();
    buf.append(value.toString()).append("String_Node_Str").append(count).append("String_Node_Str");
    ((JLabel)renderer).setText(buf.toString());
    ((JLabel)renderer).setBackground(background);
    ((JLabel)renderer).setBorder(border);
  }
  return renderer;
}
Program: 3843
Project: 3843
Buggy source:
public PropertyCellRenderer(Border border){
  this.border=border;
}

Fixed version (ground truth):
public PropertyCellRenderer(Color background,Border border){
  this.background=background;
  this.border=border;
}
Program: 3845
Project: 3845
Buggy source:
@Override public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  Component renderer=super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
  if (renderer instanceof JLabel) {
    ((JLabel)renderer).setBorder(border);
    ((JLabel)renderer).setOpaque(false);
  }
  return renderer;
}

Fixed version (ground truth):
@Override public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  Component renderer=super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
  if (renderer instanceof JLabel) {
    ((JLabel)renderer).setBackground(background);
    ((JLabel)renderer).setBorder(border);
  }
  return renderer;
}
Program: 3846
Project: 3846
Buggy source:
@Override public boolean allow(Message m){
  if (m instanceof QueryRequest) {
    QueryRequest q=(QueryRequest)m;
    boolean shouldDrop=false;
    byte[] guid=q.getGUID();
    for (int i=0; i < 4; i++) {
      int slice=ByteUtils.leb2int(guid,i);
      Long key=Long.valueOf((i << 32) + slice);
      Integer count=sliceCounts.get(key);
      if (count == null)       count=0;
      count++;
      sliceTotals[i]++;
      sliceCounts.put(key,count);
      if (sliceTotals[i] >= GUIDS_TO_COUNT && count > sliceTotals[i] * MAX_FRACTION_PER_SLICE && !q.desiresOutOfBandReplies() && q.getMinSpeed() == 0) {
        shouldDrop=true;
      }
    }
    if (shouldDrop) {
      if (LOG.isDebugEnabled())       LOG.debug("String_Node_Str" + q);
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean allow(Message m){
  if (m instanceof QueryRequest) {
    QueryRequest q=(QueryRequest)m;
    boolean shouldDrop=false;
    byte[] guid=q.getGUID();
    for (int i=0; i < 4; i++) {
      int slice=ByteUtils.leb2int(guid,i * 4);
      Long key=((long)i << 32) | (slice & 0xFFFFFFFFL);
      Integer count=sliceCounts.get(key);
      if (count == null)       count=0;
      count++;
      sliceTotals[i]++;
      sliceCounts.put(key,count);
      if (sliceTotals[i] >= GUIDS_TO_COUNT && count > sliceTotals[i] * MAX_FRACTION_PER_SLICE && !q.desiresOutOfBandReplies() && q.getMinSpeed() == 0) {
        shouldDrop=true;
      }
    }
    if (shouldDrop) {
      if (LOG.isDebugEnabled())       LOG.debug("String_Node_Str" + q);
      return false;
    }
  }
  return true;
}
Program: 3847
Project: 3847
Buggy source:
private void shareTorrentFile(BTData btData,File torrentFile){
  if (SharingSettings.SHARE_DOWNLOADED_FILES_IN_NON_SHARED_DIRECTORIES.getValue() && !btData.isPrivate()) {
    final File tFile=getSharedTorrentMetaDataFile(btData);
    fileManager.getGnutellaFileList().remove(tFile);
    File backup=null;
    if (tFile.exists()) {
      backup=new File(tFile.getParent(),tFile.getName().concat("String_Node_Str"));
      FileUtils.forceRename(tFile,backup);
    }
    if (FileUtils.forceRename(torrentFile,tFile)) {
      fileManager.getGnutellaFileList().add(tFile);
    }
 else {
      if (backup != null) {
        if (FileUtils.forceRename(backup,tFile)) {
          fileManager.getGnutellaFileList().add(tFile);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void shareTorrentFile(BTData btData,File torrentFile){
  if (SharingSettings.SHARE_DOWNLOADED_FILES_IN_NON_SHARED_DIRECTORIES.getValue() && !btData.isPrivate()) {
    final File tFile=getSharedTorrentMetaDataFile(btData);
    fileManager.getGnutellaFileList().remove(tFile);
    File backup=null;
    if (tFile.exists()) {
      backup=new File(tFile.getParent(),tFile.getName().concat("String_Node_Str"));
      FileUtils.forceRename(tFile,backup);
    }
    if (FileUtils.copy(torrentFile,tFile)) {
      fileManager.getGnutellaFileList().add(tFile);
    }
 else {
      if (backup != null) {
        if (FileUtils.forceRename(backup,tFile)) {
          fileManager.getGnutellaFileList().add(tFile);
        }
      }
    }
  }
}
Program: 3849
Project: 3849
Buggy source:
/** 
 * Returns true if the specified item matches any of the property values.
 */
@Override public boolean matches(E item){
  if (item == null)   return false;
  if (values.isEmpty())   return true;
switch (filterType) {
case EXTENSION:
    return values.contains(item.getFileExtension().toLowerCase());
case PROPERTY:
  return values.contains(item.getProperty(propertyKey));
case FILE_TYPE:
String type=iconManager.getMIMEDescription(item.getFileExtension());
return values.contains(type);
default :
return false;
}
}

Fixed version (ground truth):
/** 
 * Returns true if the specified item matches any of the property values.
 */
@Override public boolean matches(E item){
  if (item == null)   return false;
  if (values.isEmpty())   return true;
switch (filterType) {
case EXTENSION:
    return values.contains(item.getFileExtension().toLowerCase());
case PROPERTY:
  Object property=item.getProperty(propertyKey);
if (FilePropertyKey.isLong(propertyKey)) {
  return values.contains(property);
}
 else {
  for (  Object value : values) {
    if (Objects.compareToNullIgnoreCase((String)value,(String)property,false) == 0) {
      return true;
    }
  }
  return false;
}
case FILE_TYPE:
String type=iconManager.getMIMEDescription(item.getFileExtension());
return values.contains(type);
default :
return false;
}
}
Program: 3850
Project: 3850
Buggy source:
Collection<Friend> getKnownFriends(){
  return Collections.unmodifiableCollection(knownFriends.values());
}

Fixed version (ground truth):
public Collection<Friend> getKnownFriends(){
  return Collections.unmodifiableCollection(knownFriends.values());
}
Program: 3851
Project: 3851
Buggy source:
@Override protected void configure(){
  bind(GuiCallbackImpl.class);
  install(new LimeWireUiUtilModule());
  install(new LimeWireUiSearchModule());
  install(new LimeWireUiNavModule());
  install(new LimeWireUiMainframeModule());
  install(new LimeWireUiTrayModule());
  install(new LimeWireUiFriendsModule());
  install(new LimeWireUiPlayerModule());
  install(new LimeWireUiImagesModule());
  install(new LimeWireUiLibraryModule());
  install(new LimeWireUiLibrarySharingModule());
  install(new LimeWireUiDownloadsModule());
  install(new LimeWireUiOptionsModule());
  install(new LimeWireUiStatusbarModule());
  install(new LimeWireUiPainterModule(isPro));
  install(new LimeWireUiComponentsModule());
  install(new LimeWireUiUploadModule());
  install(new LimeWireUiDockModule());
  install(new LimeWireUiWizardModule());
  install(new LimeWireUiPropertiesModule());
  install(new LimeWireUiBrowserModule());
}

Fixed version (ground truth):
@Override protected void configure(){
  bind(GuiCallbackImpl.class);
  install(new LimeWireUiUtilModule());
  install(new LimeWireUiSearchModule());
  install(new LimeWireUiNavModule());
  install(new LimeWireUiMainframeModule());
  install(new LimeWireUiTrayModule());
  install(new LimeWireUiFriendsModule());
  install(new LimeWireUiPlayerModule());
  install(new LimeWireUiImagesModule());
  install(new LimeWireUiLibraryModule());
  install(new LimeWireUiLibrarySharingModule());
  install(new LimeWireUiDownloadsModule());
  install(new LimeWireUiOptionsModule());
  install(new LimeWireUiStatusbarModule());
  install(new LimeWireUiPainterModule(isPro));
  install(new LimeWireUiComponentsModule());
  install(new LimeWireUiDockModule());
  install(new LimeWireUiWizardModule());
  install(new LimeWireUiPropertiesModule());
  install(new LimeWireUiBrowserModule());
}
Program: 3853
Project: 3853
Buggy source:
@Inject public DownloadActionHandler(PropertiesFactory<DownloadItem> propertiesFactory,ShareWidgetFactory shareFactory,DownloadListManager downloadListManager,LibraryNavigator libraryNavigator,PropertiesFactory<LocalFileItem> localItemFactory,LibraryManager libraryManager){
  this.downloadListManager=downloadListManager;
  this.propertiesFactory=propertiesFactory;
  this.shareWidget=shareFactory.createFileShareWidget();
  this.libraryNavigator=libraryNavigator;
  this.localItemFactory=localItemFactory;
  this.libraryManager=libraryManager;
}

Fixed version (ground truth):
@Inject public DownloadActionHandler(ShareWidgetFactory shareFactory,DownloadListManager downloadListManager,LibraryNavigator libraryNavigator,LibraryManager libraryManager,FileInfoDialogFactory fileInfoFactory){
  this.downloadListManager=downloadListManager;
  this.shareWidget=shareFactory.createFileShareWidget();
  this.libraryNavigator=libraryNavigator;
  this.libraryManager=libraryManager;
  this.fileInfoFactory=fileInfoFactory;
}
Program: 3854
Project: 3854
Buggy source:
@Override protected void configure(){
  bind(DownloadTableFactory.class).toProvider(FactoryProvider.newFactory(DownloadTableFactory.class,DownloadTable.class));
  bind(DownloadActionHandler.class);
  bind(new TypeLiteral<PropertiesFactory<DownloadItem>>(){
  }
).to(DownloadItemPropertiesFactory.class);
}

Fixed version (ground truth):
@Override protected void configure(){
  bind(DownloadTableFactory.class).toProvider(FactoryProvider.newFactory(DownloadTableFactory.class,DownloadTable.class));
  bind(DownloadActionHandler.class);
}
Program: 3855
Project: 3855
Buggy source:
@Override protected void configure(){
  install(new LimeWireUiLibraryNavModule());
  bind(LibraryTableFactory.class).to(LibraryTableFactoryImpl.class);
  bind(SharingActionFactory.class).to(SharingActionFactoryImpl.class);
  bind(LibraryImageSubPanelFactory.class).to(LibraryImageSubPanelFactoryImpl.class);
  bind(new TypeLiteral<PropertiesFactory<LocalFileItem>>(){
  }
).to(LocalFileItemPropertiesFactory.class);
  bind(new TypeLiteral<PropertiesFactory<RemoteFileItem>>(){
  }
).to(RemoteFileItemPropertiesFactory.class);
  bind(ShareTableRendererEditorFactory.class).toProvider(FactoryProvider.newFactory(ShareTableRendererEditorFactory.class,ShareTableRendererEditor.class));
}

Fixed version (ground truth):
@Override protected void configure(){
  install(new LimeWireUiLibraryNavModule());
  bind(LibraryTableFactory.class).to(LibraryTableFactoryImpl.class);
  bind(SharingActionFactory.class).to(SharingActionFactoryImpl.class);
  bind(LibraryImageSubPanelFactory.class).to(LibraryImageSubPanelFactoryImpl.class);
  bind(ShareTableRendererEditorFactory.class).toProvider(FactoryProvider.newFactory(ShareTableRendererEditorFactory.class,ShareTableRendererEditor.class));
  bind(MyLibraryPopupMenuFactory.class).toProvider(FactoryProvider.newFactory(MyLibraryPopupMenuFactory.class,MyLibraryPopupMenu.class));
}
Program: 3857
Project: 3857
Buggy source:
public LibrarySharePanel(ThreadSafeList<SharingTarget> allFriends,ShapeDialog dialog,FriendActions xmppService,boolean canShowP2P,boolean shareVisible){
  this.dialog=dialog;
  this.friendActions=xmppService;
  this.canShowP2P=canShowP2P;
  this.shareVisible=shareVisible;
  setFocusPainted(false);
  initialize(allFriends);
}

Fixed version (ground truth):
public LibrarySharePanel(ThreadSafeList<SharingTarget> allFriends,ShapeDialog dialog,FriendActions xmppService,boolean canShowP2P,boolean shareVisible){
  this.dialog=dialog;
  this.friendActions=xmppService;
  this.canShowP2P=canShowP2P;
  this.shareVisible=shareVisible;
  setFocusPainted(false);
  setBorderPainted(false);
  initialize(allFriends);
}
Program: 3858
Project: 3858
Buggy source:
public String getPath(){
  return path;
}

Fixed version (ground truth):
/** 
 * Returns the path to the file relative to the root  directory of the torrent in unix form. This form work for appending the path to urls. path/to/file instead of path\to\file
 */
public String getPath(){
  return path;
}
Program: 3859
Project: 3859
Buggy source:
/** 
 * Parses a list of paths into a single string, adding the intermediate folders into the Set of folders.  The paths are parsed either as UTF or ASCII.
 */
private String parseFileList(List<?> paths,Set<String> folders,boolean utf8) throws ValueException {
  if (paths.isEmpty())   throw new ValueException("String_Node_Str");
  StringBuilder sb=new StringBuilder();
  for (Iterator<?> i=paths.iterator(); i.hasNext(); ) {
    Object o=i.next();
    if (!(o instanceof byte[]))     throw new ValueException("String_Node_Str");
    String current;
    if (utf8)     current=StringUtils.getUTF8String((byte[])o);
 else     current=StringUtils.getASCIIString((byte[])o);
    if (current.length() == 0)     throw new ValueException("String_Node_Str");
    sb.append(File.separator);
    sb.append(CommonUtils.convertFileName(current));
    if (i.hasNext())     folders.add(sb.toString());
  }
  return sb.toString();
}

Fixed version (ground truth):
/** 
 * Parses a list of paths into a single string, adding the intermediate folders into the Set of folders.  The paths are parsed either as UTF or ASCII.
 */
private String parseFileList(List<?> paths,Set<String> folders,boolean utf8) throws ValueException {
  if (paths.isEmpty())   throw new ValueException("String_Node_Str");
  StringBuilder sb=new StringBuilder();
  for (Iterator<?> i=paths.iterator(); i.hasNext(); ) {
    Object o=i.next();
    if (!(o instanceof byte[]))     throw new ValueException("String_Node_Str");
    String current;
    if (utf8)     current=StringUtils.getUTF8String((byte[])o);
 else     current=StringUtils.getASCIIString((byte[])o);
    if (current.length() == 0)     throw new ValueException("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append(CommonUtils.convertFileName(current));
    if (i.hasNext())     folders.add(sb.toString());
  }
  return sb.toString();
}
Program: 3861
Project: 3861
Buggy source:
/** 
 * Determines whether or not we need more hosts.
 */
private boolean needsHosts(long now){
  if (!listener.needsHosts()) {
    LOG.trace("String_Node_Str");
    return true;
  }
  long delay=now - firstBootstrapCheck;
  if (!connectionServices.isConnected() && delay > ConnectionSettings.BOOTSTRAP_DELAY.getValue()) {
    if (LOG.isTraceEnabled())     LOG.trace("String_Node_Str" + delay + "String_Node_Str");
    return true;
  }
  LOG.trace("String_Node_Str");
  return false;
}

Fixed version (ground truth):
/** 
 * Determines whether or not we need more hosts.
 */
private boolean needsHosts(long now){
  if (listener.needsHosts()) {
    LOG.trace("String_Node_Str");
    return true;
  }
  long delay=now - firstBootstrapCheck;
  if (!connectionServices.isConnected() && delay > ConnectionSettings.BOOTSTRAP_DELAY.getValue()) {
    if (LOG.isTraceEnabled())     LOG.trace("String_Node_Str" + delay + "String_Node_Str");
    return true;
  }
  LOG.trace("String_Node_Str");
  return false;
}
Program: 3862
Project: 3862
Buggy source:
/** 
 * Attempts to fetch via multicast, returning true if it was able to.
 */
private boolean multicastFetch(long now){
  if (nextAllowedMulticastTime < now && !ConnectionSettings.DO_NOT_MULTICAST_BOOTSTRAP.getValue()) {
    LOG.trace("String_Node_Str");
    PingRequest pr=pingRequestFactory.createMulticastPing();
    multicastService.get().send(pr);
    nextAllowedMulticastTime=now + MULTICAST_INTERVAL;
    if (nextAllowedUdpTime == Long.MAX_VALUE)     nextAllowedUdpTime=now + UDP_FALLBACK_DELAY;
    return true;
  }
  if (nextAllowedUdpTime == Long.MAX_VALUE && ConnectionSettings.DO_NOT_MULTICAST_BOOTSTRAP.getValue())   nextAllowedUdpTime=now + UDP_FALLBACK_DELAY;
  LOG.trace("String_Node_Str");
  return false;
}

Fixed version (ground truth):
/** 
 * Attempts to fetch via multicast, returning true if it was able to.
 */
private boolean multicastFetch(long now){
  if (nextAllowedMulticastTime < now && !ConnectionSettings.DO_NOT_MULTICAST_BOOTSTRAP.getValue()) {
    LOG.trace("String_Node_Str");
    PingRequest pr=pingRequestFactory.createMulticastPing();
    multicastService.get().send(pr);
    nextAllowedMulticastTime=now + MULTICAST_INTERVAL;
    if (nextAllowedUdpTime == Long.MAX_VALUE)     nextAllowedUdpTime=now + UDP_FALLBACK_DELAY;
    return true;
  }
  if (nextAllowedUdpTime == Long.MAX_VALUE && ConnectionSettings.DO_NOT_MULTICAST_BOOTSTRAP.getValue())   nextAllowedUdpTime=0;
  LOG.trace("String_Node_Str");
  return false;
}
Program: 3865
Project: 3865
Buggy source:
/** 
 * Increments the   {@link PresenceLibraryBrowser#latestConnectivityEventRevision}copies and empties   {@link PresenceLibraryBrowser#librariesToBrowse} andtries calls  {@link PresenceLibraryBrowser#tryToResolveAndBrowse(PresenceLibrary,int)}for each with the new revision.
 */
@Override public void handleEvent(ConnectivityChangeEvent event){
  LOG.debug("String_Node_Str");
  List<PresenceLibrary> copy;
  int currentRevision;
synchronized (librariesToBrowse) {
    currentRevision=++latestConnectivityEventRevision;
    copy=new ArrayList<PresenceLibrary>(librariesToBrowse);
    librariesToBrowse.clear();
  }
  for (  PresenceLibrary library : copy) {
    tryToResolveAndBrowse(library,currentRevision);
  }
}

Fixed version (ground truth):
/** 
 * Increments the   {@link PresenceLibraryBrowser#latestConnectivityEventRevision}copies and empties   {@link PresenceLibraryBrowser#librariesToBrowse} andtries calls  {@link PresenceLibraryBrowser#tryToResolveAndBrowse(PresenceLibrary,int)}for each with the new revision.
 */
@Override public void handleEvent(ConnectivityChangeEvent event){
  LOG.debug("String_Node_Str");
  List<PresenceLibrary> copy;
  int currentRevision;
synchronized (librariesToBrowse) {
    currentRevision=++latestConnectivityEventRevision;
    copy=new ArrayList<PresenceLibrary>(librariesToBrowse);
    LOG.debugf("String_Node_Str",currentRevision,copy);
    librariesToBrowse.clear();
  }
  for (  PresenceLibrary library : copy) {
    tryToResolveAndBrowse(library,currentRevision);
  }
}
Program: 3866
Project: 3866
Buggy source:
/** 
 * Called when resolution failed. If   {@link #latestConnectivityEventRevision} is greater then <code>startRevision</code>,a new attempt at resolving the presence address is started, otherwise <code>presenceLibrary</code> is queued up in libraries to browse.
 * @param presenceLibrary the library that could not be browsed
 * @param startRevision the revision under which the address resolution attemptwas started
 */
private void handleFailedResolution(PresenceLibrary presenceLibrary,int startRevision){
  LOG.debugf("String_Node_Str",presenceLibrary.getPresence().getPresenceId(),startRevision);
  presenceLibrary.setState(LibraryState.FAILED_TO_LOAD);
  boolean retry;
synchronized (librariesToBrowse) {
    retry=latestConnectivityEventRevision > startRevision;
    if (!retry) {
      assert(librariesToBrowse.add(presenceLibrary));
    }
 else {
      startRevision=latestConnectivityEventRevision;
    }
  }
  if (retry) {
    tryToResolveAndBrowse(presenceLibrary,startRevision);
  }
}

Fixed version (ground truth):
/** 
 * Called when resolution failed. If   {@link #latestConnectivityEventRevision} is greater then <code>startRevision</code>,a new attempt at resolving the presence address is started, otherwise <code>presenceLibrary</code> is queued up in libraries to browse.
 * @param presenceLibrary the library that could not be browsed
 * @param startRevision the revision under which the address resolution attemptwas started
 */
private void handleFailedResolution(PresenceLibrary presenceLibrary,int startRevision){
  LOG.debugf("String_Node_Str",presenceLibrary.getPresence().getPresenceId(),startRevision);
  presenceLibrary.setState(LibraryState.FAILED_TO_LOAD);
  boolean retry;
synchronized (librariesToBrowse) {
    retry=latestConnectivityEventRevision > startRevision;
    if (!retry) {
      LOG.debugf("String_Node_Str",presenceLibrary);
      boolean wasAdded=librariesToBrowse.add(presenceLibrary);
      assert(wasAdded);
    }
 else {
      startRevision=latestConnectivityEventRevision;
      LOG.debugf("String_Node_Str",startRevision);
    }
    LOG.debugf("String_Node_Str",librariesToBrowse,librariesToBrowse.size());
  }
  if (retry) {
    tryToResolveAndBrowse(presenceLibrary,startRevision);
  }
}
Program: 3867
Project: 3867
Buggy source:
@Inject public PresenceLibraryBrowser(BrowseFactory browseFactory,RemoteLibraryManagerImpl remoteLibraryManager,SocketsManager socketsManager,XMPPRemoteFileDescDeserializer remoteFileDescDeserializer){
  this.browseFactory=browseFactory;
  this.remoteLibraryManager=remoteLibraryManager;
  this.socketsManager=socketsManager;
  this.remoteFileDescDeserializer=remoteFileDescDeserializer;
  socketsManager.addListener(new ConnectivityChangeListener());
}

Fixed version (ground truth):
@Inject public PresenceLibraryBrowser(BrowseFactory browseFactory,RemoteLibraryManager remoteLibraryManager,SocketsManager socketsManager,XMPPRemoteFileDescDeserializer remoteFileDescDeserializer){
  this.browseFactory=browseFactory;
  this.remoteLibraryManager=remoteLibraryManager;
  this.socketsManager=socketsManager;
  this.remoteFileDescDeserializer=remoteFileDescDeserializer;
}
Program: 3868
Project: 3868
Buggy source:
@Inject void register(ListenerSupport<LibraryChangedEvent> listenerSupport){
  listenerSupport.addListener(this);
}

Fixed version (ground truth):
@Inject void register(ListenerSupport<LibraryChangedEvent> listenerSupport){
  registerSecondaryListeners();
  listenerSupport.addListener(this);
}
Program: 3869
Project: 3869
Buggy source:
/** 
 * Displays the error to the user with a specific message. 
 */
public void error(Throwable problem,String msg){
  if (problem instanceof ThreadDeath)   throw (ThreadDeath)problem;
 else {
    Runnable doWorkRunnable=new Error(problem,msg);
    SwingUtils.invokeLater(doWorkRunnable);
  }
}

Fixed version (ground truth):
/** 
 * Displays the error to the user with a specific message. 
 */
public void error(Throwable problem,String msg){
  if (problem instanceof ThreadDeath)   throw (ThreadDeath)problem;
 else {
    SwingUtilities.invokeLater(new Error(problem,msg));
  }
}
Program: 3875
Project: 3875
Buggy source:
/** 
 * The base constructor. Nothing should ever be initialized in the constructor. This is because of the way JUnit sets up tests -- It first builds a new instance of the class for every possible test, then it runs through those instances, calling the appropriate test. All pre & post initializations that are necessary for every test should be in the new 'preSetUp' and 'postTearDown' methods.
 */
public BaseTestCase(String name){
  super(name);
  _testClass=getClass();
}

Fixed version (ground truth):
/** 
 * The base constructor. Nothing should ever be initialized in the constructor. This is because of the way JUnit sets up tests -- It first builds a new instance of the class for every possible test, then it runs through those instances, calling the appropriate test. All pre & post initializations that are necessary for every test should be in the new 'preSetUp' and 'postTearDown' methods.
 */
public BaseTestCase(String name){
  super(name);
  _testClass=getClass();
  ErrorUtils.setCallback(this);
  Thread.setDefaultUncaughtExceptionHandler(this);
  Thread.currentThread().setUncaughtExceptionHandler(this);
}
Program: 3876
Project: 3876
Buggy source:
public static boolean isURL(String input){
  Matcher matcher=getRegex().matcher(input);
  return matcher.matches();
}

Fixed version (ground truth):
public static boolean isURL(String input){
  Matcher matcher=getRegex().matcher(input.toLowerCase());
  return matcher.matches();
}
Program: 3877
Project: 3877
Buggy source:
@Override public void download(File saveFile,boolean overwrite) throws SaveLocationException {
  downloadManager.downloadTorrent(saveFile,overwrite);
}

Fixed version (ground truth):
@Override public void download(File saveFile,boolean overwrite) throws SaveLocationException {
  downloadManager.downloadTorrent(torrentFile,overwrite);
}
Program: 3878
Project: 3878
Buggy source:
@Override public void handleTorrent(File torrentFile){
  if (torrentFile != null && torrentFile.exists() && torrentFile.length() > 0) {
    try {
      downloadManager.downloadTorrent(torrentFile,false);
    }
 catch (    SaveLocationException e) {
      handleSaveLocationException(new DownloadAction(){
        @Override public void download(        File saveFile,        boolean overwrite) throws SaveLocationException {
          downloadManager.downloadTorrent(saveFile,overwrite);
        }
      }
,e,false);
    }
  }
}

Fixed version (ground truth):
@Override public void handleTorrent(final File torrentFile){
  if (torrentFile != null && torrentFile.exists() && torrentFile.length() > 0) {
    try {
      downloadManager.downloadTorrent(torrentFile,false);
    }
 catch (    SaveLocationException e) {
      handleSaveLocationException(new DownloadAction(){
        @Override public void download(        File saveFile,        boolean overwrite) throws SaveLocationException {
          downloadManager.downloadTorrent(torrentFile,overwrite);
        }
      }
,e,false);
    }
  }
}
Program: 3879
Project: 3879
Buggy source:
@Override public void handleEvent(DownloadStatusEvent event){
  DownloadStatus downloadStatus=event.getType();
  if (DownloadStatus.COMPLETE == downloadStatus) {
    try {
      if (downloader instanceof BTTorrentFileDownloader) {
        BTTorrentFileDownloader btTorrentFileDownloader=(BTTorrentFileDownloader)downloader;
        BTMetaInfo btMetaInfo=btTorrentFileDownloader.getBtMetaInfo();
        list.remove(getDownloadItem(downloader));
        downloadManager.downloadTorrent(btMetaInfo,true);
      }
 else {
        File possibleTorrentFile=downloader.getSaveFile();
        String fileExtension=FileUtils.getFileExtension(possibleTorrentFile);
        if ("String_Node_Str".equalsIgnoreCase(fileExtension)) {
          list.remove(getDownloadItem(downloader));
          downloadManager.downloadTorrent(possibleTorrentFile,false);
        }
      }
    }
 catch (    SaveLocationException sle) {
      activityCallback.handleSaveLocationException(new DownloadAction(){
        @Override public void download(        File saveFile,        boolean overwrite) throws SaveLocationException {
          list.remove(getDownloadItem(downloader));
          downloadManager.downloadTorrent(saveFile,overwrite);
        }
      }
,sle,false);
    }
  }
}

Fixed version (ground truth):
@Override public void handleEvent(DownloadStatusEvent event){
  DownloadStatus downloadStatus=event.getType();
  if (DownloadStatus.COMPLETE == downloadStatus) {
    if (downloader instanceof BTTorrentFileDownloader) {
      BTMetaInfo btMetaInfo=null;
      try {
        BTTorrentFileDownloader btTorrentFileDownloader=(BTTorrentFileDownloader)downloader;
        btMetaInfo=btTorrentFileDownloader.getBtMetaInfo();
        list.remove(getDownloadItem(downloader));
        downloadManager.downloadTorrent(btMetaInfo,true);
      }
 catch (      SaveLocationException sle) {
        final BTMetaInfo btMetaInfoCopy=btMetaInfo;
        activityCallback.handleSaveLocationException(new DownloadAction(){
          @Override public void download(          File saveFile,          boolean overwrite) throws SaveLocationException {
            list.remove(getDownloadItem(downloader));
            downloadManager.downloadTorrent(btMetaInfoCopy,overwrite);
          }
        }
,sle,false);
      }
    }
 else {
      File possibleTorrentFile=null;
      try {
        possibleTorrentFile=downloader.getSaveFile();
        String fileExtension=FileUtils.getFileExtension(possibleTorrentFile);
        if ("String_Node_Str".equalsIgnoreCase(fileExtension)) {
          list.remove(getDownloadItem(downloader));
          downloadManager.downloadTorrent(possibleTorrentFile,false);
        }
      }
 catch (      SaveLocationException sle) {
        final File torrentFile=possibleTorrentFile;
        activityCallback.handleSaveLocationException(new DownloadAction(){
          @Override public void download(          File saveFile,          boolean overwrite) throws SaveLocationException {
            list.remove(getDownloadItem(downloader));
            downloadManager.downloadTorrent(torrentFile,overwrite);
          }
        }
,sle,false);
      }
    }
  }
}
Program: 3880
Project: 3880
Buggy source:
@Override public void download(File saveFile,boolean overwrite) throws SaveLocationException {
  list.remove(getDownloadItem(downloader));
  downloadManager.downloadTorrent(saveFile,overwrite);
}

Fixed version (ground truth):
@Override public void download(File saveFile,boolean overwrite) throws SaveLocationException {
  list.remove(getDownloadItem(downloader));
  downloadManager.downloadTorrent(torrentFile,overwrite);
}
Program: 3881
Project: 3881
Buggy source:
private void runFileOpen(File file){
  String filename=file.getPath();
  if (filename.endsWith("String_Node_Str")) {
    initializer.setStartup();
  }
 else   if (filename.endsWith("String_Node_Str")) {
    if (!lifecycleManager.isStarted()) {
      externalControl.enqueueControlRequest(file.getAbsolutePath());
    }
 else {
      try {
        downloadManager.downloadTorrent(file,false);
      }
 catch (      SaveLocationException e) {
        activityCallback.handleSaveLocationException(new DownloadAction(){
          @Override public void download(          File saveFile,          boolean overwrite) throws SaveLocationException {
            downloadManager.downloadTorrent(saveFile,overwrite);
          }
        }
,e,false);
      }
    }
  }
 else {
    NativeLaunchUtils.safeLaunchFile(file);
  }
}

Fixed version (ground truth):
private void runFileOpen(final File file){
  String filename=file.getPath();
  if (filename.endsWith("String_Node_Str")) {
    initializer.setStartup();
  }
 else   if (filename.endsWith("String_Node_Str")) {
    if (!lifecycleManager.isStarted()) {
      externalControl.enqueueControlRequest(file.getAbsolutePath());
    }
 else {
      try {
        downloadManager.downloadTorrent(file,false);
      }
 catch (      SaveLocationException e) {
        activityCallback.handleSaveLocationException(new DownloadAction(){
          @Override public void download(          File saveFile,          boolean overwrite) throws SaveLocationException {
            downloadManager.downloadTorrent(file,overwrite);
          }
        }
,e,false);
      }
    }
  }
 else {
    NativeLaunchUtils.safeLaunchFile(file);
  }
}
Program: 3882
Project: 3882
Buggy source:
@Override public void download(File saveFile,boolean overwrite) throws SaveLocationException {
  downloadManager.downloadTorrent(saveFile,overwrite);
}

Fixed version (ground truth):
@Override public void download(File saveFile,boolean overwrite) throws SaveLocationException {
  downloadManager.downloadTorrent(file,overwrite);
}
Program: 3883
Project: 3883
Buggy source:
@Override public void run(){
  resultsList.setIgnoreRepaints(true);
  boolean setRowSize=false;
  for (int row=0; row < model.getRowCount(); row++) {
    VisualSearchResult vsr=(VisualSearchResult)model.getElementAt(row);
    RowDisplayResult result=vsrToRowDisplayResultMap.get(vsr);
    if (result == null || result.isStale(vsr)) {
      result=rowHeightRule.getDisplayResult(vsr,searchInfo.getQuery());
      vsrToRowDisplayResultMap.put(vsr,result);
    }
    int newRowHeight=result.getConfig().getRowHeight();
    if (resultsList.getRowHeight(row) != newRowHeight) {
      LOG.debugf("String_Node_Str",row,vsr.getHeading(),result.getConfig());
      resultsList.setRowHeight(row,newRowHeight);
      setRowSize=true;
    }
  }
  resultsList.setIgnoreRepaints(false);
  if (setRowSize) {
    if (resultsList.isEditing()) {
      resultsList.editingCanceled(new ChangeEvent(resultsList));
    }
    resultsList.updateViewSizeSequence();
    resultsList.resizeAndRepaint();
  }
}

Fixed version (ground truth):
@Override public void run(){
  resultsList.setIgnoreRepaints(true);
  boolean setRowSize=false;
  for (int row=0; row < model.getRowCount(); row++) {
    VisualSearchResult vsr=(VisualSearchResult)model.getElementAt(row);
    RowDisplayResult result=vsrToRowDisplayResultMap.get(vsr);
    if (result == null || result.isStale(vsr)) {
      result=rowHeightRule.getDisplayResult(vsr,searchInfo.getQuery());
      vsrToRowDisplayResultMap.put(vsr,result);
    }
    int newRowHeight=result.getConfig().getRowHeight();
    if (vsr.getSimilarityParent() == null) {
      if (resultsList.getRowHeight(row) != newRowHeight) {
        LOG.debugf("String_Node_Str",row,vsr.getHeading(),result.getConfig());
        resultsList.setRowHeight(row,newRowHeight);
        setRowSize=true;
      }
    }
  }
  resultsList.setIgnoreRepaints(false);
  if (setRowSize) {
    if (resultsList.isEditing()) {
      resultsList.editingCanceled(new ChangeEvent(resultsList));
    }
    resultsList.updateViewSizeSequence();
    resultsList.resizeAndRepaint();
  }
}
Program: 3884
Project: 3884
Buggy source:
@Override public void listChanged(ListEvent<VisualSearchResult> listChanges){
  final EventTableModel model=(EventTableModel)resultsList.getModel();
  if (model.getRowCount() == 0) {
    return;
  }
  Runnable runner=new Runnable(){
    @Override public void run(){
      resultsList.setIgnoreRepaints(true);
      boolean setRowSize=false;
      for (int row=0; row < model.getRowCount(); row++) {
        VisualSearchResult vsr=(VisualSearchResult)model.getElementAt(row);
        RowDisplayResult result=vsrToRowDisplayResultMap.get(vsr);
        if (result == null || result.isStale(vsr)) {
          result=rowHeightRule.getDisplayResult(vsr,searchInfo.getQuery());
          vsrToRowDisplayResultMap.put(vsr,result);
        }
        int newRowHeight=result.getConfig().getRowHeight();
        if (resultsList.getRowHeight(row) != newRowHeight) {
          LOG.debugf("String_Node_Str",row,vsr.getHeading(),result.getConfig());
          resultsList.setRowHeight(row,newRowHeight);
          setRowSize=true;
        }
      }
      resultsList.setIgnoreRepaints(false);
      if (setRowSize) {
        if (resultsList.isEditing()) {
          resultsList.editingCanceled(new ChangeEvent(resultsList));
        }
        resultsList.updateViewSizeSequence();
        resultsList.resizeAndRepaint();
      }
    }
  }
;
  SwingUtilities.invokeLater(runner);
}

Fixed version (ground truth):
@Override public void listChanged(ListEvent<VisualSearchResult> listChanges){
  final EventTableModel model=(EventTableModel)resultsList.getModel();
  if (model.getRowCount() == 0) {
    return;
  }
  Runnable runner=new Runnable(){
    @Override public void run(){
      resultsList.setIgnoreRepaints(true);
      boolean setRowSize=false;
      for (int row=0; row < model.getRowCount(); row++) {
        VisualSearchResult vsr=(VisualSearchResult)model.getElementAt(row);
        RowDisplayResult result=vsrToRowDisplayResultMap.get(vsr);
        if (result == null || result.isStale(vsr)) {
          result=rowHeightRule.getDisplayResult(vsr,searchInfo.getQuery());
          vsrToRowDisplayResultMap.put(vsr,result);
        }
        int newRowHeight=result.getConfig().getRowHeight();
        if (vsr.getSimilarityParent() == null) {
          if (resultsList.getRowHeight(row) != newRowHeight) {
            LOG.debugf("String_Node_Str",row,vsr.getHeading(),result.getConfig());
            resultsList.setRowHeight(row,newRowHeight);
            setRowSize=true;
          }
        }
      }
      resultsList.setIgnoreRepaints(false);
      if (setRowSize) {
        if (resultsList.isEditing()) {
          resultsList.editingCanceled(new ChangeEvent(resultsList));
        }
        resultsList.updateViewSizeSequence();
        resultsList.resizeAndRepaint();
      }
    }
  }
;
  SwingUtilities.invokeLater(runner);
}
Program: 3887
Project: 3887
Buggy source:
/** 
 * Allows a soft localised refresh of the text within the panel based on the language selected in the combo box.
 */
private void setTextContents(){
  String heading=I18n.tr("String_Node_Str");
  String bodyText1=I18n.tr("String_Node_Str");
  String copyText=I18n.tr("String_Node_Str");
  String privacyText=I18n.tr("String_Node_Str");
  String licenseText=I18n.tr("String_Node_Str");
  String agreementText=I18n.tr("String_Node_Str");
  String languageText=I18n.tr("String_Node_Str");
  Action exitAction=new AbstractAction(I18n.tr("String_Node_Str")){
    @Override public void actionPerformed(    ActionEvent e){
      finish(false);
    }
  }
;
  Action agreeAction=new AbstractAction(I18n.tr("String_Node_Str")){
    @Override public void actionPerformed(    ActionEvent e){
      finish(true);
    }
  }
;
  headingLabel.setText(heading);
  bodyLabel.setText(bodyText1);
  copyrightButton.setText(copyText);
  agreementButton.setText(privacyText);
  privacyButton.setText(licenseText);
  agreeLabel.setText(agreementText);
  languageLabel.setText(languageText);
  exitButton.setAction(exitAction);
  agreeButton.setAction(agreeAction);
}

Fixed version (ground truth):
/** 
 * Allows a soft localised refresh of the text within the panel based on the language selected in the combo box.
 */
private void setTextContents(){
  String heading=I18n.tr("String_Node_Str");
  String bodyText1=I18n.tr("String_Node_Str");
  String copyText=I18n.tr("String_Node_Str");
  String privacyText=I18n.tr("String_Node_Str");
  String licenseText=I18n.tr("String_Node_Str");
  String agreementText=I18n.tr("String_Node_Str");
  String languageText=I18n.tr("String_Node_Str");
  Action exitAction=new AbstractAction(I18n.tr("String_Node_Str")){
    @Override public void actionPerformed(    ActionEvent e){
      finish(false);
    }
  }
;
  Action agreeAction=new AbstractAction(I18n.tr("String_Node_Str")){
    @Override public void actionPerformed(    ActionEvent e){
      finish(true);
    }
  }
;
  headingLabel.setText(heading);
  bodyLabel.setText(bodyText1);
  copyrightButton.setText(copyText);
  licenseButton.setText(licenseText);
  privacyButton.setText(privacyText);
  agreeLabel.setText(agreementText);
  languageLabel.setText(languageText);
  exitButton.setAction(exitAction);
  agreeButton.setAction(agreeAction);
}
Program: 3888
Project: 3888
Buggy source:
/** 
 * Handles the specified SaveLocationException. The method may prompt the user for input, and should be executed from the UI thread.
 */
private void handleException(final DownloadAction downLoadAction,final SaveLocationException sle,final boolean supportNewSaveDir){
  if (sle.getErrorCode() == SaveLocationException.LocationCode.FILE_ALREADY_DOWNLOADING) {
    return;
  }
  if ((sle.getErrorCode() != SaveLocationException.LocationCode.FILE_ALREADY_EXISTS) && (sle.getErrorCode() != SaveLocationException.LocationCode.FILE_IS_ALREADY_DOWNLOADED_TO)) {
    String message=I18n.tr("String_Node_Str",sle.getErrorCode(),sle.getFile());
    LOG.error(message,sle);
    FocusJOptionPane.showMessageDialog(GuiUtils.getMainFrame(),message,I18n.tr("String_Node_Str"),JOptionPane.INFORMATION_MESSAGE);
    return;
  }
  File saveFile=null;
  if (supportNewSaveDir && SwingUiSettings.AUTO_RENAME_DUPLICATE_FILES.getValue()) {
    saveFile=getAutoSaveFile(sle);
  }
 else {
    if (supportNewSaveDir) {
      saveFile=FileChooser.getSaveAsFile(GuiUtils.getMainFrame(),I18n.tr("String_Node_Str"),sle.getFile());
    }
 else {
      saveFile=sle.getFile();
    }
    if (saveFile == null) {
      return;
    }
  }
  if (saveFile.exists()) {
    createOverwriteDialogue(saveFile,downLoadAction,sle,supportNewSaveDir);
  }
 else {
    download(downLoadAction,supportNewSaveDir,saveFile,false);
  }
}

Fixed version (ground truth):
/** 
 * Handles the specified SaveLocationException. The method may prompt the user for input, and should be executed from the UI thread.
 */
private void handleException(final DownloadAction downLoadAction,final SaveLocationException sle,final boolean supportNewSaveDir){
  if (sle.getErrorCode() == SaveLocationException.LocationCode.FILE_ALREADY_DOWNLOADING) {
    return;
  }
  if ((sle.getErrorCode() != SaveLocationException.LocationCode.FILE_ALREADY_EXISTS) && (sle.getErrorCode() != SaveLocationException.LocationCode.FILE_IS_ALREADY_DOWNLOADED_TO)) {
    showErrorMessage(sle);
    return;
  }
 else   if (sle.getErrorCode() == SaveLocationException.LocationCode.FILE_IS_ALREADY_DOWNLOADED_TO && !supportNewSaveDir) {
    showErrorMessage(sle);
    return;
  }
  File saveFile=null;
  if (supportNewSaveDir && SwingUiSettings.AUTO_RENAME_DUPLICATE_FILES.getValue()) {
    saveFile=getAutoSaveFile(sle);
  }
 else {
    if (supportNewSaveDir) {
      saveFile=FileChooser.getSaveAsFile(GuiUtils.getMainFrame(),I18n.tr("String_Node_Str"),sle.getFile());
    }
 else {
      saveFile=sle.getFile();
    }
    if (saveFile == null) {
      return;
    }
  }
  if (saveFile.exists()) {
    createOverwriteDialogue(saveFile,downLoadAction,sle,supportNewSaveDir);
  }
 else {
    download(downLoadAction,supportNewSaveDir,saveFile,false);
  }
}
Program: 3890
Project: 3890
Buggy source:
private void decorateEditorPane(JEditorPane editor){
  editor.setOpaque(false);
  editor.setEditable(false);
  editor.setPreferredSize(new Dimension(100,30));
}

Fixed version (ground truth):
private void decorateEditorPane(JEditorPane editor){
  editor.setOpaque(false);
  editor.setBorder(BorderFactory.createEmptyBorder());
  editor.setEditable(false);
  editor.setPreferredSize(new Dimension(100,20));
}
Program: 3891
Project: 3891
Buggy source:
public void setupColumnOrder(){
  stopListening();
  for (int i=0; i < table.getColumnCount(); i++) {
    TableColumnExt column=table.getColumnExt(i);
    ColumnStateInfo info=format.getColumnInfo(column.getModelIndex());
    if (i != info.getPreferredViewIndex()) {
      if (info.getPreferredViewIndex() >= 0 && info.getPreferredViewIndex() < table.getColumnCount()) {
        table.getColumnModel().moveColumn(i,info.getPreferredViewIndex());
      }
    }
  }
  startListening();
}

Fixed version (ground truth):
/** 
 * Sets the column order of the table based on the preffered index of each column. Because table.getColumnModel.move is not stable. Meaning moving an item to index 2 might  move the item already there to the left, or maybe to the right. We have to jump through a few hoops to make it stable. First we make a list ordering all columns in the reverse preffered order, then move each item from where it currently is in the column model to the zero index. Since items cannot be moved to the left of the zero index this makes the move stable, and places the items in the proper preffered index order.
 */
public void setupColumnOrder(){
  stopListening();
  List<TableColumn> columns=new ArrayList<TableColumn>();
  for (int i=0; i < table.getColumnCount(); i++) {
    TableColumn tableColumn=table.getColumn(i);
    columns.add(tableColumn);
  }
  Collections.sort(columns,new Comparator<TableColumn>(){
    @Override public int compare(    TableColumn o1,    TableColumn o2){
      ColumnStateInfo info1=format.getColumnInfo(o1.getModelIndex());
      ColumnStateInfo info2=format.getColumnInfo(o2.getModelIndex());
      Integer prefferedIndex1=info1.getPreferredViewIndex();
      Integer prefferedIndex2=info2.getPreferredViewIndex();
      return prefferedIndex1.compareTo(prefferedIndex2) * -1;
    }
  }
);
  for (  TableColumn tableColumn : columns) {
    int currentIndex=getCurrentIndex(tableColumn);
    if (currentIndex > 0 && currentIndex < table.getColumnCount()) {
      table.getColumnModel().moveColumn(currentIndex,0);
    }
  }
  startListening();
}