Program: 10354
Project: 10354
Buggy source:
/** 
 * Loads library from current JAR archive The file from JAR is copied into system temporary directory and then loaded. The temporary file is deleted after exiting. Method uses String as filename because the pathname is "abstract", not system-dependent.
 * @param filename The filename inside JAR as absolute path (beginning with '/'), e.g. /package/File.ext
 * @throws IOException If temporary file creation or read/write operation fails
 * @throws IllegalArgumentException If source file (param path) does not exist
 * @throws IllegalArgumentException If the path is not absolute or if the filename is shorter than three characters (restriction of {@see File#createTempFile(java.lang.String, java.lang.String)}).
 */
public static void loadLibraryFromJar(String path) throws IOException {
  if (!path.startsWith("String_Node_Str")) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  String[] parts=path.split("String_Node_Str");
  String filename=(parts.length > 1) ? parts[parts.length - 1] : null;
  String prefix="String_Node_Str";
  String suffix=null;
  if (filename != null) {
    parts=filename.split("String_Node_Str",2);
    prefix=parts[0];
    suffix=(parts.length > 1) ? "String_Node_Str" + parts[parts.length - 1] : null;
  }
  logger.debug("String_Node_Str",prefix,suffix);
  if (filename == null || prefix.length() < 3) {
    throw new IllegalArgumentException("String_Node_Str" + filename);
  }
  File temp=File.createTempFile(prefix,suffix);
  temp.deleteOnExit();
  if (!temp.exists()) {
    throw new FileNotFoundException("String_Node_Str" + temp.getAbsolutePath() + "String_Node_Str");
  }
  byte[] buffer=new byte[1024];
  int readBytes;
  InputStream is=NativeUtils.class.getResourceAsStream(path);
  if (is == null) {
    throw new FileNotFoundException("String_Node_Str" + path + "String_Node_Str");
  }
  OutputStream os=new FileOutputStream(temp);
  try {
    while ((readBytes=is.read(buffer)) != -1) {
      os.write(buffer,0,readBytes);
    }
  }
  finally {
    os.close();
    is.close();
  }
  System.load(temp.getAbsolutePath());
}

Fixed version (ground truth):
/** 
 * Loads library from current JAR archive The file from JAR is copied into system temporary directory and then loaded. The temporary file is deleted after exiting. Method uses String as filename because the pathname is "abstract", not system-dependent.
 * @param filename The filename inside JAR as absolute path (beginning with '/'), e.g. /package/File.ext
 * @throws IOException If temporary file creation or read/write operation fails
 * @throws IllegalArgumentException If source file (param path) does not exist
 * @throws IllegalArgumentException If the path is not absolute or if the filename is shorter than three characters (restriction of {@see File#createTempFile(java.lang.String, java.lang.String)}).
 */
public static void loadLibraryFromJar(String path) throws IOException {
  if (!path.startsWith("String_Node_Str")) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  String[] parts=path.split("String_Node_Str");
  String filename=(parts.length > 1) ? parts[parts.length - 1] : null;
  String prefix="String_Node_Str";
  String suffix=null;
  if (filename != null) {
    parts=filename.split("String_Node_Str",2);
    prefix=parts[0];
    suffix=(parts.length > 1) ? "String_Node_Str" + parts[parts.length - 1] : null;
  }
  logger.debug("String_Node_Str",prefix,suffix);
  if (filename == null || prefix.length() < 3) {
    throw new IllegalArgumentException("String_Node_Str" + filename);
  }
  logger.debug("String_Node_Str",System.getProperty("String_Node_Str") + "String_Node_Str" + filename);
  File temp=new File(System.getProperty("String_Node_Str") + "String_Node_Str" + filename);
  temp.createNewFile();
  temp.deleteOnExit();
  if (!temp.exists()) {
    throw new FileNotFoundException("String_Node_Str" + temp.getAbsolutePath() + "String_Node_Str");
  }
  byte[] buffer=new byte[1024];
  int readBytes;
  InputStream is=NativeUtils.class.getResourceAsStream(path);
  if (is == null) {
    throw new FileNotFoundException("String_Node_Str" + path + "String_Node_Str");
  }
  OutputStream os=new FileOutputStream(temp);
  try {
    while ((readBytes=is.read(buffer)) != -1) {
      os.write(buffer,0,readBytes);
    }
  }
  finally {
    os.close();
    is.close();
  }
  System.load(temp.getAbsolutePath());
}