Program: 165505
Project: 165505
Buggy source:
public void actionPerformed(ActionEvent e){
  resetScrapeMovieActionCounters();
  this.guiMain.setMainGUIEnabled(false);
  this.guiMain.removeOldScrapedMovieReferences();
  clearOverrides();
  worker=new SwingWorker<Void,String>(){
    Movie javMovie=null;
    Movie data18Movie=null;
    @Override protected Void doInBackground(){
      for (int movieNumberInList=0; movieNumberInList < ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieFileList().size(); movieNumberInList++) {
        if (this.isCancelled()) {
          System.err.println("String_Node_Str");
          cancelRunningThreads();
          return null;
        }
        final int movieNumberInListFinal=movieNumberInList;
        ScrapeMovieAction.this.guiMain.getFrmMoviescraper().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        String currentFileName=ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieFileList().get(movieNumberInList).toString();
        initializeProgressMonitor(currentFileName,movieNumberInList,ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieFileList().size());
        if (promptUserForURLWhenScraping && scrapeJAV) {
          try {
            DmmParsingProfile dmmParsingProfile=new DmmParsingProfile(!ScrapeMovieAction.this.guiMain.getPreferences().getScrapeInJapanese());
            if (guiMain.getPreferences().getPromptForUserProvidedURLWhenScraping()) {
              setOverridenSearchResult(dmmParsingProfile,ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieFileList().get(movieNumberInList).toString());
            }
            if (dmmParsingProfile.getOverridenSearchResult() != null) {
              overrideURLDMM=dmmParsingProfile.getOverridenSearchResult().toString();
            }
 else {
              String searchStringDMM=dmmParsingProfile.createSearchString(ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieFileList().get(movieNumberInList));
              SearchResult[] searchResultsDMM=dmmParsingProfile.getSearchResults(searchStringDMM);
              if (searchResultsDMM != null && searchResultsDMM.length > 0) {
                SearchResult searchResultFromUser=GUIMain.showOptionPane(searchResultsDMM,"String_Node_Str");
                if (searchResultFromUser != null)                 overrideURLDMM=searchResultFromUser.getUrlPath();
              }
            }
            if (!ScrapeMovieAction.this.guiMain.getPreferences().getScrapeInJapanese()) {
              JavLibraryParsingProfile javLibParsingProfile=new JavLibraryParsingProfile();
              if (guiMain.getPreferences().getPromptForUserProvidedURLWhenScraping()) {
                setOverridenSearchResult(javLibParsingProfile,ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieFileList().get(movieNumberInList).toString());
              }
              if (javLibParsingProfile.getOverridenSearchResult() != null) {
                overrideURLJavLibrary=javLibParsingProfile.getOverridenSearchResult().toString();
              }
 else {
                String searchStringJL=javLibParsingProfile.createSearchString(ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieFileList().get(movieNumberInList));
                SearchResult[] searchResultsJavLibStrings=javLibParsingProfile.getSearchResults(searchStringJL);
                if (searchResultsJavLibStrings != null && searchResultsJavLibStrings.length > 0) {
                  SearchResult searchResultFromUser=GUIMain.showOptionPane(searchResultsJavLibStrings,"String_Node_Str");
                  if (searchResultFromUser != null)                   overrideURLJavLibrary=searchResultFromUser.getUrlPath();
                }
              }
            }
            if (overrideURLDMM == null && overrideURLJavLibrary == null)             continue;
          }
 catch (          IOException e2) {
            e2.printStackTrace();
          }
        }
 else         if (promptUserForURLWhenScraping && (scrapeData18Movie || scrapeData18WebContent)) {
          try {
            SiteParsingProfile data18ParsingProfile=null;
            if (scrapeData18Movie)             data18ParsingProfile=new Data18MovieParsingProfile();
 else             if (scrapeData18WebContent)             data18ParsingProfile=new Data18WebContentParsingProfile();
            if (guiMain.getPreferences().getPromptForUserProvidedURLWhenScraping()) {
              setOverridenSearchResult(data18ParsingProfile,ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieFileList().get(movieNumberInList).toString());
            }
            if (data18ParsingProfile.getOverridenSearchResult() != null) {
              overrideURLData18Movie=data18ParsingProfile.getOverridenSearchResult().toString();
            }
 else {
              String searchStringData18Movie=data18ParsingProfile.createSearchString(ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieFileList().get(movieNumberInList));
              SearchResult[] searchResultData18Movie=data18ParsingProfile.getSearchResults(searchStringData18Movie);
              if (searchResultData18Movie != null && searchResultData18Movie.length > 0) {
                SearchResult searchResultFromUser=GUIMain.showOptionPane(searchResultData18Movie,"String_Node_Str");
                if (searchResultFromUser == null)                 continue;
                overrideURLData18Movie=searchResultFromUser.getUrlPath();
              }
            }
            if (scrapeData18Movie && ScrapeMovieAction.this.guiMain.getPreferences().getUseIAFDForActors()) {
              IAFDParsingProfile iafdParsingProfile=new IAFDParsingProfile();
              SearchResult[] searchResultsIAFD=iafdParsingProfile.getSearchResults(iafdParsingProfile.createSearchString(ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieFileList().get(movieNumberInList)));
              System.out.println(searchResultsIAFD);
              if (searchResultsIAFD != null && searchResultsIAFD.length > 0) {
                SearchResult searchResultFromUser=GUIMain.showOptionPane(searchResultsIAFD,"String_Node_Str");
                if (searchResultFromUser == null)                 continue;
                overrideURLIAFD=searchResultFromUser.getUrlPath();
                if (!overrideURLIAFD.contains("String_Node_Str"))                 overrideURLIAFD="String_Node_Str" + overrideURLIAFD;
                System.out.println("String_Node_Str" + overrideURLIAFD);
              }
            }
          }
 catch (          IOException e1) {
            e1.printStackTrace();
          }
        }
        try {
          if (scrapeJAV)           javMovie=makeJavThreadsAndScrape(movieNumberInListFinal);
 else           if (scrapeData18Movie)           data18Movie=makeData18MovieThreadsAndScrape(movieNumberInListFinal,true);
 else           if (scrapeData18WebContent) {
            data18Movie=makeData18MovieThreadsAndScrape(movieNumberInListFinal,false);
          }
          clearOverrides();
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
          clearOverrides();
        }
        makeProgress(100,"String_Node_Str");
      }
      return null;
    }
    @Override protected void done(){
      guiMain.getProgressMonitor().stop();
      if (manuallyPickPoster && data18Movie != null && data18Movie.getPosters() != null && data18Movie.getPosters().length > 1) {
        HashSet<Thumb> uniqueElements=new HashSet<Thumb>(Arrays.asList(data18Movie.getPosters()));
        uniqueElements.addAll(Arrays.asList(data18Movie.getExtraFanart()));
        ArrayList<Thumb> uniqueElementsList=(new ArrayList<Thumb>(uniqueElements));
        Thumb[] uniqueElementsArray=uniqueElementsList.toArray(new Thumb[uniqueElementsList.size()]);
        Thumb posterPicked=showArtPicker(uniqueElementsArray,"String_Node_Str");
        if (posterPicked != null) {
          ArrayList<Thumb> existingPosters=new ArrayList<Thumb>(Arrays.asList(ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieData18Movie().getPosters()));
          existingPosters.remove(posterPicked);
          existingPosters.add(0,posterPicked);
          Thumb[] posterArray=new Thumb[existingPosters.size()];
          ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieData18Movie().setPosters(existingPosters.toArray(posterArray));
        }
      }
      if (manuallyPickFanart && data18Movie != null && data18Movie.getFanart() != null && data18Movie.getFanart().length > 1) {
        HashSet<Thumb> uniqueElements=new HashSet<Thumb>(Arrays.asList(data18Movie.getFanart()));
        uniqueElements.addAll(Arrays.asList(data18Movie.getExtraFanart()));
        ArrayList<Thumb> uniqueElementsList=(new ArrayList<Thumb>(uniqueElements));
        Thumb[] uniqueElementsArray=uniqueElementsList.toArray(new Thumb[uniqueElementsList.size()]);
        Thumb fanartPicked=showArtPicker(uniqueElementsArray,"String_Node_Str");
        if (fanartPicked != null) {
          ArrayList<Thumb> existingFanart=new ArrayList<Thumb>(Arrays.asList(ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieData18Movie().getFanart()));
          existingFanart.remove(fanartPicked);
          existingFanart.add(0,fanartPicked);
          Thumb[] fanartArray=new Thumb[existingFanart.size()];
          ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieData18Movie().setFanart(existingFanart.toArray(fanartArray));
        }
      }
 else       if (manuallyPickFanart && javMovie != null) {
        Thumb fanartPicked=showArtPicker(ArrayUtils.addAll(javMovie.getFanart(),javMovie.getExtraFanart()),"String_Node_Str");
        if (fanartPicked != null)         javMovie.setFanart(ArrayUtils.toArray(fanartPicked));
      }
      if (!scrapeCanceled && (ScrapeMovieAction.this.guiMain.movieToWriteToDiskList == null || ScrapeMovieAction.this.guiMain.movieToWriteToDiskList.size() == 0)) {
        System.out.println("String_Node_Str");
        JOptionPane.showMessageDialog(ScrapeMovieAction.this.guiMain.getFrmMoviescraper(),"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE,null);
      }
      clearOverrides();
      ScrapeMovieAction.this.guiMain.updateAllFieldsOfFileDetailPanel(true);
      ScrapeMovieAction.this.guiMain.getFrmMoviescraper().setCursor(Cursor.getDefaultCursor());
      ScrapeMovieAction.this.guiMain.setMainGUIEnabled(true);
    }
  }
;
  worker.execute();
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  resetScrapeMovieActionCounters();
  this.guiMain.setMainGUIEnabled(false);
  this.guiMain.removeOldScrapedMovieReferences();
  clearOverrides();
  worker=new SwingWorker<Void,String>(){
    Movie javMovie=null;
    Movie data18Movie=null;
    @Override protected Void doInBackground(){
      for (int movieNumberInList=0; movieNumberInList < ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieFileList().size(); movieNumberInList++) {
        if (this.isCancelled()) {
          System.err.println("String_Node_Str");
          cancelRunningThreads();
          return null;
        }
        final int movieNumberInListFinal=movieNumberInList;
        ScrapeMovieAction.this.guiMain.getFrmMoviescraper().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        String currentFileName=ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieFileList().get(movieNumberInList).toString();
        initializeProgressMonitor(currentFileName,movieNumberInList,ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieFileList().size());
        if (promptUserForURLWhenScraping && scrapeJAV) {
          try {
            DmmParsingProfile dmmParsingProfile=new DmmParsingProfile(!ScrapeMovieAction.this.guiMain.getPreferences().getScrapeInJapanese());
            if (guiMain.getPreferences().getPromptForUserProvidedURLWhenScraping()) {
              setOverridenSearchResult(dmmParsingProfile,ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieFileList().get(movieNumberInList).toString());
            }
            if (dmmParsingProfile.getOverridenSearchResult() != null) {
              overrideURLDMM=dmmParsingProfile.getOverridenSearchResult().toString();
            }
 else {
              String searchStringDMM=dmmParsingProfile.createSearchString(ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieFileList().get(movieNumberInList));
              SearchResult[] searchResultsDMM=dmmParsingProfile.getSearchResults(searchStringDMM);
              if (searchResultsDMM != null && searchResultsDMM.length > 0) {
                SearchResult searchResultFromUser=GUIMain.showOptionPane(searchResultsDMM,"String_Node_Str");
                if (searchResultFromUser != null)                 overrideURLDMM=searchResultFromUser.getUrlPath();
 else {
                  guiMain.movieToWriteToDiskList.add(null);
                  clearOverrides();
                }
              }
            }
            if (!ScrapeMovieAction.this.guiMain.getPreferences().getScrapeInJapanese()) {
              JavLibraryParsingProfile javLibParsingProfile=new JavLibraryParsingProfile();
              if (guiMain.getPreferences().getPromptForUserProvidedURLWhenScraping()) {
                setOverridenSearchResult(javLibParsingProfile,ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieFileList().get(movieNumberInList).toString());
              }
              if (javLibParsingProfile.getOverridenSearchResult() != null) {
                overrideURLJavLibrary=javLibParsingProfile.getOverridenSearchResult().toString();
              }
 else {
                String searchStringJL=javLibParsingProfile.createSearchString(ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieFileList().get(movieNumberInList));
                SearchResult[] searchResultsJavLibStrings=javLibParsingProfile.getSearchResults(searchStringJL);
                if (searchResultsJavLibStrings != null && searchResultsJavLibStrings.length > 0) {
                  SearchResult searchResultFromUser=GUIMain.showOptionPane(searchResultsJavLibStrings,"String_Node_Str");
                  if (searchResultFromUser != null)                   overrideURLJavLibrary=searchResultFromUser.getUrlPath();
                }
              }
            }
            if (overrideURLDMM == null && overrideURLJavLibrary == null) {
              guiMain.movieToWriteToDiskList.add(null);
              clearOverrides();
              continue;
            }
          }
 catch (          IOException e2) {
            e2.printStackTrace();
          }
        }
 else         if (promptUserForURLWhenScraping && (scrapeData18Movie || scrapeData18WebContent)) {
          try {
            SiteParsingProfile data18ParsingProfile=null;
            if (scrapeData18Movie)             data18ParsingProfile=new Data18MovieParsingProfile();
 else             if (scrapeData18WebContent)             data18ParsingProfile=new Data18WebContentParsingProfile();
            if (guiMain.getPreferences().getPromptForUserProvidedURLWhenScraping()) {
              setOverridenSearchResult(data18ParsingProfile,ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieFileList().get(movieNumberInList).toString());
            }
            if (data18ParsingProfile.getOverridenSearchResult() != null) {
              overrideURLData18Movie=data18ParsingProfile.getOverridenSearchResult().toString();
            }
 else {
              String searchStringData18Movie=data18ParsingProfile.createSearchString(ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieFileList().get(movieNumberInList));
              SearchResult[] searchResultData18Movie=data18ParsingProfile.getSearchResults(searchStringData18Movie);
              if (searchResultData18Movie != null && searchResultData18Movie.length > 0) {
                SearchResult searchResultFromUser=GUIMain.showOptionPane(searchResultData18Movie,"String_Node_Str");
                if (searchResultFromUser == null) {
                  guiMain.movieToWriteToDiskList.add(null);
                  clearOverrides();
                  continue;
                }
                overrideURLData18Movie=searchResultFromUser.getUrlPath();
              }
            }
            if (scrapeData18Movie && ScrapeMovieAction.this.guiMain.getPreferences().getUseIAFDForActors()) {
              IAFDParsingProfile iafdParsingProfile=new IAFDParsingProfile();
              SearchResult[] searchResultsIAFD=iafdParsingProfile.getSearchResults(iafdParsingProfile.createSearchString(ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieFileList().get(movieNumberInList)));
              System.out.println(searchResultsIAFD);
              if (searchResultsIAFD != null && searchResultsIAFD.length > 0) {
                SearchResult searchResultFromUser=GUIMain.showOptionPane(searchResultsIAFD,"String_Node_Str");
                if (searchResultFromUser == null) {
                  guiMain.movieToWriteToDiskList.add(null);
                  clearOverrides();
                  continue;
                }
                overrideURLIAFD=searchResultFromUser.getUrlPath();
                if (!overrideURLIAFD.contains("String_Node_Str"))                 overrideURLIAFD="String_Node_Str" + overrideURLIAFD;
                System.out.println("String_Node_Str" + overrideURLIAFD);
              }
            }
          }
 catch (          IOException e1) {
            e1.printStackTrace();
          }
        }
        try {
          if (scrapeJAV)           javMovie=makeJavThreadsAndScrape(movieNumberInListFinal);
 else           if (scrapeData18Movie)           data18Movie=makeData18MovieThreadsAndScrape(movieNumberInListFinal,true);
 else           if (scrapeData18WebContent) {
            data18Movie=makeData18MovieThreadsAndScrape(movieNumberInListFinal,false);
          }
          clearOverrides();
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
          clearOverrides();
        }
        makeProgress(100,"String_Node_Str");
      }
      return null;
    }
    @Override protected void done(){
      guiMain.getProgressMonitor().stop();
      if (manuallyPickPoster && data18Movie != null && data18Movie.getPosters() != null && data18Movie.getPosters().length > 1) {
        HashSet<Thumb> uniqueElements=new HashSet<Thumb>(Arrays.asList(data18Movie.getPosters()));
        uniqueElements.addAll(Arrays.asList(data18Movie.getExtraFanart()));
        ArrayList<Thumb> uniqueElementsList=(new ArrayList<Thumb>(uniqueElements));
        Thumb[] uniqueElementsArray=uniqueElementsList.toArray(new Thumb[uniqueElementsList.size()]);
        Thumb posterPicked=showArtPicker(uniqueElementsArray,"String_Node_Str");
        if (posterPicked != null) {
          ArrayList<Thumb> existingPosters=new ArrayList<Thumb>(Arrays.asList(ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieData18Movie().getPosters()));
          existingPosters.remove(posterPicked);
          existingPosters.add(0,posterPicked);
          Thumb[] posterArray=new Thumb[existingPosters.size()];
          ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieData18Movie().setPosters(existingPosters.toArray(posterArray));
        }
      }
      if (manuallyPickFanart && data18Movie != null && data18Movie.getFanart() != null && data18Movie.getFanart().length > 1) {
        HashSet<Thumb> uniqueElements=new HashSet<Thumb>(Arrays.asList(data18Movie.getFanart()));
        uniqueElements.addAll(Arrays.asList(data18Movie.getExtraFanart()));
        ArrayList<Thumb> uniqueElementsList=(new ArrayList<Thumb>(uniqueElements));
        Thumb[] uniqueElementsArray=uniqueElementsList.toArray(new Thumb[uniqueElementsList.size()]);
        Thumb fanartPicked=showArtPicker(uniqueElementsArray,"String_Node_Str");
        if (fanartPicked != null) {
          ArrayList<Thumb> existingFanart=new ArrayList<Thumb>(Arrays.asList(ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieData18Movie().getFanart()));
          existingFanart.remove(fanartPicked);
          existingFanart.add(0,fanartPicked);
          Thumb[] fanartArray=new Thumb[existingFanart.size()];
          ScrapeMovieAction.this.guiMain.getCurrentlySelectedMovieData18Movie().setFanart(existingFanart.toArray(fanartArray));
        }
      }
 else       if (manuallyPickFanart && javMovie != null) {
        Thumb fanartPicked=showArtPicker(ArrayUtils.addAll(javMovie.getFanart(),javMovie.getExtraFanart()),"String_Node_Str");
        if (fanartPicked != null)         javMovie.setFanart(ArrayUtils.toArray(fanartPicked));
      }
      if (!scrapeCanceled && (ScrapeMovieAction.this.guiMain.movieToWriteToDiskList == null || ScrapeMovieAction.this.guiMain.movieToWriteToDiskList.size() == 0)) {
        System.out.println("String_Node_Str");
        JOptionPane.showMessageDialog(ScrapeMovieAction.this.guiMain.getFrmMoviescraper(),"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE,null);
      }
      clearOverrides();
      ScrapeMovieAction.this.guiMain.updateAllFieldsOfFileDetailPanel(true);
      ScrapeMovieAction.this.guiMain.getFrmMoviescraper().setCursor(Cursor.getDefaultCursor());
      ScrapeMovieAction.this.guiMain.setMainGUIEnabled(true);
    }
  }
;
  worker.execute();
}