#fixed code
                             private static File checkPhantom(File archive, String export)
			throws IOException {
		File target = null;
		String phantomName = "phantomjs";
		if (export.contains(phantomName)) {
			String fileNoExtension = archive.getName().replace(".tar.bz2", "")
					.replace(".zip", "");

			File phantomjs = null;
			try {
				phantomjs = new File(archive.getParentFile().getAbsolutePath()
						+ File.separator + fileNoExtension + File.separator
						+ "bin" + File.separator).listFiles()[0];
			} catch (Exception e) {
				String extension = IS_OS_WINDOWS ? ".exe" : "";
				phantomjs = new File(archive.getParentFile().getAbsolutePath()
						+ File.separator + fileNoExtension + File.separator
						+ phantomName + extension);
			}

			target = new File(archive.getParentFile().getAbsolutePath()
					+ File.separator + phantomjs.getName());
			phantomjs.renameTo(target);

			File delete = new File(archive.getParentFile().getAbsolutePath()
					+ File.separator + fileNoExtension);
			log.trace("Folder to be deleted: {}", delete);
			FileUtils.deleteDirectory(delete);
		} else {
			File[] ls = archive.getParentFile().listFiles();
			for (File f : ls) {
				if (f.canExecute()) {
					target = f;
					break;
				}
			}
		}
		return target;
	}
#vulnerable code 
                             private static File checkPhantom(File archive, String export)
			throws IOException {
		File target;
		String phantomName = "phantomjs";
		if (export.contains(phantomName)) {
			String fileNoExtension = archive.getName().replace(".tar.bz2", "")
					.replace(".zip", "");

			File phantomjs = null;
			try {
				phantomjs = new File(archive.getParentFile().getAbsolutePath()
						+ File.separator + fileNoExtension + File.separator
						+ "bin" + File.separator).listFiles()[0];
			} catch (Exception e) {
				String extension = IS_OS_WINDOWS ? ".exe" : "";
				phantomjs = new File(archive.getParentFile().getAbsolutePath()
						+ File.separator + fileNoExtension + File.separator
						+ phantomName + extension);
			}

			target = new File(archive.getParentFile().getAbsolutePath()
					+ File.separator + phantomjs.getName());
			phantomjs.renameTo(target);

			File delete = new File(archive.getParentFile().getAbsolutePath()
					+ File.separator + fileNoExtension);
			log.trace("Folder to be deleted: {}", delete);
			FileUtils.deleteDirectory(delete);
		} else {
			target = archive.getParentFile().listFiles()[0];
		}

		return target;
	} 
                            #location 30 
                            #vulnerability type NULL_DEREFERENCE