Program: 168485
Project: 168485
Buggy source:
private void extractFile(final FSFile rec,final File outDir,final ExtractProgressMonitor progressDialog,final LinkedList<String> errorMessages,final ExtractProperties extractProperties,final ObjectContainer<Boolean> skipDirectory,final FSForkType forkType){
  final String originalFileName;
  if (forkType == FSForkType.DATA)   originalFileName=rec.getName();
 else   if (forkType == FSForkType.MACOS_RESOURCE)   originalFileName="String_Node_Str" + rec.getName();
 else   throw new RuntimeException("String_Node_Str" + forkType);
  CreateFileFailedAction defaultCreateFileFailedAction=extractProperties.getCreateFileFailedAction();
  FileExistsAction defaultFileExistsAction=extractProperties.getFileExistsAction();
  UnhandledExceptionAction defaultUnhandledExceptionAction=extractProperties.getUnhandledExceptionAction();
  String fileName=originalFileName;
  while (fileName != null) {
    String curFileName=fileName;
    fileName=null;
    final FSFork theFork=rec.getForkByType(forkType);
    if (theFork == null)     throw new RuntimeException("String_Node_Str" + forkType);
 else     if (forkType == FSForkType.MACOS_RESOURCE && theFork.getLength() == 0)     return;
    progressDialog.updateCurrentFile(curFileName,theFork.getLength());
    final File outFile=new File(outDir,curFileName);
    if (defaultFileExistsAction != FileExistsAction.OVERWRITE && outFile.exists()) {
      FileExistsAction a;
      if (defaultFileExistsAction == FileExistsAction.PROMPT_USER)       a=progressDialog.fileExists(outFile);
 else {
        a=defaultFileExistsAction;
        defaultFileExistsAction=FileExistsAction.PROMPT_USER;
      }
      if (a == FileExistsAction.OVERWRITE) {
      }
 else       if (a == FileExistsAction.OVERWRITE_ALL) {
        extractProperties.setFileExistsAction(FileExistsAction.OVERWRITE);
        defaultFileExistsAction=FileExistsAction.OVERWRITE;
      }
 else       if (a == FileExistsAction.SKIP_FILE) {
        errorMessages.addLast("String_Node_Str" + outFile.getAbsolutePath() + "String_Node_Str");
        break;
      }
 else       if (a == FileExistsAction.SKIP_DIRECTORY) {
        errorMessages.addLast("String_Node_Str" + outDir.getAbsolutePath() + "String_Node_Str");
        skipDirectory.o=true;
        break;
      }
 else       if (a == FileExistsAction.RENAME) {
        fileName=progressDialog.displayRenamePrompt(curFileName,outDir);
        if (fileName == null)         fileName=curFileName;
        continue;
      }
 else       if (a == FileExistsAction.AUTO_RENAME) {
        fileName=FileNameTools.autoRenameIllegalFilename(curFileName,outDir,false);
        if (fileName == null)         fileName=curFileName;
        continue;
      }
 else       if (a == FileExistsAction.CANCEL) {
        progressDialog.signalCancel();
        break;
      }
 else {
        throw new RuntimeException("String_Node_Str" + a);
      }
    }
    try {
      try {
        outFile.getCanonicalPath();
      }
 catch (      Exception e) {
        throw new FileNotFoundException();
      }
      if (!outFile.getParentFile().equals(outDir) || !outFile.getName().equals(curFileName)) {
        throw new FileNotFoundException();
      }
      FileOutputStream fos=new FileOutputStream(outFile);
      if (forkType == FSForkType.MACOS_RESOURCE)       extractResourceForkToAppleDoubleStream(theFork,fos,progressDialog);
 else       extractForkToStream(theFork,fos,progressDialog);
      fos.close();
      setExtractedEntryAttributes(outFile,rec,errorMessages);
      if (curFileName != (Object)originalFileName && !curFileName.equals(originalFileName))       errorMessages.addLast("String_Node_Str" + originalFileName + "String_Node_Str"+ curFileName+ "String_Node_Str"+ outDir.getAbsolutePath()+ "String_Node_Str");
    }
 catch (    FileNotFoundException fnfe) {
      System.out.println("String_Node_Str" + outFile + "String_Node_Str");
      fnfe.printStackTrace();
      char[] filenameChars=curFileName.toCharArray();
      System.out.println("String_Node_Str" + filenameChars.length + "String_Node_Str");
      System.out.print("String_Node_Str");
      for (      char c : filenameChars) {
        System.out.print("String_Node_Str" + Util.toHexStringBE(c));
      }
      System.out.println();
      CreateFileFailedAction a;
      if (defaultCreateFileFailedAction == CreateFileFailedAction.PROMPT_USER)       a=progressDialog.createFileFailed(curFileName,outDir);
 else {
        a=defaultCreateFileFailedAction;
        defaultCreateFileFailedAction=CreateFileFailedAction.PROMPT_USER;
      }
      if (a == CreateFileFailedAction.SKIP_FILE) {
        errorMessages.addLast("String_Node_Str" + outFile.getAbsolutePath() + "String_Node_Str");
        break;
      }
 else       if (a == CreateFileFailedAction.SKIP_DIRECTORY) {
        errorMessages.addLast("String_Node_Str" + outDir.getAbsolutePath() + "String_Node_Str");
        skipDirectory.o=true;
        break;
      }
 else       if (a == CreateFileFailedAction.RENAME) {
        fileName=progressDialog.displayRenamePrompt(curFileName,outDir);
        if (fileName == null)         fileName=curFileName;
        continue;
      }
 else       if (a == CreateFileFailedAction.AUTO_RENAME) {
        fileName=FileNameTools.autoRenameIllegalFilename(curFileName,outDir,false);
        if (fileName == null)         fileName=curFileName;
        continue;
      }
 else       if (a == CreateFileFailedAction.CANCEL) {
        progressDialog.signalCancel();
        break;
      }
 else {
        throw new RuntimeException("String_Node_Str" + a);
      }
    }
catch (    IOException ioe) {
      System.err.println("String_Node_Str" + outFile + "String_Node_Str");
      ioe.printStackTrace();
      String msg=ioe.getMessage();
      int reply=JOptionPane.showConfirmDialog(this,"String_Node_Str" + curFileName + "String_Node_Str"+ outDir.getAbsolutePath()+ (msg != null ? "String_Node_Str" + msg + "String_Node_Str" : "String_Node_Str")+ "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.ERROR_MESSAGE);
      errorMessages.addLast("String_Node_Str" + curFileName + "String_Node_Str");
      if (reply == JOptionPane.NO_OPTION) {
        progressDialog.signalCancel();
      }
    }
catch (    Throwable e) {
      e.printStackTrace();
      errorMessages.addLast("String_Node_Str" + curFileName + "String_Node_Str");
      UnhandledExceptionAction a;
      if (defaultUnhandledExceptionAction == UnhandledExceptionAction.PROMPT_USER) {
        a=progressDialog.unhandledException(curFileName,e);
      }
 else {
        a=defaultUnhandledExceptionAction;
      }
      if (a == UnhandledExceptionAction.ABORT) {
        progressDialog.signalCancel();
      }
 else       if (a == UnhandledExceptionAction.CONTINUE || a == UnhandledExceptionAction.ALWAYS_CONTINUE) {
        if (a == UnhandledExceptionAction.ALWAYS_CONTINUE) {
          extractProperties.setUnhandledExceptionAction(UnhandledExceptionAction.CONTINUE);
          defaultUnhandledExceptionAction=UnhandledExceptionAction.CONTINUE;
        }
      }
 else {
        throw new RuntimeException("String_Node_Str" + "String_Node_Str" + a + "String_Node_Str");
      }
    }
    break;
  }
}

Fixed version (ground truth):
private void extractFile(final FSFile rec,final File outDir,final ExtractProgressMonitor progressDialog,final LinkedList<String> errorMessages,final ExtractProperties extractProperties,final ObjectContainer<Boolean> skipDirectory,final FSForkType forkType){
  final String originalFileName;
  if (forkType == FSForkType.DATA)   originalFileName=rec.getName();
 else   if (forkType == FSForkType.MACOS_RESOURCE)   originalFileName="String_Node_Str" + rec.getName();
 else   throw new RuntimeException("String_Node_Str" + forkType);
  CreateFileFailedAction defaultCreateFileFailedAction=extractProperties.getCreateFileFailedAction();
  FileExistsAction defaultFileExistsAction=extractProperties.getFileExistsAction();
  UnhandledExceptionAction defaultUnhandledExceptionAction=extractProperties.getUnhandledExceptionAction();
  String fileName=originalFileName;
  while (fileName != null) {
    String curFileName=fileName;
    fileName=null;
    final FSFork theFork=rec.getForkByType(forkType);
    if (theFork == null)     throw new RuntimeException("String_Node_Str" + forkType);
 else     if (forkType == FSForkType.MACOS_RESOURCE && theFork.getLength() == 0)     return;
    progressDialog.updateCurrentFile(curFileName,theFork.getLength());
    final File outFile=new File(outDir,curFileName);
    if (defaultFileExistsAction != FileExistsAction.OVERWRITE && outFile.exists()) {
      FileExistsAction a;
      if (defaultFileExistsAction == FileExistsAction.PROMPT_USER)       a=progressDialog.fileExists(outFile);
 else {
        a=defaultFileExistsAction;
        defaultFileExistsAction=FileExistsAction.PROMPT_USER;
      }
      if (a == FileExistsAction.OVERWRITE) {
      }
 else       if (a == FileExistsAction.OVERWRITE_ALL) {
        extractProperties.setFileExistsAction(FileExistsAction.OVERWRITE);
        defaultFileExistsAction=FileExistsAction.OVERWRITE;
      }
 else       if (a == FileExistsAction.SKIP_FILE) {
        errorMessages.addLast("String_Node_Str" + outFile.getAbsolutePath() + "String_Node_Str");
        break;
      }
 else       if (a == FileExistsAction.SKIP_DIRECTORY) {
        errorMessages.addLast("String_Node_Str" + outDir.getAbsolutePath() + "String_Node_Str");
        skipDirectory.o=true;
        break;
      }
 else       if (a == FileExistsAction.RENAME) {
        fileName=progressDialog.displayRenamePrompt(curFileName,outDir);
        if (fileName == null)         fileName=curFileName;
        continue;
      }
 else       if (a == FileExistsAction.AUTO_RENAME) {
        fileName=FileNameTools.autoRenameIllegalFilename(curFileName,outDir,false);
        if (fileName == null)         fileName=curFileName;
        continue;
      }
 else       if (a == FileExistsAction.CANCEL) {
        progressDialog.signalCancel();
        break;
      }
 else {
        throw new RuntimeException("String_Node_Str" + a);
      }
    }
    try {
      try {
        outFile.getCanonicalPath();
      }
 catch (      Exception e) {
        throw new FileNotFoundException();
      }
      if (!outFile.getParentFile().equals(outDir) || !outFile.getName().equals(curFileName)) {
        throw new FileNotFoundException();
      }
      FileOutputStream fos=new FileOutputStream(outFile);
      if (forkType == FSForkType.MACOS_RESOURCE)       extractResourceForkToAppleDoubleStream(theFork,fos,progressDialog);
 else       extractForkToStream(theFork,fos,progressDialog);
      fos.close();
      setExtractedEntryAttributes(outFile,rec,errorMessages);
      if (curFileName != (Object)originalFileName && !curFileName.equals(originalFileName))       errorMessages.addLast("String_Node_Str" + originalFileName + "String_Node_Str"+ curFileName+ "String_Node_Str"+ outDir.getAbsolutePath()+ "String_Node_Str");
    }
 catch (    FileNotFoundException fnfe) {
      System.out.println("String_Node_Str" + outFile + "String_Node_Str");
      fnfe.printStackTrace();
      char[] filenameChars=curFileName.toCharArray();
      System.out.println("String_Node_Str" + filenameChars.length + "String_Node_Str");
      System.out.print("String_Node_Str");
      for (      char c : filenameChars) {
        System.out.print("String_Node_Str" + Util.toHexStringBE(c));
      }
      System.out.println();
      CreateFileFailedAction a;
      if (defaultCreateFileFailedAction == CreateFileFailedAction.PROMPT_USER)       a=progressDialog.createFileFailed(curFileName,outDir);
 else {
        a=defaultCreateFileFailedAction;
        defaultCreateFileFailedAction=CreateFileFailedAction.PROMPT_USER;
      }
      if (a == CreateFileFailedAction.SKIP_FILE) {
        errorMessages.addLast("String_Node_Str" + outFile.getAbsolutePath() + "String_Node_Str");
        break;
      }
 else       if (a == CreateFileFailedAction.SKIP_DIRECTORY) {
        errorMessages.addLast("String_Node_Str" + outDir.getAbsolutePath() + "String_Node_Str");
        skipDirectory.o=true;
        break;
      }
 else       if (a == CreateFileFailedAction.RENAME) {
        fileName=progressDialog.displayRenamePrompt(curFileName,outDir);
        if (fileName == null)         fileName=curFileName;
        continue;
      }
 else       if (a == CreateFileFailedAction.AUTO_RENAME) {
        fileName=FileNameTools.autoRenameIllegalFilename(curFileName,outDir,false);
        if (fileName == null)         fileName=curFileName;
        continue;
      }
 else       if (a == CreateFileFailedAction.CANCEL) {
        progressDialog.signalCancel();
        break;
      }
 else {
        throw new RuntimeException("String_Node_Str" + a);
      }
    }
catch (    IOException ioe) {
      System.err.println("String_Node_Str" + outFile + "String_Node_Str");
      ioe.printStackTrace();
      String msg=ioe.getMessage();
      int reply=JOptionPane.showConfirmDialog(this,"String_Node_Str" + curFileName + "String_Node_Str"+ outDir.getAbsolutePath()+ (msg != null ? "String_Node_Str" + msg + "String_Node_Str" : "String_Node_Str")+ "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.ERROR_MESSAGE);
      errorMessages.addLast("String_Node_Str" + curFileName + "String_Node_Str");
      if (reply == JOptionPane.NO_OPTION) {
        progressDialog.signalCancel();
      }
    }
catch (    Throwable e) {
      e.printStackTrace();
      errorMessages.addLast("String_Node_Str" + "String_Node_Str" + curFileName + "String_Node_Str"+ "String_Node_Str");
      UnhandledExceptionAction a;
      if (defaultUnhandledExceptionAction == UnhandledExceptionAction.PROMPT_USER) {
        a=progressDialog.unhandledException(curFileName,e);
      }
 else {
        a=defaultUnhandledExceptionAction;
      }
      if (a == UnhandledExceptionAction.ABORT) {
        progressDialog.signalCancel();
      }
 else       if (a == UnhandledExceptionAction.CONTINUE || a == UnhandledExceptionAction.ALWAYS_CONTINUE) {
        if (a == UnhandledExceptionAction.ALWAYS_CONTINUE) {
          extractProperties.setUnhandledExceptionAction(UnhandledExceptionAction.CONTINUE);
          defaultUnhandledExceptionAction=UnhandledExceptionAction.CONTINUE;
        }
      }
 else {
        throw new RuntimeException("String_Node_Str" + "String_Node_Str" + a + "String_Node_Str");
      }
    }
    break;
  }
}