Program: 47197
Project: 47197
Buggy source:
public synchronized static void parse(DLNAMediaInfo media,InputFile inputFile,int type){
  File file=inputFile.getFile();
  if (!media.isMediaparsed() && file != null && MI.isValid() && MI.Open(file.getAbsolutePath()) > 0) {
    try {
      DLNAMediaAudio currentAudioTrack=new DLNAMediaAudio();
      DLNAMediaSubtitle currentSubTrack=new DLNAMediaSubtitle();
      media.setSize(file.length());
      String value;
      getFormat(StreamType.General,media,currentAudioTrack,MI.Get(StreamType.General,0,"String_Node_Str").toLowerCase(),file);
      media.setDuration(getDuration(MI.Get(StreamType.General,0,"String_Node_Str")));
      media.setBitrate(getBitrate(MI.Get(StreamType.General,0,"String_Node_Str")));
      value=MI.Get(StreamType.General,0,"String_Node_Str");
      if (isNotBlank(value)) {
        media.setThumb(getCover(value));
      }
      int videos=MI.Count_Get(StreamType.Video);
      if (videos > 0) {
        for (int i=0; i < videos; i++) {
          if (MI.Get(StreamType.Video,i,"String_Node_Str").startsWith("String_Node_Str")) {
            currentSubTrack=new DLNAMediaSubtitle();
            currentSubTrack.setType(SubtitleType.valueOfLibMediaInfoCodec(MI.Get(StreamType.Video,i,"String_Node_Str")));
            currentSubTrack.setType(SubtitleType.valueOfLibMediaInfoCodec(MI.Get(StreamType.Video,i,"String_Node_Str")));
            currentSubTrack.setId(media.getSubtitleTracksList().size());
            addSub(currentSubTrack,media);
          }
 else {
            getFormat(StreamType.Video,media,currentAudioTrack,MI.Get(StreamType.Video,i,"String_Node_Str").toLowerCase(),file);
            media.setWidth(getPixelValue(MI.Get(StreamType.Video,i,"String_Node_Str")));
            media.setHeight(getPixelValue(MI.Get(StreamType.Video,i,"String_Node_Str")));
            media.setFrameRate(getFPSValue(MI.Get(StreamType.Video,i,"String_Node_Str")));
            media.setStereoscopy(MI.Get(StreamType.Video,i,"String_Node_Str"));
            media.setAspectRatioContainer(MI.Get(StreamType.Video,i,"String_Node_Str"));
            media.setAspectRatioVideoTrack(MI.Get(StreamType.Video,i,"String_Node_Str"));
            media.setFrameRate(getFPSValue(MI.Get(StreamType.Video,i,"String_Node_Str")));
            media.setFrameRateMode(getFrameRateModeValue(MI.Get(StreamType.Video,i,"String_Node_Str")));
            media.setReferenceFrameCount(getReferenceFrameCount(MI.Get(StreamType.Video,i,"String_Node_Str")));
            value=MI.Get(StreamType.Video,i,"String_Node_Str",InfoType.Text,InfoType.Name);
            if (isNotBlank(value)) {
              media.putExtra(FormatConfiguration.MI_QPEL,value);
            }
            value=MI.Get(StreamType.Video,i,"String_Node_Str",InfoType.Text,InfoType.Name);
            if (isNotBlank(value)) {
              media.putExtra(FormatConfiguration.MI_GMC,value);
            }
            value=MI.Get(StreamType.Video,i,"String_Node_Str",InfoType.Text,InfoType.Name);
            if (isNotBlank(value)) {
              media.putExtra(FormatConfiguration.MI_GOP,value);
            }
            media.setMuxingMode(MI.Get(StreamType.Video,i,"String_Node_Str",InfoType.Text,InfoType.Name));
            if (!media.isEncrypted()) {
              media.setEncrypted("String_Node_Str".equals(MI.Get(StreamType.Video,i,"String_Node_Str")));
            }
          }
        }
      }
      int audioTracks=MI.Count_Get(StreamType.Audio);
      if (audioTracks > 0) {
        for (int i=0; i < audioTracks; i++) {
          currentAudioTrack=new DLNAMediaAudio();
          getFormat(StreamType.Audio,media,currentAudioTrack,MI.Get(StreamType.Audio,i,"String_Node_Str").toLowerCase(),file);
          getFormat(StreamType.Audio,media,currentAudioTrack,MI.Get(StreamType.Audio,i,"String_Node_Str").toLowerCase(),file);
          getFormat(StreamType.Audio,media,currentAudioTrack,MI.Get(StreamType.Audio,i,"String_Node_Str").toLowerCase(),file);
          getFormat(StreamType.Audio,media,currentAudioTrack,MI.Get(StreamType.Audio,i,"String_Node_Str").toLowerCase(),file);
          currentAudioTrack.setLang(getLang(MI.Get(StreamType.Audio,i,"String_Node_Str")));
          currentAudioTrack.setFlavor(getFlavor(MI.Get(StreamType.Audio,i,"String_Node_Str")));
          currentAudioTrack.getAudioProperties().setNumberOfChannels(MI.Get(StreamType.Audio,i,"String_Node_Str"));
          currentAudioTrack.setSampleFrequency(getSampleFrequency(MI.Get(StreamType.Audio,i,"String_Node_Str")));
          currentAudioTrack.setBitRate(getBitrate(MI.Get(StreamType.Audio,i,"String_Node_Str")));
          currentAudioTrack.setSongname(MI.Get(StreamType.General,0,"String_Node_Str"));
          currentAudioTrack.setAlbum(MI.Get(StreamType.General,0,"String_Node_Str"));
          currentAudioTrack.setArtist(MI.Get(StreamType.General,0,"String_Node_Str"));
          currentAudioTrack.setGenre(MI.Get(StreamType.General,0,"String_Node_Str"));
          String recordedDate=MI.Get(StreamType.General,0,"String_Node_Str");
          Matcher matcher=yearPattern.matcher(recordedDate);
          if (matcher.matches()) {
            try {
              currentAudioTrack.setYear(Integer.parseInt(matcher.group(1)));
            }
 catch (            NumberFormatException nfe) {
              LOGGER.debug("String_Node_Str" + recordedDate + "String_Node_Str");
            }
          }
          value=MI.Get(StreamType.Audio,i,"String_Node_Str");
          if (isNotBlank(value)) {
            if (value.contains("String_Node_Str") && !FormatConfiguration.OGG.equals(media.getContainer())) {
              currentAudioTrack.setId(getSpecificID(value));
            }
 else {
              currentAudioTrack.setId(media.getAudioTracksList().size());
            }
          }
          value=MI.Get(StreamType.General,i,"String_Node_Str");
          if (isNotBlank(value)) {
            try {
              currentAudioTrack.setTrack(Integer.parseInt(value));
            }
 catch (            NumberFormatException nfe) {
              LOGGER.debug("String_Node_Str" + value + "String_Node_Str");
            }
          }
          value=MI.Get(StreamType.Audio,i,"String_Node_Str");
          if (isNotBlank(value)) {
            try {
              currentAudioTrack.setBitsperSample(Integer.parseInt(value));
            }
 catch (            NumberFormatException nfe) {
              LOGGER.debug("String_Node_Str" + value + "String_Node_Str");
            }
          }
          addAudio(currentAudioTrack,media);
        }
      }
      if (MI.Count_Get(StreamType.Image) > 0) {
        getFormat(StreamType.Image,media,currentAudioTrack,MI.Get(StreamType.Image,0,"String_Node_Str").toLowerCase(),file);
        media.setWidth(getPixelValue(MI.Get(StreamType.Image,0,"String_Node_Str")));
        media.setHeight(getPixelValue(MI.Get(StreamType.Image,0,"String_Node_Str")));
      }
      int subTracks=MI.Count_Get(StreamType.Text);
      if (subTracks > 0) {
        for (int i=0; i < subTracks; i++) {
          currentSubTrack=new DLNAMediaSubtitle();
          currentSubTrack.setType(SubtitleType.valueOfLibMediaInfoCodec(MI.Get(StreamType.Text,i,"String_Node_Str")));
          currentSubTrack.setType(SubtitleType.valueOfLibMediaInfoCodec(MI.Get(StreamType.Text,i,"String_Node_Str")));
          currentSubTrack.setLang(getLang(MI.Get(StreamType.Text,i,"String_Node_Str")));
          currentSubTrack.setFlavor(getFlavor(MI.Get(StreamType.Text,i,"String_Node_Str")));
          value=MI.Get(StreamType.Text,i,"String_Node_Str");
          if (isNotBlank(value)) {
            if (value.contains("String_Node_Str") && !FormatConfiguration.OGG.equals(media.getContainer())) {
              currentSubTrack.setId(getSpecificID(value));
            }
 else {
              currentSubTrack.setId(media.getSubtitleTracksList().size());
            }
          }
          addSub(currentSubTrack,media);
        }
      }
      if (FormatConfiguration.MP4.equals(media.getContainer()) && isBlank(media.getCodecV()) && media.getAudioTracksList() != null && media.getAudioTracksList().size() == 1 && FormatConfiguration.AAC.equals(media.getAudioTracksList().get(0).getCodecA())) {
        media.setContainer(FormatConfiguration.AAC);
      }
      if (!media.is3d()) {
        String upperCaseFileName=file.getName().toUpperCase();
        if (upperCaseFileName.startsWith("String_Node_Str")) {
          LOGGER.debug("String_Node_Str" + file.getName());
          media.setStereoscopy(file.getName().substring(2,7));
        }
 else         if (upperCaseFileName.startsWith("String_Node_Str")) {
          LOGGER.debug("String_Node_Str" + file.getName());
          media.setStereoscopy(file.getName().substring(2,6));
        }
 else         if (upperCaseFileName.startsWith("String_Node_Str")) {
          LOGGER.debug("String_Node_Str" + file.getName());
          media.setStereoscopy(file.getName().substring(2,6));
        }
 else         if (upperCaseFileName.matches("String_Node_Str")) {
          LOGGER.debug("String_Node_Str" + file.getName());
          media.setStereoscopy("String_Node_Str");
        }
 else         if (upperCaseFileName.matches("String_Node_Str")) {
          LOGGER.debug("String_Node_Str" + file.getName());
          media.setStereoscopy("String_Node_Str");
        }
 else         if (upperCaseFileName.matches("String_Node_Str")) {
          if (media.getWidth() > 1920) {
            LOGGER.debug("String_Node_Str" + file.getName());
            media.setStereoscopy("String_Node_Str");
          }
 else {
            LOGGER.debug("String_Node_Str" + file.getName());
            media.setStereoscopy("String_Node_Str");
          }
        }
 else         if (upperCaseFileName.matches("String_Node_Str")) {
          if (media.getHeight() > 1080) {
            LOGGER.debug("String_Node_Str" + file.getName());
            media.setStereoscopy("String_Node_Str");
          }
 else {
            LOGGER.debug("String_Node_Str" + file.getName());
            media.setStereoscopy("String_Node_Str");
          }
        }
      }
      media.finalize(type,inputFile);
    }
 catch (    Exception e) {
      LOGGER.error("String_Node_Str",e);
    }
 finally {
      MI.Close();
      if (media.getContainer() == null) {
        media.setContainer(DLNAMediaLang.UND);
      }
      if (media.getCodecV() == null) {
        media.setCodecV(DLNAMediaLang.UND);
      }
      media.setMediaparsed(true);
    }
  }
}

