Program: 47256
Project: 47256
Buggy source:
/** 
 * Extracts embedded subtitles from video to file in SSA/ASS format, converts external SRT subtitles file to SSA/ASS format and applies fontconfig setting to that converted file and applies timeseeking when required.
 * @param dlna DLNAResource
 * @param media DLNAMediaInfo
 * @param params Output parameters
 * @return Converted subtitle file
 * @throws IOException
 */
public File getSubtitles(DLNAResource dlna,DLNAMediaInfo media,OutputParams params) throws IOException {
  if (media == null || params.sid.getId() == -1) {
    return null;
  }
  String dir=configuration.getDataFile(SUB_DIR);
  File subsPath=new File(dir);
  if (!subsPath.exists()) {
    subsPath.mkdirs();
  }
  boolean applyFontConfig=configuration.isFFmpegFontConfig();
  boolean isEmbeddedSource=params.sid.getId() < 100;
  String filename=isEmbeddedSource ? dlna.getSystemName() : params.sid.getExternalFile().getAbsolutePath();
  String basename;
  long modId=new File(filename).lastModified();
  if (modId != 0) {
    basename=FilenameUtils.getBaseName(filename);
  }
 else {
    basename=dlna.getName().replaceAll("String_Node_Str","String_Node_Str").trim();
    modId=filename.hashCode();
  }
  File convertedSubs;
  if (applyFontConfig || isEmbeddedSource) {
    convertedSubs=new File(subsPath.getAbsolutePath() + File.separator + basename+ "String_Node_Str"+ params.sid.getId()+ "String_Node_Str"+ modId+ "String_Node_Str");
  }
 else {
    convertedSubs=new File(subsPath.getAbsolutePath() + File.separator + modId+ "String_Node_Str"+ params.sid.getExternalFile().getName());
  }
  if (convertedSubs.canRead()) {
    return convertedSubs;
  }
  boolean isExternalAss=false;
  if (params.sid.getType() == SubtitleType.ASS && params.sid.isExternal() && !isEmbeddedSource) {
    isExternalAss=true;
  }
  File tempSubs;
  if (isExternalAss || (!applyFontConfig && !isEmbeddedSource && params.sid.getType() == SubtitleType.SUBRIP)) {
    tempSubs=params.sid.getExternalFile();
  }
 else {
    tempSubs=convertSubsToAss(filename,media,params);
  }
  if (tempSubs == null) {
    return null;
  }
  if (!FileUtil.isFileUTF8(tempSubs)) {
    tempSubs=SubtitleUtils.applyCodepageConversion(tempSubs,convertedSubs);
  }
 else {
    FileUtils.copyFile(tempSubs,convertedSubs);
    tempSubs=convertedSubs;
  }
  if (applyFontConfig) {
    try {
      tempSubs=applyFontconfigToASSTempSubsFile(tempSubs,media);
    }
 catch (    IOException e) {
      LOGGER.debug("String_Node_Str" + e);
      return null;
    }
  }
  if (isEmbeddedSource) {
    params.sid.setExternalFile(tempSubs);
    params.sid.setType(SubtitleType.ASS);
  }
  PMS.get().addTempFile(tempSubs,30 * 24 * 3600* 1000);
  return tempSubs;
}

Fixed version (ground truth):
/** 
 * Extracts embedded subtitles from video to file in SSA/ASS format, converts external SRT subtitles file to SSA/ASS format and applies fontconfig setting to that converted file and applies timeseeking when required.
 * @param dlna DLNAResource
 * @param media DLNAMediaInfo
 * @param params Output parameters
 * @return Converted subtitle file
 * @throws IOException
 */
public File getSubtitles(DLNAResource dlna,DLNAMediaInfo media,OutputParams params) throws IOException {
  if (media == null || params.sid.getId() == -1) {
    return null;
  }
  String dir=configuration.getDataFile(SUB_DIR);
  File subsPath=new File(dir);
  if (!subsPath.exists()) {
    subsPath.mkdirs();
  }
  boolean applyFontConfig=configuration.isFFmpegFontConfig();
  boolean isEmbeddedSource=params.sid.getId() < 100;
  String filename=isEmbeddedSource ? dlna.getSystemName() : params.sid.getExternalFile().getAbsolutePath();
  String basename;
  long modId=new File(filename).lastModified();
  if (modId != 0) {
    basename=FilenameUtils.getBaseName(filename);
  }
 else {
    basename=dlna.getName().replaceAll("String_Node_Str","String_Node_Str").trim();
    modId=filename.hashCode();
  }
  File convertedSubs;
  if (applyFontConfig || isEmbeddedSource) {
    convertedSubs=new File(subsPath.getAbsolutePath() + File.separator + basename+ "String_Node_Str"+ params.sid.getId()+ "String_Node_Str"+ modId+ "String_Node_Str");
  }
 else {
    String tmp=params.sid.getExternalFile().getName().replaceAll("String_Node_Str","String_Node_Str").trim();
    convertedSubs=new File(subsPath.getAbsolutePath() + File.separator + modId+ "String_Node_Str"+ tmp);
  }
  if (convertedSubs.canRead()) {
    return convertedSubs;
  }
  boolean isExternalAss=false;
  if (params.sid.getType() == SubtitleType.ASS && params.sid.isExternal() && !isEmbeddedSource) {
    isExternalAss=true;
  }
  File tempSubs;
  if (isExternalAss || (!applyFontConfig && !isEmbeddedSource && params.sid.getType() == SubtitleType.SUBRIP)) {
    tempSubs=params.sid.getExternalFile();
  }
 else {
    tempSubs=convertSubsToAss(filename,media,params);
  }
  if (tempSubs == null) {
    return null;
  }
  if (!FileUtil.isFileUTF8(tempSubs)) {
    tempSubs=SubtitleUtils.applyCodepageConversion(tempSubs,convertedSubs);
  }
 else {
    FileUtils.copyFile(tempSubs,convertedSubs);
    tempSubs=convertedSubs;
  }
  if (applyFontConfig) {
    try {
      tempSubs=applyFontconfigToASSTempSubsFile(tempSubs,media);
    }
 catch (    IOException e) {
      LOGGER.debug("String_Node_Str" + e);
      return null;
    }
  }
  if (isEmbeddedSource) {
    params.sid.setExternalFile(tempSubs);
    params.sid.setType(SubtitleType.ASS);
  }
  PMS.get().addTempFile(tempSubs,30 * 24 * 3600* 1000);
  return tempSubs;
}