Program: 168548
Project: 168548
Buggy source:
private int extractFile(final FSFile rec,final File outDir,final ProgressMonitor progressDialog,final ObjectContainer<Boolean> overwriteAll,final boolean extractResourceFork){
  int errorCount=0;
  String filename=rec.getName();
  if (extractResourceFork)   filename="String_Node_Str" + filename;
  while (true) {
    final FSFork theFork;
    if (!extractResourceFork)     theFork=rec.getMainFork();
 else     theFork=rec.getForkByType(FSForkType.MACOS_RESOURCE);
    if (theFork == null)     throw new RuntimeException("String_Node_Str" + (extractResourceFork ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
    progressDialog.updateCurrentFile(filename,theFork.getLength());
    File outFile=new File(outDir,filename);
    if (!overwriteAll.o && outFile.exists()) {
      String[] options=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
      int reply=JOptionPane.showOptionDialog(this,"String_Node_Str" + outFile.getAbsolutePath() + "String_Node_Str"+ "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.WARNING_MESSAGE,null,options,options[0]);
      if (reply == 0)       ;
 else       if (reply == 1)       overwriteAll.o=true;
 else       if (reply == 2) {
        ++errorCount;
        break;
      }
 else       if (reply == 3) {
        Object selection=JOptionPane.showInputDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE,null,null,filename);
        if (selection == null) {
          ++errorCount;
          progressDialog.signalCancel();
          break;
        }
 else {
          filename=selection.toString();
          continue;
        }
      }
 else {
        ++errorCount;
        progressDialog.signalCancel();
        break;
      }
    }
    try {
      try {
        outFile.getCanonicalPath();
      }
 catch (      Exception e) {
        throw new FileNotFoundException();
      }
      if (!outFile.getParentFile().equals(outDir) || !outFile.getName().equals(filename))       throw new FileNotFoundException();
      FileOutputStream fos=new FileOutputStream(outFile);
      extractForkToStream(theFork,fos,progressDialog);
      fos.close();
    }
 catch (    FileNotFoundException fnfe) {
      System.out.println("String_Node_Str" + outFile + "String_Node_Str");
      fnfe.printStackTrace();
      char[] filenameChars=filename.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();
      String[] options=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"};
      int reply=JOptionPane.showOptionDialog(this,"String_Node_Str" + outFile + "String_Node_Str"+ outDir.getAbsolutePath()+ "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.ERROR_MESSAGE,null,options,options[0]);
      if (reply == 0) {
        ++errorCount;
      }
 else       if (reply == 2) {
        Object selection=JOptionPane.showInputDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE,null,null,filename);
        if (selection == null) {
          ++errorCount;
          progressDialog.signalCancel();
        }
 else {
          filename=selection.toString();
          continue;
        }
      }
 else {
        ++errorCount;
        progressDialog.signalCancel();
      }
    }
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" + filename + "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);
      ++errorCount;
      if (reply == JOptionPane.NO_OPTION)       progressDialog.signalCancel();
    }
catch (    Throwable e) {
      e.printStackTrace();
      String message="String_Node_Str" + filename + "String_Node_Str";
      message+="String_Node_Str" + e.toString();
      for (      StackTraceElement ste : e.getStackTrace())       message+="String_Node_Str" + ste.toString();
      message+="String_Node_Str";
      int reply=JOptionPane.showConfirmDialog(this,message + "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.ERROR_MESSAGE);
      ++errorCount;
      if (reply == JOptionPane.NO_OPTION)       progressDialog.signalCancel();
    }
    break;
  }
  return errorCount;
}

Fixed version (ground truth):
private int extractFile(final FSFile rec,final File outDir,final ProgressMonitor progressDialog,final ObjectContainer<Boolean> overwriteAll,final boolean extractResourceFork){
  int errorCount=0;
  String filename=rec.getName();
  if (extractResourceFork) {
    filename="String_Node_Str" + filename;
  }
  while (true) {
    final FSFork theFork;
    if (!extractResourceFork) {
      theFork=rec.getMainFork();
    }
 else {
      theFork=rec.getForkByType(FSForkType.MACOS_RESOURCE);
    }
    if (theFork == null) {
      throw new RuntimeException("String_Node_Str" + (extractResourceFork ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
    }
    progressDialog.updateCurrentFile(filename,theFork.getLength());
    File outFile=new File(outDir,filename);
    if (!overwriteAll.o && outFile.exists()) {
      String[] options=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
      int reply=JOptionPane.showOptionDialog(this,"String_Node_Str" + outFile.getAbsolutePath() + "String_Node_Str"+ "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.WARNING_MESSAGE,null,options,options[0]);
      if (reply == 0)       ;
 else       if (reply == 1) {
        overwriteAll.o=true;
      }
 else       if (reply == 2) {
        ++errorCount;
        break;
      }
 else       if (reply == 3) {
        Object selection=JOptionPane.showInputDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE,null,null,filename);
        if (selection == null) {
          ++errorCount;
          progressDialog.signalCancel();
          break;
        }
 else {
          filename=selection.toString();
          continue;
        }
      }
 else {
        ++errorCount;
        progressDialog.signalCancel();
        break;
      }
    }
    try {
      try {
        outFile.getCanonicalPath();
      }
 catch (      Exception e) {
        throw new FileNotFoundException();
      }
      if (!outFile.getParentFile().equals(outDir) || !outFile.getName().equals(filename)) {
        throw new FileNotFoundException();
      }
      FileOutputStream fos=new FileOutputStream(outFile);
      extractForkToStream(theFork,fos,progressDialog);
      fos.close();
    }
 catch (    FileNotFoundException fnfe) {
      System.out.println("String_Node_Str" + outFile + "String_Node_Str");
      fnfe.printStackTrace();
      char[] filenameChars=filename.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();
      String[] options=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"};
      int reply=JOptionPane.showOptionDialog(this,"String_Node_Str" + outFile + "String_Node_Str"+ outDir.getAbsolutePath()+ "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.ERROR_MESSAGE,null,options,options[0]);
      if (reply == 0) {
        ++errorCount;
      }
 else       if (reply == 2) {
        Object selection=JOptionPane.showInputDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE,null,null,filename);
        if (selection == null) {
          ++errorCount;
          progressDialog.signalCancel();
        }
 else {
          filename=selection.toString();
          continue;
        }
      }
 else {
        ++errorCount;
        progressDialog.signalCancel();
      }
    }
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" + filename + "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);
      ++errorCount;
      if (reply == JOptionPane.NO_OPTION) {
        progressDialog.signalCancel();
      }
    }
catch (    Throwable e) {
      e.printStackTrace();
      String message="String_Node_Str" + filename + "String_Node_Str";
      message+="String_Node_Str" + e.toString();
      for (      StackTraceElement ste : e.getStackTrace()) {
        message+="String_Node_Str" + ste.toString();
      }
      message+="String_Node_Str";
      int reply=JOptionPane.showConfirmDialog(this,message + "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.ERROR_MESSAGE);
      ++errorCount;
      if (reply == JOptionPane.NO_OPTION) {
        progressDialog.signalCancel();
      }
    }
    break;
  }
  return errorCount;
}