#vulnerable code 
                                public SingleResult process(PageRankRequest request) {
        String nodeType = request.getNodeType();
        String relType = request.getRelationshipType();
        String relWeight = request.getRelationshipWeight();
        int iter = request.getIteration().intValue();
        double damp = request.getDamp();
        double threshold = request.getThreshold();
        boolean respectDirections = request.getRespectDirections();

        PageRank pagerank = new PageRank(getDatabase());
        pagerank.respectDirections(respectDirections);
        Map<Long, Map<Long, CoOccurrenceItem>> coOccurrences = pagerank.processGraph(nodeType, relType, relWeight);
        if (coOccurrences.isEmpty()) {
            return SingleResult.fail();
        }
        Map<Long, Double> pageranks = pagerank.run(coOccurrences, iter, damp, threshold);
        if (pageranks.isEmpty()) {
            return SingleResult.fail();
        }
        pageranks.entrySet().stream().forEach(en -> LOG.info("PR(" + en.getKey() + ") = " + en.getValue()));
        LOG.info("Sum of PageRanks: " + pageranks.values().stream().mapToDouble(Number::doubleValue).sum());
        pagerank.storeOnGraph(pageranks, nodeType);

        return SingleResult.success();
    } 
                            #location 12 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                public SingleResult process(PageRankRequest request) {
        String query = request.getQuery();
        int iter = request.getIteration().intValue();
        double damp = request.getDamp();
        double threshold = request.getThreshold();
        boolean respectDirections = request.getRespectDirections();

        PageRank pagerank = new PageRank(getDatabase());
        Map<Long, Map<Long, CoOccurrenceItem>> coOccurrences = pagerank.createGraph(query, respectDirections);
        if (coOccurrences.isEmpty()) {
            return SingleResult.fail();
        }
        Map<Long, Double> pageranks = pagerank.run(coOccurrences, iter, damp, threshold);
        if (pageranks.isEmpty()) {
            return SingleResult.fail();
        }
        pageranks.entrySet().stream().forEach(en -> LOG.info("PR(" + en.getKey() + ") = " + en.getValue()));
        LOG.info("Sum of PageRanks: " + pageranks.values().stream().mapToDouble(Number::doubleValue).sum());
        pagerank.storeOnGraph(pageranks);

        return SingleResult.success();
    }