Program: 140935
Project: 140935
Buggy source:
public static void export(Grid grid,String filePath,int nbrDecimals,ProgressIndicator progressIndicator) throws IOException {
  PrintWriter writer=null;
  try {
    DecimalFormat df=new DecimalFormat();
    df.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));
    df.setMinimumFractionDigits(0);
    df.setMaximumFractionDigits(nbrDecimals);
    df.setGroupingUsed(false);
    writer=new PrintWriter(new BufferedWriter(new FileWriter(filePath)));
    String voidValueStr=Float.toString(findVoidValue(grid));
    String lineSeparator=System.getProperty("String_Node_Str");
    writer.write("String_Node_Str" + grid.getCols() + lineSeparator);
    writer.write("String_Node_Str" + grid.getRows() + lineSeparator);
    writer.write("String_Node_Str" + grid.getWest() + lineSeparator);
    writer.write("String_Node_Str" + grid.getSouth() + lineSeparator);
    writer.write("String_Node_Str" + grid.getCellSize() + lineSeparator);
    writer.write("String_Node_Str" + voidValueStr + lineSeparator);
    int nRows=grid.getRows();
    int nCols=grid.getCols();
    for (int row=0; row < nRows; ++row) {
      if (progressIndicator != null) {
        int progress=(int)Math.round(100d * (row + 1f) / nRows);
        if (progressIndicator.progress(progress) == false) {
          new File(filePath).delete();
          return;
        }
      }
      for (int col=0; col < nCols; ++col) {
        if (col % 1000 == 0) {
          if (progressIndicator != null && progressIndicator.isCancelled()) {
            new File(filePath).delete();
            return;
          }
        }
        float v=grid.getValue(col,row);
        if (Float.isNaN(v)) {
          writer.write(voidValueStr);
        }
 else {
          writer.write(df.format(v));
        }
        writer.write("String_Node_Str");
      }
      writer.write(lineSeparator);
    }
    WKTProjectionFile.write(grid.getPrjFileContent(),filePath);
  }
 catch (  Throwable exc) {
    if (writer != null) {
      writer.close();
      writer=null;
    }
    new File(filePath).delete();
    throw exc;
  }
 finally {
    if (writer != null) {
      writer.close();
    }
  }
}

Fixed version (ground truth):
public static void export(Grid grid,String filePath,int nbrDecimals,ProgressIndicator progressIndicator) throws IOException {
  PrintWriter writer=null;
  try {
    DecimalFormat df=new DecimalFormat();
    df.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));
    df.setMinimumFractionDigits(0);
    df.setMaximumFractionDigits(nbrDecimals);
    df.setGroupingUsed(false);
    writer=new PrintWriter(new BufferedWriter(new FileWriter(filePath)));
    String voidValueStr=Float.toString(findVoidValue(grid));
    String lineSeparator=System.getProperty("String_Node_Str");
    writer.write("String_Node_Str" + grid.getCols() + lineSeparator);
    writer.write("String_Node_Str" + grid.getRows() + lineSeparator);
    writer.write("String_Node_Str" + grid.getWest() + lineSeparator);
    writer.write("String_Node_Str" + grid.getSouth() + lineSeparator);
    writer.write("String_Node_Str" + grid.getCellSize() + lineSeparator);
    writer.write("String_Node_Str" + voidValueStr + lineSeparator);
    int nRows=grid.getRows();
    int nCols=grid.getCols();
    for (int row=0; row < nRows; ++row) {
      if (progressIndicator != null) {
        int progress=(int)Math.round(100d * (row + 1) / nRows);
        if (progressIndicator.progress(progress) == false) {
          new File(filePath).delete();
          return;
        }
      }
      for (int col=0; col < nCols; ++col) {
        if (col % 1000 == 0) {
          if (progressIndicator != null && progressIndicator.isCancelled()) {
            new File(filePath).delete();
            return;
          }
        }
        float v=grid.getValue(col,row);
        if (Float.isNaN(v)) {
          writer.write(voidValueStr);
        }
 else {
          writer.write(df.format(v));
        }
        writer.write("String_Node_Str");
      }
      writer.write(lineSeparator);
    }
    WKTProjectionFile.write(grid.getPrjFileContent(),filePath);
  }
 catch (  Throwable exc) {
    if (writer != null) {
      writer.close();
      writer=null;
    }
    new File(filePath).delete();
    throw exc;
  }
 finally {
    if (writer != null) {
      writer.close();
    }
  }
}