#vulnerable code 
                                @Test
    public void benchmark() throws InterruptedException {
        System.out.println("Maze | Hipster-Dijkstra (ms) | JUNG-Dijkstra (ms)");
        System.out.println("-------------------------------------------------");
        final int times = 5;
        for (int i = 10; i < 300; i += 10) {
            Maze2D maze = Maze2D.random(i, 0.9);
            // Repeat 5 times
            //Double mean1 = 0d, mean2 = 0d;
            double min2 = Double.MAX_VALUE, min1 = Double.MAX_VALUE;
            DirectedGraph<Point, JungEdge<Point>> graph = JungDirectedGraphFromMazeCreator.create(maze);
            for (int j = 0; j < times; j++) {
                //AStar<Point> it = AStarIteratorFromMazeCreator.create(maze, false);
                AStar<Point> it = AlgorithmIteratorFromMazeCreator.astar(maze, false);
                Stopwatch w1 = new Stopwatch().start();
                MazeSearch.Result resultJung = MazeSearch.executeJungSearch(graph, maze);
                //In case there is no possible result in the random maze
                if(resultJung.equals(MazeSearch.Result.NO_RESULT)){
                    maze = Maze2D.random(i, 0.9);
                    graph = JungDirectedGraphFromMazeCreator.create(maze);
                    j--;
                    continue;
                }
                long result1 = w1.stop().elapsed(TimeUnit.MILLISECONDS);
                if (result1 < min1) {
                    min1 = result1;
                }
                Stopwatch w2 = new Stopwatch().start();
                MazeSearch.Result resultIterator = MazeSearch.executeIteratorSearch(it, maze);
                long result2 = w2.stop().elapsed(TimeUnit.MILLISECONDS);
                if (result2 < min2) {
                    min2 = result2;
                }
                assertEquals(resultIterator.getCost(), resultJung.getCost(), 0.001);
            }
            System.out.println(String.format("%d \t\t %.5g \t\t %.5g", i, min2, min1));
        }
    } 
                            #location 34 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                @Test
    public void benchmark() throws InterruptedException {
        Benchmark bench = new Benchmark();
        
        // Hipster-Dijkstra
        bench.add("Hipster-Dijkstra", new Algorithm() {	
			AStar<Point> it; Maze2D maze;
        	public void initialize(Maze2D maze) {
				it= AlgorithmIteratorFromMazeCreator.astar(maze, false);
				this.maze = maze;
			}
			public Result evaluate() {
				return MazeSearch.executeIteratorSearch(it, maze);
			}
		});
        
        // JUNG-Dijkstra
        bench.add("JUNG-Dijkstra", new Algorithm() {
			Maze2D maze;DirectedGraph<Point, JungEdge<Point>> graph;
			public void initialize(Maze2D maze) {
				this.maze = maze;
				this.graph = JungDirectedGraphFromMazeCreator.create(maze);
			}
			public Result evaluate() {
				return MazeSearch.executeJungSearch(graph, maze);
			}
		});

        int index = 0;
        for(String algName : bench.algorithms.keySet()){
        	System.out.println((++index) + " = " + algName);
        }
        
        for (int i = 10; i < 300; i += 10) {
        	Maze2D maze = Maze2D.empty(i);
            // Test over an empty maze
            Map<String, Benchmark.Score> results = bench.run(maze);
            // Check results and print scores. We take JUNG as baseline
            Benchmark.Score jungScore = results.get("JUNG-Dijkstra");
            String scores = "";
            for(String algName : bench.algorithms.keySet()){
            	Benchmark.Score score = results.get(algName);
            	assertEquals(jungScore.result.getCost(),score.result.getCost(), 0.0001);
            	scores += score.time + " ms\t";
            }
            System.out.println(scores);
        }
    }