Fixed version (ground truth):
public synchronized static void parse(DLNAMediaInfo media,InputFile inputFile,int type){
  File file=inputFile.getFile();
  if (!media.isMediaparsed() && file != null && MI.isValid() && MI.Open(file.getAbsolutePath()) > 0) {
    try {
      DLNAMediaAudio currentAudioTrack=new DLNAMediaAudio();
      DLNAMediaSubtitle currentSubTrack=new DLNAMediaSubtitle();
      media.setSize(file.length());
      String value;
      getFormat(StreamType.General,media,currentAudioTrack,MI.Get(StreamType.General,0,"String_Node_Str").toLowerCase(),file);
      media.setDuration(getDuration(MI.Get(StreamType.General,0,"String_Node_Str")));
      media.setBitrate(getBitrate(MI.Get(StreamType.General,0,"String_Node_Str")));
      value=MI.Get(StreamType.General,0,"String_Node_Str");
      if (isNotBlank(value)) {
        media.setThumb(getCover(value));
      }
      int videos=MI.Count_Get(StreamType.Video);
      if (videos > 0) {
        for (int i=0; i < videos; i++) {
          if (MI.Get(StreamType.Video,i,"String_Node_Str").startsWith("String_Node_Str")) {
            currentSubTrack=new DLNAMediaSubtitle();
            currentSubTrack.setType(SubtitleType.valueOfLibMediaInfoCodec(MI.Get(StreamType.Video,i,"String_Node_Str")));
            currentSubTrack.setType(SubtitleType.valueOfLibMediaInfoCodec(MI.Get(StreamType.Video,i,"String_Node_Str")));
            currentSubTrack.setId(media.getSubtitleTracksList().size());
            addSub(currentSubTrack,media);
          }
 else {
            getFormat(StreamType.Video,media,currentAudioTrack,MI.Get(StreamType.Video,i,"String_Node_Str").toLowerCase(),file);
            getFormat(StreamType.Video,media,currentAudioTrack,MI.Get(StreamType.Video,i,"String_Node_Str").toLowerCase(),file);
            media.setWidth(getPixelValue(MI.Get(StreamType.Video,i,"String_Node_Str")));
            media.setHeight(getPixelValue(MI.Get(StreamType.Video,i,"String_Node_Str")));
            media.setFrameRate(getFPSValue(MI.Get(StreamType.Video,i,"String_Node_Str")));
            media.setStereoscopy(MI.Get(StreamType.Video,i,"String_Node_Str"));
            media.setAspectRatioContainer(MI.Get(StreamType.Video,i,"String_Node_Str"));
            media.setAspectRatioVideoTrack(MI.Get(StreamType.Video,i,"String_Node_Str"));
            media.setFrameRate(getFPSValue(MI.Get(StreamType.Video,i,"String_Node_Str")));
            media.setFrameRateMode(getFrameRateModeValue(MI.Get(StreamType.Video,i,"String_Node_Str")));
            media.setReferenceFrameCount(getReferenceFrameCount(MI.Get(StreamType.Video,i,"String_Node_Str")));
            value=MI.Get(StreamType.Video,i,"String_Node_Str",InfoType.Text,InfoType.Name);
            if (isNotBlank(value)) {
              media.putExtra(FormatConfiguration.MI_QPEL,value);
            }
            value=MI.Get(StreamType.Video,i,"String_Node_Str",InfoType.Text,InfoType.Name);
            if (isNotBlank(value)) {
              media.putExtra(FormatConfiguration.MI_GMC,value);
            }
            value=MI.Get(StreamType.Video,i,"String_Node_Str",InfoType.Text,InfoType.Name);
            if (isNotBlank(value)) {
              media.putExtra(FormatConfiguration.MI_GOP,value);
            }
            media.setMuxingMode(MI.Get(StreamType.Video,i,"String_Node_Str",InfoType.Text,InfoType.Name));
            if (!media.isEncrypted()) {
              media.setEncrypted("String_Node_Str".equals(MI.Get(StreamType.Video,i,"String_Node_Str")));
            }
          }
        }
      }
      int audioTracks=MI.Count_Get(StreamType.Audio);
      if (audioTracks > 0) {
        for (int i=0; i < audioTracks; i++) {
          currentAudioTrack=new DLNAMediaAudio();
          getFormat(StreamType.Audio,media,currentAudioTrack,MI.Get(StreamType.Audio,i,"String_Node_Str").toLowerCase(),file);
          getFormat(StreamType.Audio,media,currentAudioTrack,MI.Get(StreamType.Audio,i,"String_Node_Str").toLowerCase(),file);
          getFormat(StreamType.Audio,media,currentAudioTrack,MI.Get(StreamType.Audio,i,"String_Node_Str").toLowerCase(),file);
          getFormat(StreamType.Audio,media,currentAudioTrack,MI.Get(StreamType.Audio,i,"String_Node_Str").toLowerCase(),file);
          currentAudioTrack.setLang(getLang(MI.Get(StreamType.Audio,i,"String_Node_Str")));
          currentAudioTrack.setFlavor(getFlavor(MI.Get(StreamType.Audio,i,"String_Node_Str")));
          currentAudioTrack.getAudioProperties().setNumberOfChannels(MI.Get(StreamType.Audio,i,"String_Node_Str"));
          currentAudioTrack.setSampleFrequency(getSampleFrequency(MI.Get(StreamType.Audio,i,"String_Node_Str")));
          currentAudioTrack.setBitRate(getBitrate(MI.Get(StreamType.Audio,i,"String_Node_Str")));
          currentAudioTrack.setSongname(MI.Get(StreamType.General,0,"String_Node_Str"));
          currentAudioTrack.setAlbum(MI.Get(StreamType.General,0,"String_Node_Str"));
          currentAudioTrack.setArtist(MI.Get(StreamType.General,0,"String_Node_Str"));
          currentAudioTrack.setGenre(MI.Get(StreamType.General,0,"String_Node_Str"));
          String recordedDate=MI.Get(StreamType.General,0,"String_Node_Str");
          Matcher matcher=yearPattern.matcher(recordedDate);
          if (matcher.matches()) {
            try {
              currentAudioTrack.setYear(Integer.parseInt(matcher.group(1)));
            }
 catch (            NumberFormatException nfe) {
              LOGGER.debug("String_Node_Str" + recordedDate + "String_Node_Str");
            }
          }
          value=MI.Get(StreamType.Audio,i,"String_Node_Str");
          if (isNotBlank(value)) {
            if (value.contains("String_Node_Str") && !FormatConfiguration.OGG.equals(media.getContainer())) {
              currentAudioTrack.setId(getSpecificID(value));
            }
 else {
              currentAudioTrack.setId(media.getAudioTracksList().size());
            }
          }
          value=MI.Get(StreamType.General,i,"String_Node_Str");
          if (isNotBlank(value)) {
            try {
              currentAudioTrack.setTrack(Integer.parseInt(value));
            }
 catch (            NumberFormatException nfe) {
              LOGGER.debug("String_Node_Str" + value + "String_Node_Str");
            }
          }
          value=MI.Get(StreamType.Audio,i,"String_Node_Str");
          if (isNotBlank(value)) {
            try {
              currentAudioTrack.setBitsperSample(Integer.parseInt(value));
            }
 catch (            NumberFormatException nfe) {
              LOGGER.debug("String_Node_Str" + value + "String_Node_Str");
            }
          }
          addAudio(currentAudioTrack,media);
        }
      }
      if (MI.Count_Get(StreamType.Image) > 0) {
        getFormat(StreamType.Image,media,currentAudioTrack,MI.Get(StreamType.Image,0,"String_Node_Str").toLowerCase(),file);
        media.setWidth(getPixelValue(MI.Get(StreamType.Image,0,"String_Node_Str")));
        media.setHeight(getPixelValue(MI.Get(StreamType.Image,0,"String_Node_Str")));
      }
      int subTracks=MI.Count_Get(StreamType.Text);
      if (subTracks > 0) {
        for (int i=0; i < subTracks; i++) {
          currentSubTrack=new DLNAMediaSubtitle();
          currentSubTrack.setType(SubtitleType.valueOfLibMediaInfoCodec(MI.Get(StreamType.Text,i,"String_Node_Str")));
          currentSubTrack.setType(SubtitleType.valueOfLibMediaInfoCodec(MI.Get(StreamType.Text,i,"String_Node_Str")));
          currentSubTrack.setLang(getLang(MI.Get(StreamType.Text,i,"String_Node_Str")));
          currentSubTrack.setFlavor(getFlavor(MI.Get(StreamType.Text,i,"String_Node_Str")));
          value=MI.Get(StreamType.Text,i,"String_Node_Str");
          if (isNotBlank(value)) {
            if (value.contains("String_Node_Str") && !FormatConfiguration.OGG.equals(media.getContainer())) {
              currentSubTrack.setId(getSpecificID(value));
            }
 else {
              currentSubTrack.setId(media.getSubtitleTracksList().size());
            }
          }
          addSub(currentSubTrack,media);
        }
      }
      if (FormatConfiguration.MP4.equals(media.getContainer()) && isBlank(media.getCodecV()) && media.getAudioTracksList() != null && media.getAudioTracksList().size() == 1 && FormatConfiguration.AAC.equals(media.getAudioTracksList().get(0).getCodecA())) {
        media.setContainer(FormatConfiguration.AAC);
      }
      if (!media.is3d()) {
        String upperCaseFileName=file.getName().toUpperCase();
        if (upperCaseFileName.startsWith("String_Node_Str")) {
          LOGGER.debug("String_Node_Str" + file.getName());
          media.setStereoscopy(file.getName().substring(2,7));
        }
 else         if (upperCaseFileName.startsWith("String_Node_Str")) {
          LOGGER.debug("String_Node_Str" + file.getName());
          media.setStereoscopy(file.getName().substring(2,6));
        }
 else         if (upperCaseFileName.startsWith("String_Node_Str")) {
          LOGGER.debug("String_Node_Str" + file.getName());
          media.setStereoscopy(file.getName().substring(2,6));
        }
 else         if (upperCaseFileName.matches("String_Node_Str")) {
          LOGGER.debug("String_Node_Str" + file.getName());
          media.setStereoscopy("String_Node_Str");
        }
 else         if (upperCaseFileName.matches("String_Node_Str")) {
          LOGGER.debug("String_Node_Str" + file.getName());
          media.setStereoscopy("String_Node_Str");
        }
 else         if (upperCaseFileName.matches("String_Node_Str")) {
          if (media.getWidth() > 1920) {
            LOGGER.debug("String_Node_Str" + file.getName());
            media.setStereoscopy("String_Node_Str");
          }
 else {
            LOGGER.debug("String_Node_Str" + file.getName());
            media.setStereoscopy("String_Node_Str");
          }
        }
 else         if (upperCaseFileName.matches("String_Node_Str")) {
          if (media.getHeight() > 1080) {
            LOGGER.debug("String_Node_Str" + file.getName());
            media.setStereoscopy("String_Node_Str");
          }
 else {
            LOGGER.debug("String_Node_Str" + file.getName());
            media.setStereoscopy("String_Node_Str");
          }
        }
      }
      media.finalize(type,inputFile);
    }
 catch (    Exception e) {
      LOGGER.error("String_Node_Str",e);
    }
 finally {
      MI.Close();
      if (media.getContainer() == null) {
        media.setContainer(DLNAMediaLang.UND);
      }
      if (media.getCodecV() == null) {
        media.setCodecV(DLNAMediaLang.UND);
      }
      media.setMediaparsed(true);
    }
  }
}