Program: 47140
Project: 47140
Buggy source:
public static File applyFontconfigToASSTempSubsFile(File tempSubs,DLNAMediaInfo media,PmsConfiguration configuration) throws IOException {
  LOGGER.debug("String_Node_Str" + tempSubs.getName());
  File outputSubs=tempSubs;
  StringBuilder outputString=new StringBuilder();
  File temp=new File(configuration.getTempFolder(),tempSubs.getName() + "String_Node_Str");
  FileUtils.copyFile(tempSubs,temp);
  BufferedReader input=FileUtil.bufferedReaderWithCorrectCharset(temp);
  BufferedWriter output=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputSubs),CHARSET_UTF_8));
  try {
    String line;
    String[] format=null;
    int i;
    boolean playResIsSet=false;
    while ((line=input.readLine()) != null) {
      outputString.setLength(0);
      if (line.contains("String_Node_Str")) {
        outputString.append(line).append("String_Node_Str");
        output.write(outputString.toString());
        while ((line=input.readLine()) != null) {
          outputString.setLength(0);
          if (isNotBlank(line)) {
            if (line.contains("String_Node_Str") || line.contains("String_Node_Str")) {
              playResIsSet=true;
            }
            outputString.append(line).append("String_Node_Str");
            output.write(outputString.toString());
          }
 else {
            if (!playResIsSet) {
              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.contains("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.contains("String_Node_Str")) {
        String[] params=line.split("String_Node_Str");
        for (i=0; i < format.length; i++) {
switch (format[i].trim()) {
case "String_Node_Str":
            if (!configuration.getFont().isEmpty()) {
              params[i]=configuration.getFont();
            }
          break;
case "String_Node_Str":
        if (!playResIsSet) {
          params[i]=Integer.toString((int)((Integer.parseInt(params[i]) * media.getHeight() / (double)288 * Double.parseDouble(configuration.getAssScale()))));
        }
 else {
          params[i]=Integer.toString((int)(Integer.parseInt(params[i]) * Double.parseDouble(configuration.getAssScale())));
        }
      break;
case "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);
break;
case "String_Node_Str":
params[i]=configuration.getAssOutline();
break;
case "String_Node_Str":
params[i]=configuration.getAssShadow();
break;
case "String_Node_Str":
params[i]=configuration.getAssMargin();
break;
default :
break;
}
}
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());
}
}
  finally {
input.close();
output.flush();
output.close();
temp.deleteOnExit();
}
return outputSubs;
}

Fixed version (ground truth):
public static File applyFontconfigToASSTempSubsFile(File tempSubs,DLNAMediaInfo media,PmsConfiguration configuration) throws IOException {
  LOGGER.debug("String_Node_Str" + tempSubs.getName());
  File outputSubs=tempSubs;
  StringBuilder outputString=new StringBuilder();
  File temp=new File(configuration.getTempFolder(),tempSubs.getName() + "String_Node_Str");
  FileUtils.copyFile(tempSubs,temp);
  BufferedReader input=FileUtil.bufferedReaderWithCorrectCharset(temp);
  BufferedWriter output=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputSubs),CHARSET_UTF_8));
  try {
    String line;
    String[] format=null;
    int i;
    boolean playResIsSet=false;
    while ((line=input.readLine()) != null) {
      outputString.setLength(0);
      if (line.contains("String_Node_Str")) {
        outputString.append(line).append("String_Node_Str");
        output.write(outputString.toString());
        while ((line=input.readLine()) != null) {
          outputString.setLength(0);
          if (isNotBlank(line)) {
            if (line.contains("String_Node_Str") || line.contains("String_Node_Str")) {
              playResIsSet=true;
            }
            outputString.append(line).append("String_Node_Str");
            output.write(outputString.toString());
          }
 else {
            if (!playResIsSet) {
              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.contains("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.contains("String_Node_Str")) {
        String[] params=line.split("String_Node_Str");
        for (i=0; i < format.length; i++) {
switch (format[i].trim()) {
case "String_Node_Str":
            if (!configuration.getFont().isEmpty()) {
              params[i]=configuration.getFont();
            }
          break;
case "String_Node_Str":
        if (!playResIsSet) {
          params[i]=Integer.toString((int)((Integer.parseInt(params[i]) * media.getHeight() / (double)288 * Double.parseDouble(configuration.getAssScale()))));
        }
 else {
          params[i]=Integer.toString((int)(Integer.parseInt(params[i]) * Double.parseDouble(configuration.getAssScale())));
        }
      break;
case "String_Node_Str":
    params[i]=convertColorToASSColorString(configuration.getSubsColor());
  break;
case "String_Node_Str":
params[i]=configuration.getAssOutline();
break;
case "String_Node_Str":
params[i]=configuration.getAssShadow();
break;
case "String_Node_Str":
params[i]=configuration.getAssMargin();
break;
default :
break;
}
}
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());
}
}
  finally {
input.close();
output.flush();
output.close();
temp.deleteOnExit();
}
return outputSubs;
}