nus-yam/ex-repair huggingface dataset:
Program: 3790
Project: 3790
Buggy source:
/** 
 * Returns a Predicate<String> to use for your query. 
 */
public Predicate<String> getPredicateForQuery(QueryRequest query){
  if (query.desiresAll()) {
    return Predicates.alwaysTrue();
  }
  List<Predicate<String>> predicates=new ArrayList<Predicate<String>>();
  if (query.desiresLinuxOSXPrograms()) {
    predicates.add(categoryManager.getOsxAndLinuxProgramsFilter());
  }
  if (query.desiresWindowsPrograms()) {
    predicates.add(categoryManager.getWindowsProgramsFilter());
  }
  if (query.desiresDocuments()) {
    predicates.add(categoryManager.getFilterForCategory(Category.DOCUMENT));
  }
  if (query.desiresAudio()) {
    predicates.add(categoryManager.getFilterForCategory(Category.AUDIO));
  }
  if (query.desiresVideo()) {
    predicates.add(categoryManager.getFilterForCategory(Category.VIDEO));
  }
  if (query.desiresImages()) {
    predicates.add(categoryManager.getFilterForCategory(Category.IMAGE));
  }
  return Predicates.or(predicates);
}

Fixed version (ground truth):
/** 
 * Returns a Predicate<String> to use for your query. 
 */
public Predicate<String> getPredicateForQuery(QueryRequest query){
  if (query.desiresAll()) {
    return Predicates.alwaysTrue();
  }
  List<Predicate<String>> predicates=new ArrayList<Predicate<String>>();
  if (query.desiresLinuxOSXPrograms()) {
    predicates.add(categoryManager.getOsxAndLinuxProgramsFilter());
  }
  if (query.desiresWindowsPrograms()) {
    predicates.add(categoryManager.getWindowsProgramsFilter());
  }
  if (query.desiresDocuments()) {
    predicates.add(categoryManager.getExtensionFilterForCategory(Category.DOCUMENT));
  }
  if (query.desiresAudio()) {
    predicates.add(categoryManager.getExtensionFilterForCategory(Category.AUDIO));
  }
  if (query.desiresVideo()) {
    predicates.add(categoryManager.getExtensionFilterForCategory(Category.VIDEO));
  }
  if (query.desiresImages()) {
    predicates.add(categoryManager.getExtensionFilterForCategory(Category.IMAGE));
  }
  return Predicates.or(predicates);
}
Program: 3791
Project: 3791
Buggy source:
/** 
 * Returns true if response has the same media type as the corresponding query request the given GUID.  In the rare case that guid is not known (because this' buffers overflowed), conservatively returns true.
 */
