#fixed code
                              public static void main(String[] args) throws IOException, ParseException {

    if (args.length != 1) {
      System.err.println("Usage: SearchTimeUtil <indexDir>");
      System.err.println("indexDir: index directory");
      System.exit(1);
    }

    String[] topics = {"topics.web.1-50.txt", "topics.web.51-100.txt", "topics.web.101-150.txt", "topics.web.151-200.txt", "topics.web.201-250.txt", "topics.web.251-300.txt"};

    SearchWebCollection searcher = new SearchWebCollection(args[0]);

    for (String topicFile : topics) {
      Path topicsFile = Paths.get("src/resources/topics-and-qrels/", topicFile);
      SortedMap<Integer, String> queries = SearchWebCollection.readWebTrackQueries(topicsFile);
      for (int i = 1; i <= 3; i++) {
        final long start = System.nanoTime();
        String submissionFile = File.createTempFile(topicFile + "_" + i, ".tmp").getAbsolutePath();
        searcher.search(queries, submissionFile, new BM25Similarity(0.9f, 0.4f), 1000);
        final long durationMillis = TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS);
        System.out.println(topicFile + "_" + i + " search completed in " + DurationFormatUtils.formatDuration(durationMillis, "mm:ss:SSS"));
      }
    }

    searcher.close();
  }
#vulnerable code 
                              public static void main(String[] args) throws IOException, ParseException {

    if (args.length != 1) {
      System.err.println("Usage: SearchTimeUtil <indexDir>");
      System.err.println("indexDir: index directory");
      System.exit(1);
    }

    String[] topics = {"topics.web.1-50.txt", "topics.web.51-100.txt", "topics.web.101-150.txt", "topics.web.151-200.txt", "topics.web.201-250.txt", "topics.web.251-300.txt"};

    SearchClueWeb09b searcher = new SearchClueWeb09b(args[0]);

    for (String topicFile : topics) {
      Path topicsFile = Paths.get("src/resources/topics-and-qrels/", topicFile);
      SortedMap<Integer, String> queries = SearchClueWeb09b.readWebTrackQueries(topicsFile);
      for (int i = 1; i <= 3; i++) {
        final long start = System.nanoTime();
        String submissionFile = File.createTempFile(topicFile + "_" + i, ".tmp").getAbsolutePath();
        searcher.search(queries, submissionFile, new BM25Similarity(0.9f, 0.4f), 1000);
        final long durationMillis = TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS);
        System.out.println(topicFile + "_" + i + " search completed in " + DurationFormatUtils.formatDuration(durationMillis, "mm:ss:SSS"));
      }
    }

    searcher.close();
  } 
                            #location 7 
                            #vulnerability type RESOURCE_LEAK