#vulnerable code 
                              public static void main(String[] args) throws Exception {
    Args searchArgs = new Args();

    // Parse args
    CmdLineParser parser = new CmdLineParser(searchArgs,
            ParserProperties.defaults().withUsageWidth(90));

    try {
      parser.parseArgument(args);
    } catch (CmdLineException e) {
      System.err.println(e.getMessage());
      parser.printUsage(System.err);
      System.err.println("Example command: "+ LookupTopic.class.getSimpleName() +
              parser.printExample(OptionHandlerFilter.REQUIRED));
      return;
    }

    new LookupTopic(searchArgs.index).search(searchArgs.query);
  } 
                            #location 18 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                              public static void main(String[] args) throws Exception {
    Args searchArgs = new Args();
    CmdLineParser parser = new CmdLineParser(searchArgs, ParserProperties.defaults().withUsageWidth(90));

    try {
      parser.parseArgument(args);
    } catch (CmdLineException e) {
      System.err.println(e.getMessage());
      parser.printUsage(System.err);
      System.err.println("Example: "+ LookupNode.class.getSimpleName() +
              parser.printExample(OptionHandlerFilter.REQUIRED));
      return;
    }

    LOG.info(String.format("Index: %s", searchArgs.index));
    LOG.info(String.format("Query: %s", searchArgs.query));
    LOG.info(String.format("Hits: %s", searchArgs.numHits));

    LookupTopic lookup = new LookupTopic(searchArgs.index);
    lookup.search(searchArgs.query, searchArgs.numHits);
    lookup.close();
  }