#vulnerable code 
                                private static Map<Integer, String> listProcessByJps(boolean v) {
        Map<Integer, String> result = new LinkedHashMap<Integer, String>();

        String jps = "jps";
        File jpsFile = findJps();
        if (jpsFile != null) {
            jps = jpsFile.getAbsolutePath();
        }

        String[] command = null;
        if (v) {
            command = new String[] { jps, "-v" };
        } else {
            command = new String[] { jps };
        }

        List<String> lines = ExecutingCommand.runNative(command);

        int currentPid = Integer.parseInt(ProcessUtils.getPid());
        for (String line : lines) {
            int pid = new Scanner(line).nextInt();
            if (pid == currentPid) {
                continue;
            }
            result.put(pid, line);
        }

        return result;
    } 
                            #location 21 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                private static Map<Integer, String> listProcessByJps(boolean v) {
        Map<Integer, String> result = new LinkedHashMap<Integer, String>();

        String jps = "jps";
        File jpsFile = findJps();
        if (jpsFile != null) {
            jps = jpsFile.getAbsolutePath();
        }

        String[] command = null;
        if (v) {
            command = new String[] { jps, "-v" };
        } else {
            command = new String[] { jps };
        }

        List<String> lines = ExecutingCommand.runNative(command);

        int currentPid = Integer.parseInt(ProcessUtils.getPid());
        for (String line : lines) {
            String[] strings = line.trim().split("\\s+");
            if (strings.length < 1) {
                continue;
            }
            int pid = Integer.parseInt(strings[0]);
            if (pid == currentPid) {
                continue;
            }
            if (strings.length >= 2 && strings[1].equals("Jps")) { // skip jps
                continue;
            }

            result.put(pid, line);
        }

        return result;
    }