nus-yam/ex-repair huggingface dataset:
Program: 47066
Project: 47066
Buggy source:
/** 
 * Initialize the list of codec formats that are recognized by ffmpeg by parsing the "ffmpeg_formats.txt" resource. 
 */
private static void initCodecs(){
  InputStream is=CodecUtil.class.getClassLoader().getResourceAsStream("String_Node_Str");
  BufferedReader br=new BufferedReader(new InputStreamReader(is));
  String line=null;
  try {
    while ((line=br.readLine()) != null) {
      if (line.contains("String_Node_Str")) {
        codecs.add(line.substring(0,line.indexOf(' ')));
      }
 else {
        codecs.add(line);
      }
    }
    br.close();
    codecs.add("String_Node_Str");
  }
 catch (  IOException e) {
    LOGGER.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Initialize the list of codec formats that are recognized by ffmpeg by parsing the "ffmpeg_formats.txt" resource.
 */
private static void initCodecs(){
  InputStream is=CodecUtil.class.getClassLoader().getResourceAsStream("String_Node_Str");
  BufferedReader br=new BufferedReader(new InputStreamReader(is));
  String line=null;
  try {
    while ((line=br.readLine()) != null) {
      if (line.contains("String_Node_Str")) {
        codecs.add(line.substring(0,line.indexOf(' ')));
      }
 else {
        codecs.add(line);
      }
    }
    br.close();
    codecs.add("String_Node_Str");
  }
 catch (  IOException e) {
    LOGGER.error("String_Node_Str",e);
  }
}
Program: 47067
Project: 47067
Buggy source:
public static String getDefaultFontPath(){
  String font=null;
  if (Platform.isWindows()) {
    String winDir=PMS.get().getRegistry().getWindowsDirectory();
    if (winDir != null) {
      File winDirFile=new File(winDir);
      if (winDirFile.exists()) {
        File fontsDir=new File(winDirFile,"String_Node_Str");
        if (fontsDir.exists()) {
          File arialDir=new File(fontsDir,"String_Node_Str");
          if (arialDir.exists()) {
            font=arialDir.getAbsolutePath();
          }
 else {
            arialDir=new File(fontsDir,"String_Node_Str");
            if (arialDir.exists()) {
              font=arialDir.getAbsolutePath();
            }
          }
        }
      }
    }
    if (font == null) {
      font=getFont("String_Node_Str","String_Node_Str");
    }
    if (font == null) {
      font=getFont("String_Node_Str","String_Node_Str");
    }
    if (font == null) {
      font=getFont("String_Node_Str","String_Node_Str");
    }
    if (font == null) {
      font=getFont("String_Node_Str","String_Node_Str");
    }
    return font;
  }
 else   if (Platform.isLinux()) {
    font=getFont("String_Node_Str","String_Node_Str");
    if (font == null) {
      font=getFont("String_Node_Str","String_Node_Str");
    }
    if (font == null) {
      font=getFont("String_Node_Str","String_Node_Str");
    }
    return font;
  }
 else   if (Platform.isMac()) {
    font=getFont("String_Node_Str","String_Node_Str");
    return font;
  }
  return null;
}

Fixed version (ground truth):
@SuppressFBWarnings("String_Node_Str") public static String getDefaultFontPath(){
  String font=null;
  if (Platform.isWindows()) {
    String winDir=PMS.get().getRegistry().getWindowsDirectory();
    if (winDir != null) {
      File winDirFile=new File(winDir);
      if (winDirFile.exists()) {
        File fontsDir=new File(winDirFile,"String_Node_Str");
        if (fontsDir.exists()) {
          File arialDir=new File(fontsDir,"String_Node_Str");
          if (arialDir.exists()) {
            font=arialDir.getAbsolutePath();
          }
 else {
            arialDir=new File(fontsDir,"String_Node_Str");
            if (arialDir.exists()) {
              font=arialDir.getAbsolutePath();
            }
          }
        }
      }
    }
    if (font == null) {
      font=getFont("String_Node_Str","String_Node_Str");
    }
    if (font == null) {
      font=getFont("String_Node_Str","String_Node_Str");
    }
    if (font == null) {
      font=getFont("String_Node_Str","String_Node_Str");
    }
    if (font == null) {
      font=getFont("String_Node_Str","String_Node_Str");
    }
    return font;
  }
 else   if (Platform.isLinux()) {
    font=getFont("String_Node_Str","String_Node_Str");
    if (font == null) {
      font=getFont("String_Node_Str","String_Node_Str");
    }
    if (font == null) {
      font=getFont("String_Node_Str","String_Node_Str");
    }
    return font;
  }
 else   if (Platform.isMac()) {
    font=getFont("String_Node_Str","String_Node_Str");
    return font;
  }
  return null;
}
Program: 47070
Project: 47070
Buggy source:
/** 
 * Convenience method to find the first child   {@link Element} of the givenname.
 * @param element the {@link Element} to search
 * @param name the name of the child {@link Element}
 * @return The found {@link Element} or null if not found
 */
protected Element getChildElement(Element element,String name){
  NodeList list=element.getElementsByTagName(name);
  for (int i=0; i < list.getLength(); i++) {
    Node node=list.item(i);
    if (node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equals(name) && node instanceof Element) {
      return (Element)node;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Convenience method to find the first child   {@link Element} of the givenname.
 * @param element the {@link Element} to search
 * @param name the name of the child {@link Element}
 * @return The found {@link Element} or null if not found
 */
protected Element getChildElement(Element element,String name){
  NodeList list=element.getElementsByTagName(name);
  int listLength=list.getLength();
  for (int i=0; i < listLength; i++) {
    Node node=list.item(i);
    if (node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equals(name) && node instanceof Element) {
      return (Element)node;
    }
  }
  return null;
}
Program: 47071
Project: 47071
Buggy source:
/** 
 * Tries to determine if FreeDesktop.org Trash specification is applicable for the system root. Support can vary between partitions on the same computer. Please note that this check will look for or try to create the necessary folder structure, so this can be an expensive operation. The check could be used to evaluate a systems general ability, but a better strategy is to attempt   {@link #moveToTrash(File)} and handlethe  {@link Exception} if it fails.
 * @param path the path for which to evaluate trash bin support
 * @return The evaluation result
 */
public static boolean hasTrash(){
  return hasTrash(Paths.get("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Tries to determine if FreeDesktop.org Trash specification is applicable for the system root. Support can vary between partitions on the same computer. Please note that this check will look for or try to create the necessary folder structure, so this can be an expensive operation. The check could be used to evaluate a systems general ability, but a better strategy is to attempt   {@link #moveToTrash(File)} and handlethe  {@link Exception} if it fails.
 * @param path the path for which to evaluate trash bin support
 * @return The evaluation result
 */
@SuppressFBWarnings("String_Node_Str") public static boolean hasTrash(){
  return hasTrash(Paths.get("String_Node_Str"));
}
Program: 47072
Project: 47072
Buggy source:
/** 
 * Escapes   {@link org.apache.lucene} special characters with backslash
 * @param s the {@link String} to evaluate
 * @return The converted String
 */
public static String luceneEscape(final String s){
  StringBuilder sb=new StringBuilder();
  for (int i=0; i < s.length(); i++) {
    char ch=s.charAt(i);
switch (ch) {
case '+':
case '-':
case '&':
case '|':
case '!':
case '(':
case ')':
case '{':
case '}':
case '[':
case ']':
case '^':
case '\"':
case '~':
case '*':
case '?':
case ':':
case '\\':
case '/':
      sb.append("String_Node_Str");
default :
    sb.append(ch);
}
}
return sb.toString();
}

Fixed version (ground truth):
/** 
 * Escapes   {@link org.apache.lucene} special characters with backslash
 * @param s the {@link String} to evaluate
 * @return The converted String
 */
@SuppressFBWarnings("String_Node_Str") public static String luceneEscape(final String s){
  StringBuilder sb=new StringBuilder();
  for (int i=0; i < s.length(); i++) {
    char ch=s.charAt(i);
switch (ch) {
case '+':
case '-':
case '&':
case '|':
case '!':
case '(':
case ')':
case '{':
case '}':
case '[':
case ']':
case '^':
case '\"':
case '~':
case '*':
case '?':
case ':':
case '\\':
case '/':
      sb.append("String_Node_Str");
default :
    sb.append(ch);
}
}
return sb.toString();
}
Program: 47073
Project: 47073
Buggy source:
/** 
 * @param thumb the thumb to set
 * @since 1.50.0
 */
public void setThumb(byte[] thumb){
  if (thumb == null) {
    this.thumb=null;
  }
 else {
    this.thumb=new byte[thumb.length];
    System.arraycopy(thumb,0,this.thumb,0,thumb.length);
  }
}

Fixed version (ground truth):
/** 
 * @param thumb the thumb to set
 * @since 1.50.0
 */
public void setThumb(byte[] thumb){
  if (thumb == null) {
    this.thumb=null;
  }
 else {
    this.thumb=new byte[thumb.length];
    System.arraycopy(thumb,0,this.thumb,0,thumb.length);
    thumbready=true;
  }
}
Program: 47074
Project: 47074
Buggy source:
public void generateThumbnail(InputFile input,Format ext,int type,Double seekPosition,boolean resume,RendererConfiguration renderer){
  DLNAMediaInfo forThumbnail=new DLNAMediaInfo();
  forThumbnail.setMediaparsed(mediaparsed);
  forThumbnail.durationSec=getDurationInSeconds();
  if (seekPosition <= forThumbnail.durationSec) {
    forThumbnail.durationSec=seekPosition;
  }
 else {
    forThumbnail.durationSec/=2;
  }
  forThumbnail.parse(input,ext,type,true,resume,renderer);
  thumb=forThumbnail.thumb;
}

Fixed version (ground truth):
public void generateThumbnail(InputFile input,Format ext,int type,Double seekPosition,boolean resume,RendererConfiguration renderer){
  DLNAMediaInfo forThumbnail=new DLNAMediaInfo();
  forThumbnail.setMediaparsed(mediaparsed);
  forThumbnail.durationSec=getDurationInSeconds();
  if (seekPosition <= forThumbnail.durationSec) {
    forThumbnail.durationSec=seekPosition;
  }
 else {
    forThumbnail.durationSec/=2;
  }
  forThumbnail.parse(input,ext,type,true,resume,renderer);
  thumb=forThumbnail.thumb;
  thumbready=true;
}
Program: 47076
Project: 47076
Buggy source:
/** 
 * Transforms a String to UTF-8.
 * @param s
 * @return Transformed string s in UTF-8 encoding.
 */
private static String encode(String s){
  try {
    return URLEncoder.encode(s,"String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    LOGGER.debug("String_Node_Str",e);
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Transforms a String to URL encoded UTF-8.
 * @param s
 * @return Transformed string s in UTF-8 encoding.
 */
private static String encode(String s){
  try {
    return URLEncoder.encode(s,"String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    LOGGER.debug("String_Node_Str",s,e.getMessage());
    LOGGER.trace("String_Node_Str",e);
  }
  return "String_Node_Str";
}
Program: 47080
Project: 47080
Buggy source:
@Override public boolean isValid(){
  File file=this.getFile();
  if (!file.isDirectory()) {
    resolveFormat();
  }
  if (getType() == Format.SUBTITLE) {
    return false;
  }
  if (getType() == Format.VIDEO && file.exists() && configuration.isAutoloadExternalSubtitles() && file.getName().length() > 4) {
    setHasExternalSubtitles(FileUtil.isSubtitlesExists(file,null));
  }
  boolean valid=file.exists() && (getFormat() != null || file.isDirectory());
  if (valid && getParent().getDefaultRenderer() != null && getParent().getDefaultRenderer().isUseMediaInfo()) {
    run();
    if (getMedia() != null && getMedia().getThumb() == null && getType() != Format.AUDIO) {
      getMedia().setThumbready(false);
    }
    if (getType() != Format.UNKNOWN && getMedia() != null && (getMedia().isEncrypted() || getMedia().getContainer() == null || getMedia().getContainer().equals(DLNAMediaLang.UND))) {
      valid=false;
      if (getMedia().isEncrypted()) {
        LOGGER.info("String_Node_Str",file.getAbsolutePath());
      }
 else {
        LOGGER.info("String_Node_Str",file.getAbsolutePath());
      }
    }
    if (getParent().getDefaultRenderer().isMediaInfoThumbnailGeneration()) {
      checkThumbnail();
    }
  }
  return valid;
}

Fixed version (ground truth):
@Override public boolean isValid(){
  File file=this.getFile();
  if (!file.isDirectory()) {
    resolveFormat();
  }
  if (getType() == Format.SUBTITLE) {
    return false;
  }
  if (getType() == Format.VIDEO && file.exists() && configuration.isAutoloadExternalSubtitles() && file.getName().length() > 4) {
    setHasExternalSubtitles(FileUtil.isSubtitlesExists(file,null));
  }
  boolean valid=file.exists() && (getFormat() != null || file.isDirectory());
  if (valid && getParent().getDefaultRenderer() != null && getParent().getDefaultRenderer().isUseMediaInfo()) {
    run();
    if (getType() != Format.UNKNOWN && getMedia() != null && (getMedia().isEncrypted() || getMedia().getContainer() == null || getMedia().getContainer().equals(DLNAMediaLang.UND))) {
      valid=false;
      if (getMedia().isEncrypted()) {
        LOGGER.info("String_Node_Str",file.getAbsolutePath());
      }
 else {
        LOGGER.info("String_Node_Str",file.getAbsolutePath());
      }
    }
    if (getParent().getDefaultRenderer().isMediaInfoThumbnailGeneration()) {
      checkThumbnail();
    }
  }
  return valid;
}
Program: 47082
Project: 47082
Buggy source:
@Override protected String getThumbnailURL(){
  if (getType() == Format.IMAGE && !configuration.getImageThumbnailsEnabled()) {
    return null;
  }
  StringBuilder sb=new StringBuilder();
  sb.append(PMS.get().getServer().getURL());
  sb.append('/');
  if (getMedia() != null && getMedia().getThumb() != null) {
    return super.getThumbnailURL();
  }
 else   if (getType() == Format.AUDIO) {
    if (getParent() != null && getParent() instanceof RealFile && ((RealFile)getParent()).getPotentialCover() != null) {
      return super.getThumbnailURL();
    }
    return null;
  }
  return super.getThumbnailURL();
}

Fixed version (ground truth):
@Override protected String getThumbnailURL(){
  if (getType() == Format.IMAGE && !configuration.getImageThumbnailsEnabled()) {
    return null;
  }
  return super.getThumbnailURL();
}
Program: 47087
Project: 47087
Buggy source:
/** 
 * Returns the list of supported formats.
 * @return The list of supported formats.
 * @since 1.90.0
 */
public static List<Format> getSupportedFormats(){
  return formats;
}

Fixed version (ground truth):
/** 
 * Returns the list of supported formats.
 * @return The list of supported formats.
 * @since 1.90.0
 */
public static List<Format> getSupportedFormats(){
  formatsLock.readLock().lock();
  try {
    return new ArrayList<Format>(formats);
  }
  finally {
    formatsLock.readLock().unlock();
  }
}
Program: 47088
Project: 47088
Buggy source:
/** 
 * Match a given filename to all known formats and return a fresh instance of that format. Matching is done by the file extension (e.g. ".gif") or protocol (e.g. "http://") of the filename. Will return <code>null</code> if no match can be made.
 * @param filename The filename to match.
 * @return The format.
 * @see Format#match(String)
 * @since 1.90.0
 */
public static Format getAssociatedFormat(final String filename){
  for (  Format format : formats) {
    if (format.match(filename)) {
      LOGGER.trace("String_Node_Str" + format + "String_Node_Str"+ filename+ "String_Node_Str");
      return format.duplicate();
    }
  }
  LOGGER.trace("String_Node_Str" + filename + "String_Node_Str");
  return null;
}

Fixed version (ground truth):
/** 
 * Match a given filename to all known formats and return a fresh instance of that format. Matching is done by the file extension (e.g. ".gif") or protocol (e.g. "http://") of the filename. Will return <code>null</code> if no match can be made.
 * @param filename The filename to match.
 * @return The format.
 * @see Format#match(String)
 * @since 1.90.0
 */
public static Format getAssociatedFormat(final String filename){
  formatsLock.readLock().lock();
  try {
    for (    Format format : formats) {
      if (format.match(filename)) {
        LOGGER.trace("String_Node_Str" + format + "String_Node_Str"+ filename+ "String_Node_Str");
        return format.duplicate();
      }
    }
  }
  finally {
    formatsLock.readLock().unlock();
  }
  LOGGER.trace("String_Node_Str" + filename + "String_Node_Str");
  return null;
}
Program: 47089
Project: 47089
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public Identifier getIdentifier(){
  return Identifier.ISO;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Identifier getIdentifier(){
  return Identifier.ISO;
}
Program: 47090
Project: 47090
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public Identifier getIdentifier(){
  return Identifier.MKV;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Identifier getIdentifier(){
  return Identifier.MKV;
}
Program: 47091
Project: 47091
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public String[] getSupportedExtensions(){
  return new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public String[] getSupportedExtensions(){
  return new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
}
Program: 47093
Project: 47093
Buggy source:
public void setStringList(String key,List<String> value){
  StringBuilder result=new StringBuilder();
  for (  String element : value) {
    if (!result.toString().equals("String_Node_Str")) {
      result.append("String_Node_Str");
    }
    result.append(element);
  }
  if (result.toString().equals("String_Node_Str")) {
    result.append("String_Node_Str");
  }
  configuration.setProperty(key,result);
}

Fixed version (ground truth):
public void setStringList(String key,List<String> value){
  StringBuilder result=new StringBuilder();
  for (  String element : value) {
    if (!result.toString().equals("String_Node_Str")) {
      result.append("String_Node_Str");
    }
    result.append(element);
  }
  if (result.toString().equals("String_Node_Str")) {
    result.append("String_Node_Str");
  }
  configuration.setProperty(key,result.toString());
}
Program: 47096
Project: 47096
Buggy source:
private void scan(DLNAResource resource){
  if (running) {
    for (    DLNAResource child : resource.getChildren()) {
      if (running && child.allowScan()) {
        child.setDefaultRenderer(resource.getDefaultRenderer());
        String childName=child.getName();
        if (child instanceof RealFile) {
          LOGGER.debug("String_Node_Str" + childName);
          PMS.get().getFrame().setStatusLine(Messages.getString("String_Node_Str") + "String_Node_Str" + childName);
        }
        if (child.isDiscovered()) {
          child.refreshChildren();
        }
 else {
          if (child instanceof DVDISOFile || child instanceof DVDISOTitle) {
            child.syncResolve();
          }
          child.discoverChildren();
          child.analyzeChildren(-1);
          child.setDiscovered(true);
        }
        int count=child.getChildren().size();
        if (count == 0) {
          continue;
        }
        scan(child);
        child.getChildren().clear();
      }
    }
  }
}

Fixed version (ground truth):
private void scan(DLNAResource resource){
  if (running) {
    for (    DLNAResource child : resource.getChildren()) {
      if (running && child.allowScan()) {
        child.setDefaultRenderer(resource.getDefaultRenderer());
        String childName=child.getName();
        if (child instanceof RealFile) {
          LOGGER.debug("String_Node_Str" + childName);
          frame.setStatusLine(Messages.getString("String_Node_Str") + "String_Node_Str" + childName);
        }
        if (child.isDiscovered()) {
          child.refreshChildren();
        }
 else {
          if (child instanceof DVDISOFile || child instanceof DVDISOTitle) {
            child.syncResolve();
          }
          child.discoverChildren();
          child.analyzeChildren(-1);
          child.setDiscovered(true);
        }
        int count=child.getChildren().size();
        if (count == 0) {
          continue;
        }
        scan(child);
        child.getChildren().clear();
      }
    }
  }
 else {
    frame.setScanLibraryEnabled(true);
  }
}
Program: 47099
Project: 47099
Buggy source:
@Override public String toString(){
  StringBuilder result=new StringBuilder();
  result.append("String_Node_Str");
  result.append(getId());
  result.append("String_Node_Str");
  result.append(type);
  if (isNotBlank(subtitlesTrackTitleFromMetadata)) {
    result.append("String_Node_Str");
    result.append(subtitlesTrackTitleFromMetadata);
  }
  result.append("String_Node_Str");
  result.append(getLang());
  if (externalFile != null) {
    result.append("String_Node_Str");
    result.append(externalFile.toString());
    result.append("String_Node_Str");
    result.append(subsCharacterSet);
  }
  return result.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuilder result=new StringBuilder();
  result.append("String_Node_Str");
  result.append(getId());
  result.append("String_Node_Str");
  result.append(type);
  if (isNotBlank(subtitlesTrackTitleFromMetadata)) {
    result.append("String_Node_Str");
    result.append(subtitlesTrackTitleFromMetadata);
  }
  result.append("String_Node_Str");
  result.append(getLang());
  if (externalFile != null) {
    result.append("String_Node_Str");
    result.append(externalFile.toString());
    result.append("String_Node_Str");
    result.append(subsCharacterSet);
  }
  if (convertedFile != null) {
    result.append("String_Node_Str");
    result.append(convertedFile.toString());
  }
  return result.toString();
}
Program: 47101
Project: 47101
Buggy source:
private void setFileSubsCharacterSet(){
  if (type.isPicture()) {
    subsCharacterSet=null;
  }
 else {
    try {
      CharsetMatch match=FileUtil.getFileCharsetMatch(externalFile);
      if (match != null) {
        subsCharacterSet=match.getName().toUpperCase(PMS.getLocale());
        lang=match.getLanguage();
        LOGGER.debug("String_Node_Str",match.getName(),lang,externalFile.getAbsolutePath());
      }
 else {
        subsCharacterSet=null;
        LOGGER.debug("String_Node_Str",externalFile.getAbsolutePath());
      }
    }
 catch (    IOException ex) {
      subsCharacterSet=null;
      LOGGER.warn("String_Node_Str",ex.getMessage());
    }
  }
}

Fixed version (ground truth):
private void setFileSubsCharacterSet(String forcedLang){
  if (type.isPicture()) {
    subsCharacterSet=null;
  }
 else {
    try {
      CharsetMatch match=FileUtil.getFileCharsetMatch(externalFile);
      if (match != null) {
        subsCharacterSet=match.getName().toUpperCase(PMS.getLocale());
        if (forcedLang == null) {
          lang=match.getLanguage();
        }
        LOGGER.debug("String_Node_Str",match.getName(),lang,externalFile.getAbsolutePath());
      }
 else {
        subsCharacterSet=null;
        LOGGER.debug("String_Node_Str",externalFile.getAbsolutePath());
      }
    }
 catch (    IOException ex) {
      subsCharacterSet=null;
      LOGGER.warn("String_Node_Str",ex.getMessage());
    }
  }
}
Program: 47102
Project: 47102
Buggy source:
/** 
 * @param externalFile the externalFile to set
 */
public void setExternalFile(File externalFile) throws FileNotFoundException {
  if (externalFile == null) {
    throw new FileNotFoundException("String_Node_Str");
  }
 else   if (!FileUtil.getFilePermissions(externalFile).isReadable()) {
    throw new FileNotFoundException("String_Node_Str" + externalFile.getAbsolutePath());
  }
  this.externalFile=externalFile;
  setFileSubsCharacterSet();
}

Fixed version (ground truth):
/** 
 * @param externalFile the externalFile to set
 * @param langForced 
 */
public void setExternalFile(File externalFile,String forcedLang) throws FileNotFoundException {
  if (externalFile == null) {
    throw new FileNotFoundException("String_Node_Str");
  }
 else   if (!FileUtil.getFilePermissions(externalFile).isReadable()) {
    throw new FileNotFoundException("String_Node_Str" + externalFile.getAbsolutePath());
  }
  this.externalFile=externalFile;
  setFileSubsCharacterSet(forcedLang);
}
Program: 47104
Project: 47104
Buggy source:
public void setSub(){
  try {
    getSubFile();
  }
 catch (  FileNotFoundException e) {
    LOGGER.info("String_Node_Str" + real.getDisplayName());
    return;
  }
catch (  IOException e) {
    LOGGER.info("String_Node_Str" + real.getDisplayName());
    return;
  }
  DLNAMediaSubtitle sub=new DLNAMediaSubtitle();
  try {
    sub.setExternalFile(subFile);
  }
 catch (  FileNotFoundException e) {
    LOGGER.info("String_Node_Str" + subFile.getName());
    return;
  }
  sub.setType(SubtitleType.SUBRIP);
  sub.setId(1);
  sub.setLang(lang);
  real.setMediaSubtitle(sub);
}

Fixed version (ground truth):
public void setSub(){
  try {
    getSubFile();
  }
 catch (  FileNotFoundException e) {
    LOGGER.info("String_Node_Str" + real.getDisplayName());
    return;
  }
catch (  IOException e) {
    LOGGER.info("String_Node_Str" + real.getDisplayName());
    return;
  }
  DLNAMediaSubtitle sub=new DLNAMediaSubtitle();
  try {
    sub.setExternalFile(subFile,null);
  }
 catch (  FileNotFoundException e) {
    LOGGER.info("String_Node_Str" + subFile.getName());
    return;
  }
  sub.setType(SubtitleType.SUBRIP);
  sub.setId(1);
  sub.setLang(lang);
  real.setMediaSubtitle(sub);
}
Program: 47108
Project: 47108
Buggy source:
@Test public void testSetExternalFile_textSubs() throws Exception {
  File file_cp1251=FileUtils.toFile(CLASS.getResource("String_Node_Str"));
  DLNAMediaSubtitle sub1=new DLNAMediaSubtitle();
  sub1.setType(SUBRIP);
  sub1.setExternalFile(file_cp1251);
  assertThat(sub1.getSubCharacterSet()).isEqualTo(CHARSET_WINDOWS_1251);
  DLNAMediaSubtitle sub2=new DLNAMediaSubtitle();
  sub2.setType(ASS);
  sub2.setExternalFile(file_cp1251);
  assertThat(sub2.getSubCharacterSet()).isEqualTo(CHARSET_WINDOWS_1251);
}

Fixed version (ground truth):
@Test public void testSetExternalFile_textSubs() throws Exception {
  File file_cp1251=FileUtils.toFile(CLASS.getResource("String_Node_Str"));
  DLNAMediaSubtitle sub1=new DLNAMediaSubtitle();
  sub1.setType(SUBRIP);
  sub1.setExternalFile(file_cp1251,null);
  assertThat(sub1.getSubCharacterSet()).isEqualTo(CHARSET_WINDOWS_1251);
  DLNAMediaSubtitle sub2=new DLNAMediaSubtitle();
  sub2.setType(ASS);
  sub2.setExternalFile(file_cp1251,null);
  assertThat(sub2.getSubCharacterSet()).isEqualTo(CHARSET_WINDOWS_1251);
}
Program: 47109
Project: 47109
Buggy source:
@Test public void testSetExternalFile_bitmapSubs() throws Exception {
  File file_cp1251=FileUtils.toFile(CLASS.getResource("String_Node_Str"));
  DLNAMediaSubtitle sub1=new DLNAMediaSubtitle();
  sub1.setType(VOBSUB);
  sub1.setExternalFile(file_cp1251);
  assertThat(sub1.getSubCharacterSet()).isNull();
  DLNAMediaSubtitle sub2=new DLNAMediaSubtitle();
  sub2.setType(BMP);
  sub2.setExternalFile(file_cp1251);
  assertThat(sub2.getSubCharacterSet()).isNull();
  DLNAMediaSubtitle sub3=new DLNAMediaSubtitle();
  sub3.setType(DIVX);
  sub3.setExternalFile(file_cp1251);
  assertThat(sub3.getSubCharacterSet()).isNull();
  DLNAMediaSubtitle sub4=new DLNAMediaSubtitle();
  sub4.setType(PGS);
  sub4.setExternalFile(file_cp1251);
  assertThat(sub4.getSubCharacterSet()).isNull();
}

Fixed version (ground truth):
@Test public void testSetExternalFile_bitmapSubs() throws Exception {
  File file_cp1251=FileUtils.toFile(CLASS.getResource("String_Node_Str"));
  DLNAMediaSubtitle sub1=new DLNAMediaSubtitle();
  sub1.setType(VOBSUB);
  sub1.setExternalFile(file_cp1251,null);
  assertThat(sub1.getSubCharacterSet()).isNull();
  DLNAMediaSubtitle sub2=new DLNAMediaSubtitle();
  sub2.setType(BMP);
  sub2.setExternalFile(file_cp1251,null);
  assertThat(sub2.getSubCharacterSet()).isNull();
  DLNAMediaSubtitle sub3=new DLNAMediaSubtitle();
  sub3.setType(DIVX);
  sub3.setExternalFile(file_cp1251,null);
  assertThat(sub3.getSubCharacterSet()).isNull();
  DLNAMediaSubtitle sub4=new DLNAMediaSubtitle();
  sub4.setType(PGS);
  sub4.setExternalFile(file_cp1251,null);
  assertThat(sub4.getSubCharacterSet()).isNull();
}
Program: 47110
Project: 47110
Buggy source:
@Test public void testIsEmbedded() throws Exception {
  File file_cp1251=FileUtils.toFile(CLASS.getResource("String_Node_Str"));
  DLNAMediaSubtitle sub1=new DLNAMediaSubtitle();
  sub1.setType(SUBRIP);
  sub1.setExternalFile(file_cp1251);
  assertThat(sub1.isEmbedded()).isFalse();
  assertThat(sub1.isExternal()).isTrue();
  DLNAMediaSubtitle sub2=new DLNAMediaSubtitle();
  sub2.setType(SUBRIP);
  assertThat(sub2.isEmbedded()).isTrue();
  assertThat(sub2.isExternal()).isFalse();
}

Fixed version (ground truth):
@Test public void testIsEmbedded() throws Exception {
  File file_cp1251=FileUtils.toFile(CLASS.getResource("String_Node_Str"));
  DLNAMediaSubtitle sub1=new DLNAMediaSubtitle();
  sub1.setType(SUBRIP);
  sub1.setExternalFile(file_cp1251,null);
  assertThat(sub1.isEmbedded()).isFalse();
  assertThat(sub1.isExternal()).isTrue();
  DLNAMediaSubtitle sub2=new DLNAMediaSubtitle();
  sub2.setType(SUBRIP);
  assertThat(sub2.isEmbedded()).isTrue();
  assertThat(sub2.isExternal()).isFalse();
}
Program: 47113
Project: 47113
Buggy source:
@Test(expected=FileNotFoundException.class) public void testSetExternalFile_noFile() throws Exception {
  DLNAMediaSubtitle dlnaMediaSubtitle=new DLNAMediaSubtitle();
  dlnaMediaSubtitle.setExternalFile(new File("String_Node_Str"));
}

Fixed version (ground truth):
@Test(expected=FileNotFoundException.class) public void testSetExternalFile_noFile() throws Exception {
  DLNAMediaSubtitle dlnaMediaSubtitle=new DLNAMediaSubtitle();
  dlnaMediaSubtitle.setExternalFile(new File("String_Node_Str"),null);
}
Program: 47115
Project: 47115
Buggy source:
@Test public void testGetSubCpOptionForMencoder() throws Exception {
  File file_big5=FileUtils.toFile(CLASS.getResource("String_Node_Str"));
  DLNAMediaSubtitle sub1=new DLNAMediaSubtitle();
  sub1.setExternalFile(file_big5);
  assertThat(getSubCpOptionForMencoder(sub1)).isEqualTo("String_Node_Str");
  File file_gb18030=FileUtils.toFile(CLASS.getResource("String_Node_Str"));
  DLNAMediaSubtitle sub2=new DLNAMediaSubtitle();
  sub2.setExternalFile(file_gb18030);
  assertThat(getSubCpOptionForMencoder(sub2)).isEqualTo("String_Node_Str");
  File file_cp1251=FileUtils.toFile(CLASS.getResource("String_Node_Str"));
  DLNAMediaSubtitle sub3=new DLNAMediaSubtitle();
  sub3.setExternalFile(file_cp1251);
  assertThat(getSubCpOptionForMencoder(sub3)).isEqualTo("String_Node_Str");
  File file_koi8_r=FileUtils.toFile(CLASS.getResource("String_Node_Str"));
  DLNAMediaSubtitle sub5=new DLNAMediaSubtitle();
  sub5.setExternalFile(file_koi8_r);
  assertThat(getSubCpOptionForMencoder(sub5)).isEqualTo("String_Node_Str");
  File file_cp1250=FileUtils.toFile(CLASS.getResource("String_Node_Str"));
  DLNAMediaSubtitle sub6=new DLNAMediaSubtitle();
  sub6.setExternalFile(file_cp1250);
  assertThat(getSubCpOptionForMencoder(sub6)).isEqualTo("String_Node_Str");
  File file_iso_8859_2=FileUtils.toFile(CLASS.getResource("String_Node_Str"));
  DLNAMediaSubtitle sub7=new DLNAMediaSubtitle();
  sub7.setExternalFile(file_iso_8859_2);
  assertThat(getSubCpOptionForMencoder(sub7)).isEqualTo("String_Node_Str");
}

Fixed version (ground truth):
@Test public void testGetSubCpOptionForMencoder() throws Exception {
  File file_big5=FileUtils.toFile(CLASS.getResource("String_Node_Str"));
  DLNAMediaSubtitle sub1=new DLNAMediaSubtitle();
  sub1.setExternalFile(file_big5,null);
  assertThat(getSubCpOptionForMencoder(sub1)).isEqualTo("String_Node_Str");
  File file_gb18030=FileUtils.toFile(CLASS.getResource("String_Node_Str"));
  DLNAMediaSubtitle sub2=new DLNAMediaSubtitle();
  sub2.setExternalFile(file_gb18030,null);
  assertThat(getSubCpOptionForMencoder(sub2)).isEqualTo("String_Node_Str");
  File file_cp1251=FileUtils.toFile(CLASS.getResource("String_Node_Str"));
  DLNAMediaSubtitle sub3=new DLNAMediaSubtitle();
  sub3.setExternalFile(file_cp1251,null);
  assertThat(getSubCpOptionForMencoder(sub3)).isEqualTo("String_Node_Str");
  File file_koi8_r=FileUtils.toFile(CLASS.getResource("String_Node_Str"));
  DLNAMediaSubtitle sub5=new DLNAMediaSubtitle();
  sub5.setExternalFile(file_koi8_r,null);
  assertThat(getSubCpOptionForMencoder(sub5)).isEqualTo("String_Node_Str");
  File file_cp1250=FileUtils.toFile(CLASS.getResource("String_Node_Str"));
  DLNAMediaSubtitle sub6=new DLNAMediaSubtitle();
  sub6.setExternalFile(file_cp1250,null);
  assertThat(getSubCpOptionForMencoder(sub6)).isEqualTo("String_Node_Str");
  File file_iso_8859_2=FileUtils.toFile(CLASS.getResource("String_Node_Str"));
  DLNAMediaSubtitle sub7=new DLNAMediaSubtitle();
  sub7.setExternalFile(file_iso_8859_2,null);
  assertThat(getSubCpOptionForMencoder(sub7)).isEqualTo("String_Node_Str");
}
Program: 47116
Project: 47116
Buggy source:
@Test public void testGetSubCpOptionForMencoder_withoutDetectedCharset() throws Exception {
  DLNAMediaSubtitle subtitle=new DLNAMediaSubtitle();
  File file_cp1251=FileUtils.toFile(CLASS.getResource("String_Node_Str"));
  subtitle.setType(VOBSUB);
  subtitle.setExternalFile(file_cp1251);
  assertThat(subtitle.getSubCharacterSet()).isNull();
  assertThat(getSubCpOptionForMencoder(subtitle)).isNull();
}

Fixed version (ground truth):
@Test public void testGetSubCpOptionForMencoder_withoutDetectedCharset() throws Exception {
  DLNAMediaSubtitle subtitle=new DLNAMediaSubtitle();
  File file_cp1251=FileUtils.toFile(CLASS.getResource("String_Node_Str"));
  subtitle.setType(VOBSUB);
  subtitle.setExternalFile(file_cp1251,null);
  assertThat(subtitle.getSubCharacterSet()).isNull();
  assertThat(getSubCpOptionForMencoder(subtitle)).isNull();
}
Program: 47118
Project: 47118
Buggy source:
public static BufferedImage getRendererIcon(String icon){
  BufferedImage bi=null;
  if (icon != null) {
    if (icon.matches("String_Node_Str")) {
      try {
        bi=ImageIO.read(new URL(icon));
      }
 catch (      IOException e) {
        LOGGER.debug("String_Node_Str" + e);
      }
      if (bi != null) {
        return bi;
      }
 else {
        LOGGER.debug("String_Node_Str",RendererConfiguration.UNKNOWN_ICON);
        icon=RendererConfiguration.UNKNOWN_ICON;
      }
    }
    try {
      InputStream is=null;
      File f=new File(icon);
      if (!f.isAbsolute() && f.getParent() == null) {
        f=new File("String_Node_Str",icon);
      }
      if (f.isFile()) {
        is=new FileInputStream(f);
      }
      if (is == null) {
        is=LooksFrame.class.getResourceAsStream("String_Node_Str" + icon);
      }
      if (is == null) {
        is=LooksFrame.class.getResourceAsStream("String_Node_Str" + icon);
      }
      if (is == null) {
        LOGGER.debug("String_Node_Str",icon,RendererConfiguration.UNKNOWN_ICON);
        is=LooksFrame.class.getResourceAsStream("String_Node_Str" + RendererConfiguration.UNKNOWN_ICON);
      }
      if (is != null) {
        bi=ImageIO.read(is);
      }
    }
 catch (    IOException e) {
      LOGGER.debug("String_Node_Str",e);
    }
  }
  if (bi == null) {
    LOGGER.debug("String_Node_Str" + icon);
  }
  return bi;
}

Fixed version (ground truth):
public static BufferedImage getRendererIcon(String icon){
  BufferedImage bi=null;
  if (icon != null) {
    if (icon.matches("String_Node_Str")) {
      try {
        bi=ImageIO.read(new URL(icon));
      }
 catch (      IOException e) {
        LOGGER.debug("String_Node_Str" + e);
      }
      if (bi != null) {
        return bi;
      }
 else {
        LOGGER.debug("String_Node_Str",icon,RendererConfiguration.UNKNOWN_ICON);
        icon=RendererConfiguration.UNKNOWN_ICON;
      }
    }
    try {
      InputStream is=null;
      File f=new File(icon);
      if (!f.isAbsolute() && f.getParent() == null) {
        f=new File("String_Node_Str",icon);
      }
      if (f.isFile()) {
        is=new FileInputStream(f);
      }
      if (is == null) {
        is=LooksFrame.class.getResourceAsStream("String_Node_Str" + icon);
      }
      if (is == null) {
        is=LooksFrame.class.getResourceAsStream("String_Node_Str" + icon);
      }
      if (is == null) {
        LOGGER.debug("String_Node_Str",icon,RendererConfiguration.UNKNOWN_ICON);
        is=LooksFrame.class.getResourceAsStream("String_Node_Str" + RendererConfiguration.UNKNOWN_ICON);
      }
      if (is != null) {
        bi=ImageIO.read(is);
      }
    }
 catch (    IOException e) {
      LOGGER.debug("String_Node_Str",e);
    }
  }
  if (bi == null) {
    LOGGER.debug("String_Node_Str" + icon);
  }
  return bi;
}
Program: 47119
Project: 47119
Buggy source:
public static String getFriendlyName(Device d){
  return d.getDetails().getFriendlyName();
}

Fixed version (ground truth):
public static String getFriendlyName(Device d){
  return d != null ? d.getDetails().getFriendlyName() : null;
}
Program: 47121
Project: 47121
Buggy source:
public static String extractImdb(File file){
  String ret=extract(file,IMDB_REG);
  if (!StringUtils.isEmpty(ret) && !ret.startsWith("String_Node_Str")) {
    ret="String_Node_Str" + ret;
  }
  return ret;
}

Fixed version (ground truth):
public static String extractImdb(File file){
  String ret=extract(file,IMDB_REG);
  if (!StringUtils.isEmpty(ret) && ret.startsWith("String_Node_Str") && ret.length() > 2) {
    ret=ret.substring(2);
  }
  return ret;
}
Program: 47123
Project: 47123
Buggy source:
private static synchronized void login() throws IOException {
  if ((token != null) && tokenIsYoung()) {
    return;
  }
  URL url=new URL(OPENSUBS_URL);
  String req="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str" + UA + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  Pattern re=Pattern.compile("String_Node_Str",Pattern.DOTALL);
  Matcher m=re.matcher(postPage(url.openConnection(),req));
  if (m.find()) {
    token=m.group(1);
    tokenAge=System.currentTimeMillis();
  }
}

Fixed version (ground truth):
private static boolean login() throws IOException {
  tokenLock.writeLock().lock();
  try {
    if (token != null && tokenIsYoung()) {
      return true;
    }
    URL url=new URL(OPENSUBS_URL);
    String req="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str" + UA + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    Pattern re=Pattern.compile("String_Node_Str",Pattern.DOTALL);
    Matcher m=re.matcher(postPage(url.openConnection(),req));
    if (m.find()) {
      token=m.group(1);
      tokenAge=System.currentTimeMillis();
    }
    return token != null;
  }
  finally {
    tokenLock.writeLock().unlock();
  }
}
Program: 47124
Project: 47124
Buggy source:
public static Map<String,Object> findSubs(String hash,long size,String imdb,String query,RendererConfiguration r) throws IOException {
  login();
  TreeMap<String,Object> res=new TreeMap<>();
  if (token == null) {
    return res;
  }
  String lang=UMSUtils.getLangList(r,true);
  URL url=new URL(OPENSUBS_URL);
  String hashStr="String_Node_Str";
  String imdbStr="String_Node_Str";
  String qStr="String_Node_Str";
  if (!StringUtils.isEmpty(hash)) {
    hashStr="String_Node_Str" + hash + "String_Node_Str"+ "String_Node_Str"+ size+ "String_Node_Str";
  }
 else   if (!StringUtils.isEmpty(imdb)) {
    imdbStr="String_Node_Str" + imdb + "String_Node_Str";
  }
 else   if (!StringUtils.isEmpty(query)) {
    qStr="String_Node_Str" + query + "String_Node_Str";
  }
 else {
    return res;
  }
  String req="String_Node_Str" + "String_Node_Str" + token + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ lang+ "String_Node_Str"+ hashStr+ imdbStr+ qStr+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  Pattern re=Pattern.compile("String_Node_Str",Pattern.DOTALL);
  String page=postPage(url.openConnection(),req);
  Matcher m=re.matcher(page);
  while (m.find()) {
    LOGGER.debug("String_Node_Str" + m.group(2) + "String_Node_Str"+ m.group(1)+ "String_Node_Str"+ m.group(3));
    res.put(m.group(2) + "String_Node_Str" + m.group(1),m.group(3));
    if (res.size() > PMS.getConfiguration().liveSubtitlesLimit()) {
      break;
    }
  }
  return res;
}

Fixed version (ground truth):
public static Map<String,Object> findSubs(String hash,long size,String imdb,String query,RendererConfiguration r) throws IOException {
  TreeMap<String,Object> res=new TreeMap<>();
  if (!login()) {
    return res;
  }
  String lang=UMSUtils.getLangList(r,true);
  URL url=new URL(OPENSUBS_URL);
  String hashStr="String_Node_Str";
  String imdbStr="String_Node_Str";
  String qStr="String_Node_Str";
  if (!StringUtils.isEmpty(hash)) {
    hashStr="String_Node_Str" + hash + "String_Node_Str"+ "String_Node_Str"+ size+ "String_Node_Str";
  }
 else   if (!StringUtils.isEmpty(imdb)) {
    imdbStr="String_Node_Str" + imdb + "String_Node_Str";
  }
 else   if (!StringUtils.isEmpty(query)) {
    qStr="String_Node_Str" + query + "String_Node_Str";
  }
 else {
    return res;
  }
  String req=null;
  tokenLock.readLock().lock();
  try {
    req="String_Node_Str" + "String_Node_Str" + token + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ lang+ "String_Node_Str"+ hashStr+ imdbStr+ qStr+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  }
  finally {
    tokenLock.readLock().unlock();
  }
  Pattern re=Pattern.compile("String_Node_Str",Pattern.DOTALL);
  String page=postPage(url.openConnection(),req);
  Matcher m=re.matcher(page);
  while (m.find()) {
    LOGGER.debug("String_Node_Str" + m.group(2) + "String_Node_Str"+ m.group(1)+ "String_Node_Str"+ m.group(3));
    res.put(m.group(2) + "String_Node_Str" + m.group(1),m.group(3));
    if (res.size() > PMS.getConfiguration().liveSubtitlesLimit()) {
      break;
    }
  }
  return res;
}
Program: 47125
Project: 47125
Buggy source:
public static String fetchSubs(String url,String outName) throws FileNotFoundException, IOException {
  login();
  if (token == null) {
    return "String_Node_Str";
  }
  if (StringUtils.isEmpty(outName)) {
    outName=subFile(String.valueOf(System.currentTimeMillis()));
  }
  File f=new File(outName);
  URL u=new URL(url);
  URLConnection connection=u.openConnection();
  connection.setDoInput(true);
  connection.setDoOutput(true);
  InputStream in=connection.getInputStream();
  OutputStream out;
  try (GZIPInputStream gzipInputStream=new GZIPInputStream(in)){
    out=new FileOutputStream(f);
    byte[] buf=new byte[4096];
    int len;
    while ((len=gzipInputStream.read(buf)) > 0) {
      out.write(buf,0,len);
    }
  }
   out.close();
  if (!PMS.getConfiguration().isLiveSubtitlesKeep()) {
    int tmo=PMS.getConfiguration().getLiveSubtitlesTimeout();
    if (tmo <= 0) {
      PMS.get().addTempFile(f);
    }
 else {
      PMS.get().addTempFile(f,tmo);
    }
  }
  return f.getAbsolutePath();
}

Fixed version (ground truth):
public static String fetchSubs(String url,String outName) throws FileNotFoundException, IOException {
  if (!login()) {
    return "String_Node_Str";
  }
  if (StringUtils.isEmpty(outName)) {
    outName=subFile(String.valueOf(System.currentTimeMillis()));
  }
  File f=new File(outName);
  URL u=new URL(url);
  URLConnection connection=u.openConnection();
  connection.setDoInput(true);
  connection.setDoOutput(true);
  InputStream in=connection.getInputStream();
  OutputStream out;
  try (GZIPInputStream gzipInputStream=new GZIPInputStream(in)){
    out=new FileOutputStream(f);
    byte[] buf=new byte[4096];
    int len;
    while ((len=gzipInputStream.read(buf)) > 0) {
      out.write(buf,0,len);
    }
  }
   out.close();
  if (!PMS.getConfiguration().isLiveSubtitlesKeep()) {
    int tmo=PMS.getConfiguration().getLiveSubtitlesTimeout();
    if (tmo <= 0) {
      PMS.get().addTempFile(f);
    }
 else {
      PMS.get().addTempFile(f,tmo);
    }
  }
  return f.getAbsolutePath();
}
Program: 47126
Project: 47126
Buggy source:
private static String checkMovieHash(String hash) throws IOException {
  login();
  if (token == null) {
    return "String_Node_Str";
  }
  URL url=new URL(OPENSUBS_URL);
  String req="String_Node_Str" + "String_Node_Str" + token + "String_Node_Str"+ "String_Node_Str"+ hash+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  LOGGER.debug("String_Node_Str" + req);
  return postPage(url.openConnection(),req);
}

Fixed version (ground truth):
private static String checkMovieHash(String hash) throws IOException {
  if (!login()) {
    return "String_Node_Str";
  }
  URL url=new URL(OPENSUBS_URL);
  tokenLock.readLock().lock();
  String req=null;
  try {
    req="String_Node_Str" + "String_Node_Str" + token + "String_Node_Str"+ "String_Node_Str"+ hash+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  }
  finally {
    tokenLock.readLock().unlock();
  }
  LOGGER.debug("String_Node_Str" + req);
  return postPage(url.openConnection(),req);
}
Program: 47127
Project: 47127
Buggy source:
public static String getFriendlyName(Device d){
  return d.getDetails().getFriendlyName();
}

Fixed version (ground truth):
public static String getFriendlyName(Device d){
  return d != null ? d.getDetails().getFriendlyName() : null;
}
Program: 47129
Project: 47129
Buggy source:
public static String extractImdb(File file){
  String ret=extract(file,IMDB_REG);
  if (!StringUtils.isEmpty(ret) && !ret.startsWith("String_Node_Str")) {
    ret="String_Node_Str" + ret;
  }
  return ret;
}

Fixed version (ground truth):
public static String extractImdb(File file){
  String ret=extract(file,IMDB_REG);
  if (!StringUtils.isEmpty(ret) && ret.startsWith("String_Node_Str") && ret.length() > 2) {
    ret=ret.substring(2);
  }
  return ret;
}
Program: 47131
Project: 47131
Buggy source:
private static synchronized void login() throws IOException {
  if ((token != null) && tokenIsYoung()) {
    return;
  }
  URL url=new URL(OPENSUBS_URL);
  String req="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str" + UA + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  Pattern re=Pattern.compile("String_Node_Str",Pattern.DOTALL);
  Matcher m=re.matcher(postPage(url.openConnection(),req));
  if (m.find()) {
    token=m.group(1);
    tokenAge=System.currentTimeMillis();
  }
}

Fixed version (ground truth):
private static boolean login() throws IOException {
  tokenLock.writeLock().lock();
  try {
    if (token != null && tokenIsYoung()) {
      return true;
    }
    URL url=new URL(OPENSUBS_URL);
    String req="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str" + UA + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    Pattern re=Pattern.compile("String_Node_Str",Pattern.DOTALL);
    Matcher m=re.matcher(postPage(url.openConnection(),req));
    if (m.find()) {
      token=m.group(1);
      tokenAge=System.currentTimeMillis();
    }
    return token != null;
  }
  finally {
    tokenLock.writeLock().unlock();
  }
}