Program: 47250
Project: 47250
Buggy source:
public File applyFontconfigToASSTempSubsFile(File tempSubs,DLNAMediaInfo media) throws IOException {
  File outputSubs=tempSubs;
  StringBuilder outputString=new StringBuilder();
  File temp=new File(configuration.getTempFolder(),tempSubs.getName() + "String_Node_Str");
  FileUtils.copyFile(tempSubs,temp);
  BufferedWriter output;
  try (BufferedReader input=new BufferedReader(new FileReader(temp))){
    output=new BufferedWriter(new FileWriter(outputSubs));
    String line;
    String[] format=null;
    int i;
    while ((line=input.readLine()) != null) {
      outputString.setLength(0);
      if (line.startsWith("String_Node_Str")) {
        outputString.append(line).append("String_Node_Str");
        output.write(outputString.toString());
        while ((line=input.readLine()) != null) {
          outputString.setLength(0);
          if (!line.isEmpty()) {
            outputString.append(line).append("String_Node_Str");
            output.write(outputString.toString());
          }
 else {
            outputString.append("String_Node_Str").append(media.getHeight()).append("String_Node_Str");
            outputString.append("String_Node_Str").append(media.getWidth()).append("String_Node_Str");
            break;
          }
        }
      }
      if (line.startsWith("String_Node_Str")) {
        format=line.split("String_Node_Str");
        outputString.append(line).append("String_Node_Str");
        output.write(outputString.toString());
        continue;
      }
      if (line.startsWith("String_Node_Str")) {
        String[] params=line.split("String_Node_Str");
        for (i=0; i < format.length; i++) {
          if (format[i].contains("String_Node_Str")) {
            if (!configuration.getFont().isEmpty()) {
              params[i]=configuration.getFont();
            }
 else {
              params[i]="String_Node_Str";
            }
            continue;
          }
          if (format[i].contains("String_Node_Str")) {
            params[i]=Integer.toString((int)((Integer.parseInt(params[i]) * media.getHeight() / (double)288 * Double.parseDouble(configuration.getAssScale()))));
            continue;
          }
          if (format[i].contains("String_Node_Str")) {
            String primaryColour=Integer.toHexString(configuration.getSubsColor());
            params[i]="String_Node_Str" + primaryColour.substring(6,8) + primaryColour.substring(4,6)+ primaryColour.substring(2,4);
            continue;
          }
          if (format[i].contains("String_Node_Str")) {
            params[i]=configuration.getAssOutline();
            continue;
          }
          if (format[i].contains("String_Node_Str")) {
            params[i]=configuration.getAssShadow();
            continue;
          }
          if (format[i].contains("String_Node_Str")) {
            params[i]=configuration.getAssMargin();
          }
        }
        outputString.append(StringUtils.join(params,"String_Node_Str")).append("String_Node_Str");
        output.write(outputString.toString());
        continue;
      }
      outputString.append(line).append("String_Node_Str");
      output.write(outputString.toString());
    }
  }
   output.flush();
  output.close();
  temp.deleteOnExit();
  return outputSubs;
}

Fixed version (ground truth):
public File applyFontconfigToASSTempSubsFile(File tempSubs,DLNAMediaInfo media) throws IOException {
  File outputSubs=tempSubs;
  StringBuilder outputString=new StringBuilder();
  File temp=new File(configuration.getTempFolder(),tempSubs.getName() + "String_Node_Str");
  FileUtils.copyFile(tempSubs,temp);
  BufferedWriter output;
  try (BufferedReader input=new BufferedReader(new FileReader(temp))){
    output=new BufferedWriter(new FileWriter(outputSubs));
    String line;
    String[] format=null;
    int i;
    while ((line=input.readLine()) != null) {
      outputString.setLength(0);
      if (line.startsWith("String_Node_Str")) {
        outputString.append(line).append("String_Node_Str");
        output.write(outputString.toString());
        while ((line=input.readLine()) != null) {
          outputString.setLength(0);
          if (!line.isEmpty()) {
            outputString.append(line).append("String_Node_Str");
            output.write(outputString.toString());
          }
 else {
            outputString.append("String_Node_Str").append(media.getHeight()).append("String_Node_Str");
            outputString.append("String_Node_Str").append(media.getWidth()).append("String_Node_Str");
            break;
          }
        }
      }
      if (line != null && line.startsWith("String_Node_Str")) {
        format=line.split("String_Node_Str");
        outputString.append(line).append("String_Node_Str");
        output.write(outputString.toString());
        continue;
      }
      if (line != null && line.startsWith("String_Node_Str")) {
        String[] params=line.split("String_Node_Str");
        for (i=0; i < format.length; i++) {
          if (format[i].contains("String_Node_Str")) {
            if (!configuration.getFont().isEmpty()) {
              params[i]=configuration.getFont();
            }
 else {
              params[i]="String_Node_Str";
            }
            continue;
          }
          if (format[i].contains("String_Node_Str")) {
            params[i]=Integer.toString((int)((Integer.parseInt(params[i]) * media.getHeight() / (double)288 * Double.parseDouble(configuration.getAssScale()))));
            continue;
          }
          if (format[i].contains("String_Node_Str")) {
            String primaryColour=Integer.toHexString(configuration.getSubsColor());
            params[i]="String_Node_Str" + primaryColour.substring(6,8) + primaryColour.substring(4,6)+ primaryColour.substring(2,4);
            continue;
          }
          if (format[i].contains("String_Node_Str")) {
            params[i]=configuration.getAssOutline();
            continue;
          }
          if (format[i].contains("String_Node_Str")) {
            params[i]=configuration.getAssShadow();
            continue;
          }
          if (format[i].contains("String_Node_Str")) {
            params[i]=configuration.getAssMargin();
          }
        }
        outputString.append(StringUtils.join(params,"String_Node_Str")).append("String_Node_Str");
        output.write(outputString.toString());
        continue;
      }
      outputString.append(line).append("String_Node_Str");
      output.write(outputString.toString());
    }
  }
   output.flush();
  output.close();
  temp.deleteOnExit();
  return outputSubs;
}