Program: 168593
Project: 168593
Buggy source:
private int extractRecursive(HFSPlusCatalogLeafRecord rec,File outDir,ExtractProgressDialog progressDialog){
  if (progressDialog.cancelSignaled()) {
    progressDialog.confirmCancel();
    return 0;
  }
  int errorCount=0;
  HFSPlusCatalogLeafRecordData recData=rec.getData();
  if (recData.getRecordType() == HFSPlusCatalogLeafRecordData.RECORD_TYPE_FILE && recData instanceof HFSPlusCatalogFile) {
    String filename=rec.getKey().getNodeName().getUnicodeAsComposedString(normalizationToolkit);
    progressDialog.updateCurrentFile(filename);
    File outFile=new File(outDir,filename);
    try {
      FileOutputStream fos=new FileOutputStream(outFile);
      fsView.extractDataForkToStream(rec,fos);
      fos.close();
    }
 catch (    FileNotFoundException fnfe) {
      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();
      int reply=JOptionPane.showConfirmDialog(this,"String_Node_Str" + filename + "String_Node_Str"+ outDir.getAbsolutePath()+ "String_Node_Str"+ "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.ERROR_MESSAGE);
      if (reply == JOptionPane.NO_OPTION)       progressDialog.signalCancel();
      ++errorCount;
    }
catch (    IOException ioe) {
      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);
      if (reply == JOptionPane.NO_OPTION)       progressDialog.signalCancel();
      ++errorCount;
    }
catch (    Exception 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);
      if (reply == JOptionPane.NO_OPTION)       progressDialog.signalCancel();
      ++errorCount;
    }
    progressDialog.addDataProgress(((HFSPlusCatalogFile)recData).getDataFork().getLogicalSize());
  }
 else   if (recData.getRecordType() == HFSPlusCatalogLeafRecordData.RECORD_TYPE_FOLDER && recData instanceof HFSPlusCatalogFolder) {
    String dirName=rec.getKey().getNodeName().toString();
    progressDialog.updateCurrentFile(dirName);
    HFSCatalogNodeID requestedID;
    HFSPlusCatalogFolder catFolder=(HFSPlusCatalogFolder)recData;
    requestedID=catFolder.getFolderID();
    HFSPlusCatalogLeafRecord[] contents=fsView.listRecords(requestedID);
    File thisDir=new File(outDir,dirName);
    if (thisDir.mkdir()) {
      for (      HFSPlusCatalogLeafRecord outRec : contents) {
        errorCount+=extractRecursive(outRec,thisDir,progressDialog);
      }
    }
 else {
      int reply=JOptionPane.showConfirmDialog(this,"String_Node_Str" + thisDir.getAbsolutePath() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.ERROR_MESSAGE);
      if (reply == JOptionPane.NO_OPTION)       progressDialog.signalCancel();
      ++errorCount;
    }
  }
  return errorCount;
}

Fixed version (ground truth):
private int extractRecursive(HFSPlusCatalogLeafRecord rec,File outDir,ExtractProgressDialog progressDialog){
  if (progressDialog.cancelSignaled()) {
    progressDialog.confirmCancel();
    return 0;
  }
  int errorCount=0;
  HFSPlusCatalogLeafRecordData recData=rec.getData();
  if (recData.getRecordType() == HFSPlusCatalogLeafRecordData.RECORD_TYPE_FILE && recData instanceof HFSPlusCatalogFile) {
    String filename=rec.getKey().getNodeName().getUnicodeAsComposedString(normalizationToolkit);
    progressDialog.updateCurrentFile(filename);
    File outFile=new File(outDir,filename);
    try {
      FileOutputStream fos=new FileOutputStream(outFile);
      fsView.extractDataForkToStream(rec,fos);
      fos.close();
    }
 catch (    FileNotFoundException fnfe) {
      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();
      int reply=JOptionPane.showConfirmDialog(this,"String_Node_Str" + filename + "String_Node_Str"+ outDir.getAbsolutePath()+ "String_Node_Str"+ "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.ERROR_MESSAGE);
      if (reply == JOptionPane.NO_OPTION)       progressDialog.signalCancel();
      ++errorCount;
    }
catch (    IOException ioe) {
      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);
      if (reply == JOptionPane.NO_OPTION)       progressDialog.signalCancel();
      ++errorCount;
    }
catch (    Exception 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);
      if (reply == JOptionPane.NO_OPTION)       progressDialog.signalCancel();
      ++errorCount;
    }
    progressDialog.addDataProgress(((HFSPlusCatalogFile)recData).getDataFork().getLogicalSize());
  }
 else   if (recData.getRecordType() == HFSPlusCatalogLeafRecordData.RECORD_TYPE_FOLDER && recData instanceof HFSPlusCatalogFolder) {
    String dirName=rec.getKey().getNodeName().getUnicodeAsComposedString(normalizationToolkit);
    progressDialog.updateCurrentFile(dirName);
    HFSCatalogNodeID requestedID;
    HFSPlusCatalogFolder catFolder=(HFSPlusCatalogFolder)recData;
    requestedID=catFolder.getFolderID();
    HFSPlusCatalogLeafRecord[] contents=fsView.listRecords(requestedID);
    File thisDir=new File(outDir,dirName);
    if (thisDir.mkdir()) {
      for (      HFSPlusCatalogLeafRecord outRec : contents) {
        errorCount+=extractRecursive(outRec,thisDir,progressDialog);
      }
    }
 else {
      int reply=JOptionPane.showConfirmDialog(this,"String_Node_Str" + thisDir.getAbsolutePath() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.ERROR_MESSAGE);
      if (reply == JOptionPane.NO_OPTION)       progressDialog.signalCancel();
      ++errorCount;
    }
  }
  return errorCount;
}