public boolean matchesType(byte[] guid,Response response){
  RequestData request=mapper.get(new GUID(guid));
  if (request == null || request.type == null)   return true;
  String reply=response.getName();
  Category category=request.type.getCategory();
  if (category != null) {
    String extension=FileUtils.getFileExtension(reply);
    return categoryManager.getFilterForCategory(category).apply(extension);
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
/** 
 * Returns true if response has the same media type as the corresponding query request the given GUID.  In the rare case that guid is not known (because this' buffers overflowed), conservatively returns true.
 */
public boolean matchesType(byte[] guid,Response response){
  RequestData request=mapper.get(new GUID(guid));
  if (request == null || request.type == null)   return true;
  String reply=response.getName();
  Category category=request.type.getCategory();
  if (category != null) {
    return categoryManager.getCategoryForFilename(reply) == category;
  }
 else {
    return true;
  }
}
Program: 3793
Project: 3793
Buggy source:
/** 
 * Returns the save file from the default save directory.
 */
@Override protected File getDefaultSaveFile(){
  String fileName=getDefaultFileName();
  Category category=null;
  if (fileName != null) {
    category=categoryManager.getCategoryForExtension(FileUtils.getFileExtension(fileName));
  }
  return new File(SharingSettings.getSaveDirectory(category),fileName);
}

Fixed version (ground truth):
/** 
 * Returns the save file from the default save directory.
 */
@Override protected File getDefaultSaveFile(){
  String fileName=getDefaultFileName();
  Category category=null;
  if (fileName != null) {
    category=categoryManager.getCategoryForFilename(fileName);
  }
  return new File(SharingSettings.getSaveDirectory(category),fileName);
}
Program: 3794
Project: 3794
Buggy source:
private File getIncompleteFile(SerialManagedDownloader download,SerialIncompleteFileManager sifm){
  URN sha1=getSha1(download);
  File incompleteFile=null;
  if (download instanceof SerialResumeDownloader)   incompleteFile=((SerialResumeDownloader)download).getIncompleteFile();
  if (sha1 != null)   incompleteFile=sifm.getHashes().get(sha1);
  if (incompleteFile == null) {
    File saveFile=(File)download.getProperties().get("String_Node_Str");
    if (saveFile != null) {
      String defaultName=(String)download.getProperties().get("String_Node_Str");
      if (defaultName != null) {
        Category category=categoryManager.getCategoryForExtension(FileUtils.getFileExtension(defaultName));
        saveFile=new File(SharingSettings.getSaveDirectory(category),defaultName);
      }
    }
    Number size=(Number)download.getProperties().get("String_Node_Str");
    if (download instanceof SerialResumeDownloader)     size=((SerialResumeDownloader)download).getSize();
    if (saveFile != null && size != null) {
      String name=CommonUtils.convertFileName(saveFile.getName());
      incompleteFile=new File(SharingSettings.INCOMPLETE_DIRECTORY.get(),"String_Node_Str" + size.longValue() + "String_Node_Str"+ name);
    }
  }
  return incompleteFile;
}

Fixed version (ground truth):
private File getIncompleteFile(SerialManagedDownloader download,SerialIncompleteFileManager sifm){
  URN sha1=getSha1(download);
  File incompleteFile=null;
  if (download instanceof SerialResumeDownloader)   incompleteFile=((SerialResumeDownloader)download).getIncompleteFile();
  if (sha1 != null)   incompleteFile=sifm.getHashes().get(sha1);
  if (incompleteFile == null) {
    File saveFile=(File)download.getProperties().get("String_Node_Str");
    if (saveFile != null) {
      String defaultName=(String)download.getProperties().get("String_Node_Str");
      if (defaultName != null) {
        Category category=categoryManager.getCategoryForFilename(defaultName);
        saveFile=new File(SharingSettings.getSaveDirectory(category),defaultName);
      }
    }
    Number size=(Number)download.getProperties().get("String_Node_Str");
    if (download instanceof SerialResumeDownloader)     size=((SerialResumeDownloader)download).getSize();
    if (saveFile != null && size != null) {
      String name=CommonUtils.convertFileName(saveFile.getName());
      incompleteFile=new File(SharingSettings.INCOMPLETE_DIRECTORY.get(),"String_Node_Str" + size.longValue() + "String_Node_Str"+ name);
    }
  }
  return incompleteFile;
}
Program: 3795
Project: 3795
Buggy source:
@Override public boolean allow(QueryReply qr,Response response){
  String extension=FileUtils.getFileExtension(response.getName());
  if (categoryManager.getFilterForCategory(Category.PROGRAM).apply(extension)) {
    return LibrarySettings.ALLOW_PROGRAMS.getValue();
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
@Override public boolean allow(QueryReply qr,Response response){
  if (categoryManager.getCategoryForFilename(response.getName()) == Category.PROGRAM) {
    return LibrarySettings.ALLOW_PROGRAMS.getValue();
  }
 else {
    return true;
  }
}
Program: 3796
Project: 3796
Buggy source:
/** 
 * Checks to make sure that the file is not a document before adding file to managed file list. Returns true if the files was not a document, false otherwise. 
 */
private boolean addManagedFile(LibraryFileData newData,File file){
  Category category=categoryManager.getCategoryForExtension(FileUtils.getFileExtension(file));
  if (category != Category.DOCUMENT && category != Category.PROGRAM) {
    newData.addManagedFile(file);
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks to make sure that the file is not a document before adding file to managed file list. Returns true if the files was not a document, false otherwise. 
 */
private boolean addManagedFile(LibraryFileData newData,File file){
  Category category=categoryManager.getCategoryForFile(file);
  if (category != Category.DOCUMENT && category != Category.PROGRAM) {
    newData.addManagedFile(file);
    return true;
  }
  return false;
}
Program: 3797
Project: 3797
Buggy source:
@Override public boolean isFileAddable(File file){
  if (file == null) {
    return false;
  }
  if (file.isDirectory()) {
    return isDirectoryAllowed(file);
  }
  Category category=categoryManager.getCategoryForExtension(FileUtils.getFileExtension(file));
  if (category == Category.PROGRAM && !LibrarySettings.ALLOW_PROGRAMS.getValue()) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean isFileAddable(File file){
  if (file == null) {
    return false;
  }
  if (file.isDirectory()) {
    return isDirectoryAllowed(file);
  }
  Category category=categoryManager.getCategoryForFile(file);
  if (category == Category.PROGRAM && !LibrarySettings.ALLOW_PROGRAMS.getValue()) {
    return false;
  }
  return true;
}
Program: 3798
Project: 3798
Buggy source:
@Override public boolean isFileAddable(File file){
  if (!library.isFileAddable(file)) {
    return false;
  }
  if (isPublic()) {
    Category category=categoryManager.getCategoryForExtension(FileUtils.getFileExtension(file));
    if (category == Category.DOCUMENT && !LibrarySettings.ALLOW_DOCUMENT_GNUTELLA_SHARING.getValue()) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean isFileAddable(File file){
  if (!library.isFileAddable(file)) {
    return false;
  }
  if (isPublic()) {
    Category category=categoryManager.getCategoryForFile(file);
    if (category == Category.DOCUMENT && !LibrarySettings.ALLOW_DOCUMENT_GNUTELLA_SHARING.getValue()) {
      return false;
    }
  }
  return true;
}
Program: 3799
Project: 3799
Buggy source:
private Set<Response> queryFileNames(QueryRequest request){
  String str=request.getQuery();
  boolean includeXML=request.shouldIncludeXMLInResponse();
  str=keywordTrie.canonicalCase(str);
  IntSet matches=search(str,null,request.desiresPartialResults());
  if (request.getQueryUrns().size() > 0)   matches=urnSearch(request.getQueryUrns(),matches);
  if (matches == null)   return Collections.emptySet();
  Set<Response> responses=new HashSet<Response>();
  Predicate<String> filter=mediaTypeAggregator.getPredicateForQuery(request);
  LimeXMLDocument doc=request.getRichQuery();
  for (IntSet.IntSetIterator iter=matches.iterator(); iter.hasNext(); ) {
    int i=iter.next();
    FileDesc desc=gnutellaFileView.getFileDescForIndex(i);
    if (desc == null) {
      desc=incompleteFileView.getFileDescForIndex(i);
    }
    if (desc != null) {
      if (!filter.apply(desc.getFileName()))       continue;
      activityCallback.handleSharedFileUpdate(desc.getFile());
      Response resp=responseFactory.get().createResponse(desc);
      if (includeXML) {
        if (doc != null && resp.getDocument() != null && !isValidXMLMatch(resp,doc))         continue;
      }
 else {
        resp.setDocument(null);
      }
      responses.add(resp);
    }
  }
  if (responses.size() == 0)   return Collections.emptySet();
  return responses;
}

Fixed version (ground truth):
private Set<Response> queryFileNames(QueryRequest request){
  String str=request.getQuery();
  boolean includeXML=request.shouldIncludeXMLInResponse();
  str=keywordTrie.canonicalCase(str);
  IntSet matches=search(str,null,request.desiresPartialResults());
  if (request.getQueryUrns().size() > 0)   matches=urnSearch(request.getQueryUrns(),matches);
  if (matches == null)   return Collections.emptySet();
  Set<Response> responses=new HashSet<Response>();
  Predicate<String> filter=mediaTypeAggregator.getPredicateForQuery(request);
  LimeXMLDocument doc=request.getRichQuery();
  for (IntSet.IntSetIterator iter=matches.iterator(); iter.hasNext(); ) {
    int i=iter.next();
    FileDesc desc=gnutellaFileView.getFileDescForIndex(i);
    if (desc == null) {
      desc=incompleteFileView.getFileDescForIndex(i);
    }
    if (desc != null) {
      if (!filter.apply(FileUtils.getFileExtension(desc.getFileName()))) {
        continue;
      }
      activityCallback.handleSharedFileUpdate(desc.getFile());
      Response resp=responseFactory.get().createResponse(desc);
      if (includeXML) {
        if (doc != null && resp.getDocument() != null && !isValidXMLMatch(resp,doc))         continue;
      }
 else {
        resp.setDocument(null);
      }
      responses.add(resp);
    }
  }
  if (responses.size() == 0)   return Collections.emptySet();
  return responses;
}
Program: 3800
Project: 3800
Buggy source:
@Override public File getSaveFile(){
  String fileName=getIncompleteFile().getName();
  Category category=categoryManager.getCategoryForExtension(FileUtils.getFileExtension(fileName));
  File saveFile=new File(SharingSettings.getSaveDirectory(category),fileName);
  return saveFile;
}

Fixed version (ground truth):
@Override public File getSaveFile(){
  String fileName=getIncompleteFile().getName();
  Category category=categoryManager.getCategoryForFilename(fileName);
  File saveFile=new File(SharingSettings.getSaveDirectory(category),fileName);
  return saveFile;
}
Program: 3802
Project: 3802
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  Category category=categoryManager.getCategoryForExtension(FileUtils.getFileExtension(file));
switch (category) {
case AUDIO:
    PlayerUtils.playOrLaunch(file,categoryManager);
  break;
case DOCUMENT:
case IMAGE:
case VIDEO:
NativeLaunchUtils.safeLaunchFile(file,categoryManager);
break;
case PROGRAM:
case OTHER:
NativeLaunchUtils.launchExplorer(file);
break;
default :
break;
}
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  Category category=categoryManager.getCategoryForFile(file);
switch (category) {
case AUDIO:
    PlayerUtils.playOrLaunch(file,categoryManager);
  break;
case DOCUMENT:
case IMAGE:
case VIDEO:
NativeLaunchUtils.safeLaunchFile(file,categoryManager);
break;
case PROGRAM:
case OTHER:
NativeLaunchUtils.launchExplorer(file);
break;
default :
break;
}
}
Program: 3803
Project: 3803
Buggy source:
private void addRecentDownloadAction(final File file){
  add(new AbstractAction(file.getName()){
    @Override public void actionPerformed(    ActionEvent e){
      Category category=categoryManager.getCategoryForExtension(FileUtils.getFileExtension(file));
switch (category) {
case AUDIO:
        PlayerUtils.playOrLaunch(file,categoryManager);
      break;
case DOCUMENT:
case IMAGE:
case VIDEO:
    NativeLaunchUtils.safeLaunchFile(file,categoryManager);
  break;
case PROGRAM:
case OTHER:
NativeLaunchUtils.launchExplorer(file);
break;
default :
break;
}
}
}
);
}

Fixed version (ground truth):
private void addRecentDownloadAction(final File file){
  add(new AbstractAction(file.getName()){
    @Override public void actionPerformed(    ActionEvent e){
      Category category=categoryManager.getCategoryForFile(file);
switch (category) {
case AUDIO:
        PlayerUtils.playOrLaunch(file,categoryManager);
      break;
case DOCUMENT:
case IMAGE:
case VIDEO:
    NativeLaunchUtils.safeLaunchFile(file,categoryManager);
  break;
case PROGRAM:
case OTHER:
NativeLaunchUtils.launchExplorer(file);
break;
default :
break;
}
}
}
);
}
Program: 3804
Project: 3804
Buggy source:
@Inject public FirewallOptionPanel(NetworkManager networkManager){
  super();
  this.networkManager=networkManager;
  setLayout(new MigLayout("String_Node_Str","String_Node_Str","String_Node_Str"));
  setOpaque(false);
  add(getListeningPortPanel(),"String_Node_Str");
  add(getRouterConfigPanel(),"String_Node_Str");
}

Fixed version (ground truth):
@Inject public FirewallOptionPanel(NetworkManager networkManager){
  super();
  this.networkManager=networkManager;
  setLayout(new MigLayout("String_Node_Str"));
  setOpaque(false);
  add(getListeningPortPanel(),"String_Node_Str");
  add(getRouterConfigPanel(),"String_Node_Str");
}
Program: 3805
Project: 3805
Buggy source:
private JPanel getPerformancePanel(){
  JPanel p=new JPanel();
  p.setBorder(BorderFactory.createTitledBorder("String_Node_Str"));
  p.setLayout(new MigLayout());
  p.setOpaque(false);
  disableUltraPeerCheckBox=new JCheckBox(I18n.tr("String_Node_Str"));
  disableMojitoCheckBox=new JCheckBox(I18n.tr("String_Node_Str"));
  disableTLS=new JCheckBox(I18n.tr("String_Node_Str"));
  disableOutOfBandSearchCheckBox=new JCheckBox(I18n.tr("String_Node_Str"));
  disableUltraPeerCheckBox.setOpaque(false);
  disableMojitoCheckBox.setOpaque(false);
  disableTLS.setOpaque(false);
  disableOutOfBandSearchCheckBox.setOpaque(false);
  p.add(new MultiLineLabel(firstMultiLineLabel,ReallyAdvancedOptionPanel.MULTI_LINE_LABEL_WIDTH),"String_Node_Str");
  p.add(disableUltraPeerCheckBox,"String_Node_Str");
  p.add(disableMojitoCheckBox,"String_Node_Str");
  p.add(new MultiLineLabel(secondMultiLineLabel,ReallyAdvancedOptionPanel.MULTI_LINE_LABEL_WIDTH),"String_Node_Str");
  p.add(disableTLS,"String_Node_Str");
  p.add(new MultiLineLabel(thirdMultiLineLabel,ReallyAdvancedOptionPanel.MULTI_LINE_LABEL_WIDTH),"String_Node_Str");
  p.add(disableOutOfBandSearchCheckBox,"String_Node_Str");
  return p;
}

Fixed version (ground truth):
private JPanel getPerformancePanel(){
  JPanel p=new JPanel();
  p.setBorder(BorderFactory.createTitledBorder("String_Node_Str"));
  p.setLayout(new MigLayout("String_Node_Str"));
  p.setOpaque(false);
  disableUltraPeerCheckBox=new JCheckBox(I18n.tr("String_Node_Str"));
  disableMojitoCheckBox=new JCheckBox(I18n.tr("String_Node_Str"));
  disableTLS=new JCheckBox(I18n.tr("String_Node_Str"));
  disableOutOfBandSearchCheckBox=new JCheckBox(I18n.tr("String_Node_Str"));
  disableUltraPeerCheckBox.setOpaque(false);
  disableMojitoCheckBox.setOpaque(false);
  disableTLS.setOpaque(false);
  disableOutOfBandSearchCheckBox.setOpaque(false);
  p.add(new MultiLineLabel(firstMultiLineLabel,ReallyAdvancedOptionPanel.MULTI_LINE_LABEL_WIDTH),"String_Node_Str");
  p.add(disableUltraPeerCheckBox,"String_Node_Str");
  p.add(disableMojitoCheckBox,"String_Node_Str");
  p.add(new MultiLineLabel(secondMultiLineLabel,ReallyAdvancedOptionPanel.MULTI_LINE_LABEL_WIDTH),"String_Node_Str");
  p.add(disableTLS,"String_Node_Str");
  p.add(new MultiLineLabel(thirdMultiLineLabel,ReallyAdvancedOptionPanel.MULTI_LINE_LABEL_WIDTH),"String_Node_Str");
  p.add(disableOutOfBandSearchCheckBox,"String_Node_Str");
  return p;
}
Program: 3806
Project: 3806
Buggy source:
@Inject public SpamOptionPanel(SpamManager spamManager){
  this.spamManager=spamManager;
  setLayout(new MigLayout("String_Node_Str","String_Node_Str","String_Node_Str"));
  setOpaque(false);
  add(getClearPanel(),"String_Node_Str");
}

Fixed version (ground truth):
@Inject public SpamOptionPanel(SpamManager spamManager){
  this.spamManager=spamManager;
  setLayout(new MigLayout("String_Node_Str"));
  setOpaque(false);
  add(getClearPanel(),"String_Node_Str");
}
Program: 3811
Project: 3811
Buggy source:
@Override public void propertyChange(PropertyChangeEvent evt){
  if (evt.getPropertyName().equals("String_Node_Str")) {
    if (propertiableFile instanceof LocalFileItem && ((LocalFileItem)propertiableFile).getFile().equals(evt.getOldValue())) {
      propertiableFile=libraryManager.getLibraryManagedList().getFileItem((File)evt.getNewValue());
      for (      FileInfoPanel panel : cards.values()) {
        panel.updatePropertiableFile(propertiableFile);
      }
      overviewPanel.updatePropertiableFile(propertiableFile);
    }
  }
}

Fixed version (ground truth):
@Override public void propertyChange(PropertyChangeEvent evt){
  if (evt.getPropertyName().equals("String_Node_Str")) {
    if (propertiableFile instanceof LocalFileItem && ((LocalFileItem)propertiableFile).getFile().equals(evt.getOldValue())) {
      propertiableFile=libraryManager.getLibraryManagedList().getFileItem((File)evt.getNewValue());
      for (      FileInfoPanel panel : cards.values()) {
        panel.updatePropertiableFile(propertiableFile);
      }
      overviewPanel.updatePropertiableFile(propertiableFile);
      updateTitle(propertiableFile.getFileName());
    }
  }
}
Program: 3812
Project: 3812
Buggy source:
@Override public void setSaveFile(File saveFile,boolean overwrite) throws DownloadException {
  File saveDir=null;
  String fileName=null;
  if (saveFile != null) {
    if (saveFile.isDirectory()) {
      saveDir=saveFile;
    }
 else {
      saveDir=saveFile.getParentFile();
      fileName=saveFile.getName();
    }
  }
  downloader.setSaveFile(saveDir,fileName,overwrite);
}

Fixed version (ground truth):
@Override public void setSaveFile(File saveFile,boolean overwrite) throws DownloadException {
  File saveDir=null;
  String fileName=null;
  if (saveFile != null) {
    if (saveFile.isDirectory()) {
      saveDir=saveFile;
      fileName=getFileName();
    }
 else {
      saveDir=saveFile.getParentFile();
      fileName=saveFile.getName();
    }
  }
  downloader.setSaveFile(saveDir,fileName,overwrite);
}
Program: 3814
Project: 3814
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  dialog.dispose();
  File saveFile=ex.getFile();
  File oldSaveFile=saveFile;
  File oldSaveFileParent=saveFile != null && saveFile.getParentFile() != null ? saveFile.getParentFile() : saveFile;
  saveFile=FileChooser.getInputDirectory(GuiUtils.getMainFrame(),I18n.tr("String_Node_Str"),I18n.tr("String_Node_Str"),oldSaveFileParent);
  File newSaveParent=saveFile;
  if (newSaveParent != null && new File(newSaveParent,oldSaveFile.getName()).exists()) {
    createOverwriteDialogue(newSaveParent,downLoadAction,ex,supportNewSaveFileName);
    return;
  }
 else   if (saveFile != null) {
    download(downLoadAction,supportNewSaveFileName,saveFile,false);
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  dialog.dispose();
  File oldSaveFile=overwriteFile;
  File oldSaveFileParent=overwriteFile.getParentFile() != null ? overwriteFile.getParentFile() : overwriteFile;
  File newSaveParent=FileChooser.getInputDirectory(GuiUtils.getMainFrame(),I18n.tr("String_Node_Str"),I18n.tr("String_Node_Str"),oldSaveFileParent);
  if (newSaveParent != null && new File(newSaveParent,oldSaveFile.getName()).exists()) {
    File saveFile=new File(newSaveParent,oldSaveFile.getName());
    createOverwriteDialogue(saveFile,downLoadAction,ex,supportNewSaveFileName);
    return;
  }
 else   if (newSaveParent != null) {
    File saveFile=new File(newSaveParent,oldSaveFile.getName());
    download(downLoadAction,supportNewSaveFileName,saveFile,false);
  }
}
Program: 3815
Project: 3815
Buggy source:
/** 
 * Downloads the given file using the supplied download action and handles any possible DownloadExceptions.
 */
private void download(final DownloadAction downLoadAction,final boolean supportNewSaveFileName,File saveFile,boolean overwrite){
  try {
    downLoadAction.download(saveFile,overwrite);
  }
 catch (  DownloadException e1) {
    handleDownloadException(downLoadAction,e1,supportNewSaveFileName);
  }
}

Fixed version (ground truth):
/** 
 * Downloads the given file using the supplied download action and handles any possible DownloadExceptions.
 */
private void download(final DownloadAction downLoadAction,final boolean supportNewSaveFileName,File saveFile,boolean overwrite){
  File newSaveFile=supportNewSaveFileName ? saveFile : saveFile.getParentFile();
  try {
    downLoadAction.download(newSaveFile,overwrite);
  }
 catch (  DownloadException e1) {
    handleDownloadException(downLoadAction,e1,supportNewSaveFileName);
  }
}
Program: 3816
Project: 3816
Buggy source:
/** 
 * Handles the specified DownloadException. The method may prompt the user for input, and should be executed from the UI thread.
 */
private void handleException(final DownloadAction downLoadAction,final DownloadException e,final boolean supportNewSaveFileName){
  if (e.getErrorCode() == DownloadException.ErrorCode.FILE_ALREADY_DOWNLOADING) {
    downLoadAction.downloadCanceled(e);
    showErrorMessage(e);
    return;
  }
  if ((e.getErrorCode() != DownloadException.ErrorCode.FILE_ALREADY_EXISTS) && (e.getErrorCode() != DownloadException.ErrorCode.FILE_IS_ALREADY_DOWNLOADED_TO)) {
    downLoadAction.downloadCanceled(e);
    showErrorMessage(e);
    return;
  }
  File saveFile=null;
  if (supportNewSaveFileName && SwingUiSettings.AUTO_RENAME_DUPLICATE_FILES.getValue()) {
    saveFile=getAutoSaveFile(e);
  }
 else {
    if (supportNewSaveFileName) {
      saveFile=FileChooser.getSaveAsFile(GuiUtils.getMainFrame(),I18n.tr("String_Node_Str"),e.getFile());
    }
 else {
      saveFile=e.getFile();
      if (saveFile != null && saveFile.exists()) {
        createOverwriteDialogue(saveFile,downLoadAction,e,supportNewSaveFileName);
        return;
      }
    }
    if (saveFile == null) {
      downLoadAction.downloadCanceled(e);
      return;
    }
  }
  download(downLoadAction,supportNewSaveFileName,saveFile,saveFile.exists());
}

Fixed version (ground truth):
/** 
 * Handles the specified DownloadException. The method may prompt the user for input, and should be executed from the UI thread.
 */
private void handleException(final DownloadAction downLoadAction,final DownloadException e,final boolean supportNewSaveFileName){
  if (e.getErrorCode() == DownloadException.ErrorCode.FILE_ALREADY_DOWNLOADING) {
    downLoadAction.downloadCanceled(e);
    showErrorMessage(e);
    return;
  }
  if ((e.getErrorCode() != DownloadException.ErrorCode.FILE_ALREADY_EXISTS) && (e.getErrorCode() != DownloadException.ErrorCode.FILE_IS_ALREADY_DOWNLOADED_TO)) {
    downLoadAction.downloadCanceled(e);
    showErrorMessage(e);
    return;
  }
 else   if (e.getErrorCode() == DownloadException.ErrorCode.FILE_IS_ALREADY_DOWNLOADED_TO && !supportNewSaveFileName) {
    downLoadAction.downloadCanceled(e);
    showErrorMessage(e);
    return;
  }
  File saveFile=null;
  if (supportNewSaveFileName && SwingUiSettings.AUTO_RENAME_DUPLICATE_FILES.getValue()) {
    saveFile=getAutoSaveFile(e);
  }
 else {
    if (supportNewSaveFileName) {
      saveFile=FileChooser.getSaveAsFile(GuiUtils.getMainFrame(),I18n.tr("String_Node_Str"),e.getFile());
    }
 else {
      saveFile=e.getFile();
      if (saveFile != null && saveFile.exists()) {
        createOverwriteDialogue(saveFile,downLoadAction,e,supportNewSaveFileName);
        return;
      }
    }
    if (saveFile == null) {
      downLoadAction.downloadCanceled(e);
      return;
    }
  }
  download(downLoadAction,supportNewSaveFileName,saveFile,saveFile.exists());
}
Program: 3817
Project: 3817
Buggy source:
private void selectTable(AbstractLibraryFormat<LocalFileItem> libraryTableFormat,Category category){
  selectedCategory=category;
  if (category != Category.IMAGE) {
    tableListLayout.show(tableListPanel,TABLE);
    setEventListOnTable(eventList);
    libraryTable.setupCellRenderers(category,libraryTableFormat);
    libraryTable.applySavedColumnSettings();
    TableColumnExt column=libraryTable.getColumnExt(libraryTableFormat.getColumnName(libraryTableFormat.getActionColumn()));
    if (column != null) {
      column.setVisible(libraryNavigatorPanel.getSelectedNavItem().getType() != NavType.LIBRARY);
    }
  }
 else {
    if (libraryImagePanel == null) {
      createImageList();
    }
    tableListLayout.show(tableListPanel,LIST);
    setEventListOnImages(eventList);
    libraryImagePanel.setShowButtons(libraryNavigatorPanel.getSelectedNavItem().getType() != NavType.LIBRARY);
  }
}

Fixed version (ground truth):
private void selectTable(AbstractLibraryFormat<LocalFileItem> libraryTableFormat,Category category){
  selectedCategory=category;
  if (category != Category.IMAGE) {
    setEventListOnTable(eventList);
    libraryTable.setupCellRenderers(category,libraryTableFormat);
    libraryTable.applySavedColumnSettings();
    TableColumnExt column=libraryTable.getColumnExt(libraryTableFormat.getColumnName(libraryTableFormat.getActionColumn()));
    if (column != null) {
      column.setVisible(libraryNavigatorPanel.getSelectedNavItem().getType() != NavType.LIBRARY);
    }
    tableListLayout.show(tableListPanel,TABLE);
  }
 else {
    if (libraryImagePanel == null) {
      createImageList();
    }
    setEventListOnImages(eventList);
    libraryImagePanel.setShowButtons(libraryNavigatorPanel.getSelectedNavItem().getType() != NavType.LIBRARY);
    tableListLayout.show(tableListPanel,LIST);
  }
}
Program: 3818
Project: 3818
Buggy source:
public void setEventList(EventList<LocalFileItem> eventList,AbstractLibraryFormat<LocalFileItem> tableFormat,boolean playable){
  uninstallListeners();
  fileItemFormat=tableFormat;
  SortedList<LocalFileItem> newSortedList=GlazedListsFactory.sortedList(eventList,null);
  LibraryTableModel newLibraryTableModel=new LibraryTableModel(newSortedList,tableFormat);
  DefaultEventSelectionModel<LocalFileItem> newEventSelectionModel=new DefaultEventSelectionModel<LocalFileItem>(newSortedList);
  FilterList<LocalFileItem> newPlayableList=playable ? createPlayableList(newSortedList) : null;
  if (cachedTableSorting != null) {
    cachedTableSorting.uninstall();
  }
  setModel(newLibraryTableModel);
  setSelectionModel(newEventSelectionModel);
  newEventSelectionModel.setSelectionMode(ListSelection.MULTIPLE_INTERVAL_SELECTION_DEFENSIVE);
  if (cachedPlayableList != null) {
    cachedPlayableList.dispose();
  }
  if (cachedLibraryTableModel != null) {
    cachedEventSelectionModel.dispose();
    cachedLibraryTableModel.dispose();
    cachedSortedList.dispose();
  }
  EventListJXTableSorting newTableSorting=EventListJXTableSorting.install(this,newSortedList,tableFormat);
  cachedSortedList=newSortedList;
  cachedLibraryTableModel=newLibraryTableModel;
  cachedEventSelectionModel=newEventSelectionModel;
  cachedTableSorting=newTableSorting;
  cachedPlayableList=newPlayableList;
  installListeners();
}

Fixed version (ground truth):
public void setEventList(EventList<LocalFileItem> eventList,AbstractLibraryFormat<LocalFileItem> tableFormat,boolean playable){
  uninstallListeners();
  fileItemFormat=tableFormat;
  SortedList<LocalFileItem> newSortedList=GlazedListsFactory.sortedList(eventList,null);
  LibraryTableModel newLibraryTableModel=new LibraryTableModel(newSortedList,tableFormat);
  DefaultEventSelectionModel<LocalFileItem> newEventSelectionModel=new DefaultEventSelectionModel<LocalFileItem>(newSortedList);
  FilterList<LocalFileItem> newPlayableList=playable ? createPlayableList(newSortedList) : null;
  if (cachedTableSorting != null) {
    cachedTableSorting.uninstall();
  }
  setSelectionModel(newEventSelectionModel);
  setModel(newLibraryTableModel);
  newEventSelectionModel.setSelectionMode(ListSelection.MULTIPLE_INTERVAL_SELECTION_DEFENSIVE);
  if (cachedPlayableList != null) {
    cachedPlayableList.dispose();
  }
  if (cachedLibraryTableModel != null) {
    cachedEventSelectionModel.dispose();
    cachedLibraryTableModel.dispose();
    cachedSortedList.dispose();
  }
  EventListJXTableSorting newTableSorting=EventListJXTableSorting.install(this,newSortedList,tableFormat);
  cachedSortedList=newSortedList;
  cachedLibraryTableModel=newLibraryTableModel;
  cachedEventSelectionModel=newEventSelectionModel;
  cachedTableSorting=newTableSorting;
  cachedPlayableList=newPlayableList;
  installListeners();
}
Program: 3819
Project: 3819
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  File currentSong=PlayerUtils.getCurrentSongFile();
  List<LocalFileItem> selected=selectedLocalFileItems.get();
  int confirmation=FocusJOptionPane.showConfirmDialog(null,getMessage(selected),I18n.trn("String_Node_Str","String_Node_Str",selected.size()),JOptionPane.OK_CANCEL_OPTION);
  if (confirmation == JOptionPane.OK_OPTION) {
    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 (libraryPanel.getSelectedCategory() == Category.IMAGE) {
      libraryImageTable.get().getImageList().setSelectionInterval(-1,-1);
    }
 else {
      libraryTable.getSelectionModel().setSelectionInterval(-1,-1);
    }
    if (!toRemove.isEmpty()) {
      BackgroundExecutorService.execute(new Runnable(){
        @Override public void run(){
          for (          File file : toRemove) {
            libraryManager.getLibraryManagedList().removeFile(file);
          }
        }
      }
);
    }
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  File currentSong=PlayerUtils.getCurrentSongFile();
  List<LocalFileItem> selected=selectedLocalFileItems.get();
  int confirmation=FocusJOptionPane.showConfirmDialog(null,getMessage(selected),I18n.trn("String_Node_Str","String_Node_Str",selected.size()),JOptionPane.OK_CANCEL_OPTION);
  if (confirmation == JOptionPane.OK_OPTION) {
    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: 3820
Project: 3820
Buggy source:
@Inject public RemoveFromLibraryAction(@LibrarySelected Provider<List<LocalFileItem>> selectedLocalFileItems,LibraryManager libraryManager,SharedFileListManager sharedFileListManager,LibraryTable libraryTable,Provider<LibraryImageTable> libraryImageTable,LibraryPanel libraryPanel){
  super(I18n.tr("String_Node_Str"));
  this.selectedLocalFileItems=selectedLocalFileItems;
  this.libraryManager=libraryManager;
  this.sharedFileListManager=sharedFileListManager;
  this.libraryTable=libraryTable;
  this.libraryImageTable=libraryImageTable;
  this.libraryPanel=libraryPanel;
}

Fixed version (ground truth):
@Inject public RemoveFromLibraryAction(@LibrarySelected Provider<List<LocalFileItem>> selectedLocalFileItems,LibraryManager libraryManager,SharedFileListManager sharedFileListManager){
  super(I18n.tr("String_Node_Str"));
  this.selectedLocalFileItems=selectedLocalFileItems;
  this.libraryManager=libraryManager;
  this.sharedFileListManager=sharedFileListManager;
}
Program: 3821
Project: 3821
Buggy source:
/** 
 * Sets the gain(volume) for the outputline.
 * @param gain [0.0 <-> 1.0]
 * @throws IOException thrown when the soundcard does not support thisoperation
 */
public void setVolume(double fGain){
synchronized (volumeLock) {
    volume=fGain;
    setVolume=true;
  }
}

Fixed version (ground truth):
/** 
 * Sets the gain(volume) for the outputline.
 * @param fGain [0.0 <-> 1.0]
 * @throws IOException thrown when the soundcard does not support thisoperation
 */
public void setVolume(double fGain){
synchronized (volumeLock) {
    volume=fGain;
    setVolume=true;
  }
}
Program: 3822
Project: 3822
Buggy source:
/** 
 * Paints fake rows to fill the viewport.
 */
protected void paintEmptyRows(Graphics g){
  int rowCount=getRowCount();
  Rectangle clip=g.getClipBounds();
  int clipHeight=clip.y + clip.height;
  int tableHeight=getHeight();
  int clipViewableRows=clipHeight / rowHeight;
  int tableViewableRows=tableHeight / rowHeight;
  int startDrawingAt=rowCount * rowHeight;
  if (startDrawingAt < tableHeight) {
    if (clipViewableRows < tableViewableRows) {
      repaint(clip.x,startDrawingAt,clip.width,tableHeight - startDrawingAt);
    }
 else {
      for (int i=rowCount; i <= clipViewableRows; ++i) {
        g.setColor(getColorForRow(i));
        g.fillRect(clip.x,i * rowHeight,clip.width,rowHeight);
        if (getShowHorizontalLines() && i > rowCount) {
          g.setColor(gridColor);
          g.drawLine(clip.x,i * rowHeight,clip.width,i * rowHeight);
        }
      }
      if (getShowVerticalLines()) {
        g.setColor(gridColor);
        TableColumnModel columnModel=getColumnModel();
        int x=0;
        for (int i=0; i < columnModel.getColumnCount(); ++i) {
          TableColumn column=columnModel.getColumn(i);
          x+=column.getWidth();
          g.drawLine(x - 1,rowCount * rowHeight,x - 1,clipHeight);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Paints fake rows to fill the viewport.
 */
protected void paintEmptyRows(Graphics g){
  int rowCount=getRowCount();
  Rectangle clip=g.getClipBounds();
  int clipHeight=clip.y + clip.height;
  int tableHeight=getVisibleRect().height;
  int clipViewableRows=clipHeight / rowHeight;
  int tableViewableRows=tableHeight / rowHeight;
  int startDrawingAt=rowCount * rowHeight;
  if (startDrawingAt < tableHeight) {
    if (clipViewableRows < tableViewableRows) {
      repaint(clip.x,startDrawingAt,clip.width,tableHeight - startDrawingAt);
    }
 else {
      for (int i=rowCount; i <= clipViewableRows; ++i) {
        g.setColor(getColorForRow(i));
        g.fillRect(clip.x,i * rowHeight,clip.width,rowHeight);
        if (getShowHorizontalLines() && i > rowCount) {
          g.setColor(gridColor);
          g.drawLine(clip.x,i * rowHeight,clip.width,i * rowHeight);
        }
      }
      if (getShowVerticalLines()) {
        g.setColor(gridColor);
        TableColumnModel columnModel=getColumnModel();
        int x=0;
        for (int i=0; i < columnModel.getColumnCount(); ++i) {
          TableColumn column=columnModel.getColumn(i);
          x+=column.getWidth();
          g.drawLine(x - 1,rowCount * rowHeight,x - 1,clipHeight);
        }
      }
    }
  }
}
Program: 3823
Project: 3823
Buggy source:
@Override public void setVisible(boolean visible){
  if (frame == null && visible) {
    initContent();
    start();
    resize();
    repaint();
    validate();
  }
 else   if (visible && !isVisible()) {
    restart();
  }
 else   if (contentPanel != null) {
    contentPanel.removeAll();
  }
  super.setVisible(visible);
}

Fixed version (ground truth):
@Override public void setVisible(boolean visible){
  if (frame == null && visible) {
    initContent();
    start();
    resize();
    repaint();
    validate();
  }
 else   if (visible && !isVisible()) {
    restart();
  }
 else   if (!visible && contentPanel != null) {
    contentPanel.removeAll();
  }
  super.setVisible(visible);
}
Program: 3824
Project: 3824
Buggy source:
@Override public void removeFile(File file){
  if (contains(file)) {
    getCoreCollection().remove(file);
  }
}

Fixed version (ground truth):
@Override public void removeFile(File file){
  getCoreCollection().remove(file);
}
Program: 3825
Project: 3825
Buggy source:
/** 
 * Removes the FD for this file, returning the FD that was removed. This does NOT dispatch a remove event.  It will update the libraryData to signify the file should not be shared, though. The file should be canonicalized already.
 */
private FileDesc removeInternal(File file){
  FileDesc fd;
  rwLock.writeLock().lock();
  try {
    fd=fileToFileDescMap.get(file);
    if (fd != null) {
      removeFileDesc(file,fd);
    }
    Future future=fileToFutures.remove(file);
    if (future != null) {
      future.cancel(true);
    }
  }
  finally {
    rwLock.writeLock().unlock();
  }
  if (fd != null) {
    getLibraryData().removeManagedFile(file);
  }
  return fd;
}

Fixed version (ground truth):
/** 
 * Removes the FD for this file, returning the FD that was removed. This does NOT dispatch a remove event.  It will update the libraryData to signify the file should not be shared, though. The file should be canonicalized already.
 */
private FileDesc removeInternal(File file){
  FileDesc fd;
  boolean cancelled=false;
  rwLock.writeLock().lock();
  try {
    fd=fileToFileDescMap.get(file);
    if (fd != null) {
      removeFileDesc(file,fd);
    }
    Future future=fileToFutures.remove(file);
    if (future != null) {
      cancelled=future.cancel(true);
    }
  }
  finally {
    rwLock.writeLock().unlock();
  }
  if (fd != null) {
    getLibraryData().removeManagedFile(file);
  }
  if (cancelled) {
    broadcastFinished(file);
  }
  return fd;
}
Program: 3826
Project: 3826
Buggy source:
/** 
 * Actually performs the clear & dispatches an event. Does not save the clear to LibraryFileData. 
 */
private void clearImpl(){
  List<Future> fileFutures;
  rwLock.writeLock().lock();
  try {
    fileFutures=new ArrayList<Future>(fileToFutures.values());
    fileToFutures.clear();
    files.clear();
    urnMap.clear();
    fileToFileDescMap.clear();
  }
  finally {
    rwLock.writeLock().unlock();
  }
  for (  Future future : fileFutures) {
    future.cancel(true);
  }
  dispatch(new FileViewChangeEvent(LibraryImpl.this,FileViewChangeEvent.Type.FILES_CLEARED,true));
}

Fixed version (ground truth):
/** 
 * Actually performs the clear & dispatches an event. Does not save the clear to LibraryFileData. 
 */
private void clearImpl(){
  Map<File,Future> fileFutures;
  rwLock.writeLock().lock();
  try {
    fileFutures=new HashMap<File,Future>(fileToFutures);
    fileToFutures.clear();
    files.clear();
    urnMap.clear();
    fileToFileDescMap.clear();
  }
  finally {
    rwLock.writeLock().unlock();
  }
  for (  Map.Entry<File,Future> entry : fileFutures.entrySet()) {
    if (entry.getValue().cancel(true)) {
      broadcastFinished(entry.getKey());
    }
  }
  dispatch(new FileViewChangeEvent(LibraryImpl.this,FileViewChangeEvent.Type.FILES_CLEARED,true));
}
Program: 3828
Project: 3828
Buggy source:
/** 
 * Creates a LimeXMLDocument for the given FileDesc if no XML already exists for it.
 */
public LimeXMLDocument createIfNecessary(FileDesc fd){
  LimeXMLDocument doc=null;
synchronized (LOCK) {
    if (!mainMap.containsKey(new FileAndUrn(fd))) {
      File file=fd.getFile();
      if (fd.getLimeXMLDocuments().size() == 0) {
        doc=constructDocument(file);
        if (doc != null) {
          if (LOG.isDebugEnabled())           LOG.debug("String_Node_Str" + file + "String_Node_Str"+ doc);
          addReply(fd,doc);
        }
      }
    }
  }
  return doc;
}

Fixed version (ground truth):
/** 
 * Creates a LimeXMLDocument for the given FileDesc if no XML already exists for it.
 */
public LimeXMLDocument createIfNecessary(FileDesc fd){
  LimeXMLDocument doc=null;
  boolean needsXml=false;
  File file=fd.getFile();
  FileAndUrn fileAndUrn=new FileAndUrn(fd);
synchronized (LOCK) {
    if (!mainMap.containsKey(fileAndUrn)) {
      if (fd.getLimeXMLDocuments().size() == 0) {
        needsXml=true;
      }
    }
  }
  if (needsXml) {
    doc=constructDocument(file);
    if (doc != null) {
synchronized (LOCK) {
        if (!mainMap.containsKey(fileAndUrn)) {
          if (fd.getLimeXMLDocuments().size() == 0) {
            if (LOG.isDebugEnabled())             LOG.debug("String_Node_Str" + file + "String_Node_Str"+ doc);
            addReply(fd,doc);
          }
        }
      }
    }
  }
  return doc;
}
Program: 3829
Project: 3829
Buggy source:
/** 
 * Adds the SchemaURI to a HashMap with the replyCollection. <p> Warning/Note:If the schemaURI already corresponds to a ReplyCollection this method will replace the old reply collection with the new one.  The old collection will be lost!
 */
public synchronized void add(String schemaURI,LimeXMLReplyCollection replyCollection){
  mapper.put(schemaURI,replyCollection);
}

Fixed version (ground truth):
/** 
 * Adds the SchemaURI to a HashMap with the replyCollection. <p> Warning/Note:If the schemaURI already corresponds to a ReplyCollection this method will replace the old reply collection with the new one.  The old collection will be lost!
 */
public void add(String schemaURI,LimeXMLReplyCollection replyCollection){
  mapper.put(schemaURI,replyCollection);
}
Program: 3830
Project: 3830
Buggy source:
/** 
 * Loads the map with the LimeXMLDocument for a given FileDesc. If no LimeXMLDocument exists for the FileDesc, one is created for it.
 */
@Override public synchronized boolean loadXml(FileDesc fd){
  Collection<LimeXMLReplyCollection> replies=getCollections();
  boolean loaded=false;
  for (  LimeXMLReplyCollection col : replies) {
    LimeXMLDocument doc=col.createIfNecessary(fd);
    if (doc != null) {
      loaded=true;
    }
  }
  return loaded;
}

Fixed version (ground truth):
/** 
 * Loads the map with the LimeXMLDocument for a given FileDesc. If no LimeXMLDocument exists for the FileDesc, one is created for it.
 */
@Override public boolean loadXml(FileDesc fd){
  Collection<LimeXMLReplyCollection> replies=getCollections();
  boolean loaded=false;
  for (  LimeXMLReplyCollection col : replies) {
    LimeXMLDocument doc=col.createIfNecessary(fd);
    if (doc != null) {
      loaded=true;
    }
  }
  return loaded;
}
Program: 3831
Project: 3831
Buggy source:
private synchronized void removeFileDesc(FileDesc fd){
  List<LimeXMLDocument> xmlDocs=fd.getLimeXMLDocuments();
  List<String> schemas=new LinkedList<String>();
  for (  LimeXMLDocument doc : xmlDocs)   schemas.add(doc.getSchemaURI());
  for (  String uri : schemas) {
    LimeXMLReplyCollection col=getReplyCollection(uri);
    if (col != null)     col.removeDoc(fd);
  }
}

Fixed version (ground truth):
private void removeFileDesc(FileDesc fd){
  List<LimeXMLDocument> xmlDocs=fd.getLimeXMLDocuments();
  List<String> schemas=new LinkedList<String>();
  for (  LimeXMLDocument doc : xmlDocs)   schemas.add(doc.getSchemaURI());
  for (  String uri : schemas) {
    LimeXMLReplyCollection col=getReplyCollection(uri);
    if (col != null)     col.removeDoc(fd);
  }
}
Program: 3832
Project: 3832
Buggy source:
/** 
 * Serializes the current LimeXMLReplyCollection to disk.
 */
private void save(LibraryStatusEvent event){
  if (event.getLibrary().isLoadFinished()) {
synchronized (this) {
      Collection<LimeXMLReplyCollection> replies=getCollections();
      for (      LimeXMLReplyCollection col : replies)       col.writeMapToDisk();
    }
  }
}

Fixed version (ground truth):
/** 
 * Serializes the current LimeXMLReplyCollection to disk.
 */
private void save(LibraryStatusEvent event){
  if (event.getLibrary().isLoadFinished()) {
    Collection<LimeXMLReplyCollection> replies=getCollections();
    for (    LimeXMLReplyCollection col : replies)     col.writeMapToDisk();
  }
}
Program: 3833
Project: 3833
Buggy source:
/** 
 * Returns a collection of all available LimeXMLReplyCollections. YOU MUST SYNCHRONIZE ITERATION OVER THE COLLECTION IF IT CAN BE MODIFIED.
 */
public synchronized Collection<LimeXMLReplyCollection> getCollections(){
  return mapper.values();
}

Fixed version (ground truth):
/** 
 * Returns a collection of all available LimeXMLReplyCollections.
 */
public Collection<LimeXMLReplyCollection> getCollections(){
  return mapper.values();
}
Program: 3834
Project: 3834
Buggy source:
/** 
 * Looks up and returns the <tt>LimeXMLReplyCollection</tt> value for the supplied schemaURI key.
 * @ return the <tt>LimeXMLReplyCollection</tt> for the given schema URI,or <tt>null</tt> if we the requested mapping does not exist
 */
public synchronized LimeXMLReplyCollection getReplyCollection(String schemaURI){
  return mapper.get(schemaURI);
}

Fixed version (ground truth):
/** 
 * Looks up and returns the <tt>LimeXMLReplyCollection</tt> value for the supplied schemaURI key.
 * @ return the <tt>LimeXMLReplyCollection</tt> for the given schema URI,or <tt>null</tt> if we the requested mapping does not exist
 */
public LimeXMLReplyCollection getReplyCollection(String schemaURI){
  return mapper.get(schemaURI);
}
Program: 3835
Project: 3835
Buggy source:
@Override public synchronized boolean loadCachedXml(FileDesc fd,Collection<? extends LimeXMLDocument> prebuilt){
  Collection<LimeXMLReplyCollection> replies=getCollections();
  boolean loaded=false;
  for (  LimeXMLReplyCollection col : replies) {
    LimeXMLDocument doc=col.initialize(fd,prebuilt);
    if (doc != null) {
      loaded=true;
    }
  }
  return loaded;
}

Fixed version (ground truth):
@Override public boolean loadCachedXml(FileDesc fd,Collection<? extends LimeXMLDocument> prebuilt){
  Collection<LimeXMLReplyCollection> replies=getCollections();
  boolean loaded=false;
  for (  LimeXMLReplyCollection col : replies) {
    LimeXMLDocument doc=col.initialize(fd,prebuilt);
    if (doc != null) {
      loaded=true;
    }
  }
  return loaded;
}