#vulnerable code 
                              public void execute() {
    try {
      // Gets the tool command line
      List<String> commandLine = getCommandLine();
      ProcessBuilder builder = new ProcessBuilder(commandLine);
      LOG.info("Executing " + getExecutedTool() + " with command '{}'", prettyPrint(commandLine));
      // Starts the process
      Process p = builder.start();
      // And handles it's normal and error stream in separated threads.

      ByteArrayOutputStream output = new ByteArrayOutputStream(DEFAUT_BUFFER_INITIAL_SIZE);
      AsyncPipe outputStreamThread = new AsyncPipe(p.getInputStream(), output);
      outputStreamThread.start();

      ByteArrayOutputStream error = new ByteArrayOutputStream(DEFAUT_BUFFER_INITIAL_SIZE);
      AsyncPipe errorStreamThread = new AsyncPipe(p.getErrorStream(), error);
      errorStreamThread.start();

      LOG.info(getExecutedTool() + " ended with returned code '{}'.", p.waitFor());
    } catch (IOException e) {
      LOG.error("Can't execute the external tool", e);
      throw new PhpPluginExecutionException(e);
    } catch (InterruptedException e) {
      LOG.error("Async pipe interrupted: ", e);
      throw new PhpPluginExecutionException(e);
    }
  } 
                            #location 17 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                              public void execute() {
    List<String> commandLine = getCommandLine();
    LOG.info("Executing " + getExecutedTool() + " with command '{}'", prettyPrint(commandLine));

    Iterator<String> commandLineIterator = commandLine.iterator();
    Command command = Command.create(commandLineIterator.next());
    while (commandLineIterator.hasNext()) {
      command.addArgument(commandLineIterator.next());
    }
    int exitCode = CommandExecutor.create().execute(command, configuration.getTimeout() * MINUTES_TO_MILLISECONDS);
    if ( !acceptedExitCodes.contains(exitCode)) {
      throw new SonarException(getExecutedTool() + " execution failed with returned code '" + exitCode
          + "'. Please check the documentation of " + getExecutedTool() + " to know more about this failure.");
    } else {
      LOG.info(getExecutedTool() + " succeeded with returned code '{}'.", exitCode);
    }
  }