Program: 135906
Project: 135906
Buggy source:
/** 
 * From name, prepend path elements to try to find the actual file intended, and use the resulting fully-qualified name to initialize  the File.  The first fully-qualified name that refers to a file that actually exists is the File returned; but if none exists, the last one tried is returned  anyway.  Hence, the File object returned does not necessarily represent a file that actually exists in the file system.
 * @param module name, used as basis of path name to the file that should contain it
 */
private final File locate(String name){
  String prefix="String_Node_Str";
  File sourceFile=null;
  int idx=0;
  while (true) {
    if ((idx == 0) && (ToolIO.getUserDir() != null)) {
      sourceFile=new File(ToolIO.getUserDir(),name);
    }
 else {
      if (prefix.startsWith("String_Node_Str")) {
        ClassLoader cl=ClassLoader.getSystemClassLoader();
        InputStream is=cl.getResourceAsStream(STANDARD_MODULES + name);
        if (is != null) {
          try {
            sourceFile=new File(TMPDIR + File.separator + name);
            sourceFile.deleteOnExit();
            FileOutputStream fos=new FileOutputStream(sourceFile);
            byte buf[]=new byte[1024];
            int len;
            while ((len=is.read(buf)) > 0) {
              fos.write(buf,0,len);
            }
            fos.close();
            is.close();
          }
 catch (          IOException e) {
            e.printStackTrace();
          }
        }
      }
 else {
        sourceFile=new File(prefix + name);
      }
    }
    if (sourceFile.exists())     break;
    if (idx >= libraryPaths.length)     break;
    prefix=libraryPaths[idx++];
  }
  return sourceFile;
}

Fixed version (ground truth):
/** 
 * From name, prepend path elements to try to find the actual file intended, and use the resulting fully-qualified name to initialize  the File.  The first fully-qualified name that refers to a file that actually exists is the File returned; but if none exists, the last one tried is returned  anyway.  Hence, the File object returned does not necessarily represent a file that actually exists in the file system.
 * @param module name, used as basis of path name to the file that should contain it
 */
private final File locate(String name){
  String prefix="String_Node_Str";
  File sourceFile=null;
  int idx=0;
  while (true) {
    if ((idx == 0) && (ToolIO.getUserDir() != null)) {
      sourceFile=new File(ToolIO.getUserDir(),name);
    }
 else {
      if (isInJar(prefix)) {
        InputStream is=cl.getResourceAsStream(STANDARD_MODULES + name);
        if (is != null) {
          try {
            sourceFile=new File(TMPDIR + File.separator + name);
            sourceFile.deleteOnExit();
            FileOutputStream fos=new FileOutputStream(sourceFile);
            byte buf[]=new byte[1024];
            int len;
            while ((len=is.read(buf)) > 0) {
              fos.write(buf,0,len);
            }
            fos.close();
            is.close();
          }
 catch (          IOException e) {
            e.printStackTrace();
          }
        }
      }
 else {
        sourceFile=new File(prefix + name);
      }
    }
    if (sourceFile.exists())     break;
    if (idx >= libraryPaths.length)     break;
    prefix=libraryPaths[idx++];
  }
  return sourceFile;
}