#fixed code
                                private Map<Long, Float> createFeatureMapWithCN5New(long firstNode) throws QueryExecutionException {
        Map<String, Object> params = new HashMap<>();
        params.put("id", firstNode);
        Result res = database.execute(DEFAULT_VECTOR_QUERY_WITH_CONCEPT, params);
        Map<Long, Float> result = new HashMap<>();
        Map<Long, Float> result_idf = new HashMap<>();
        while (res != null && res.hasNext()) {
            Map<String, Object> next = res.next();
            long id = (long) next.get("tagId");
            int nTerms = (int) next.get("nTerms");
            //float tf = getFloatValue(next.get("tf"));
            float tf = getFloatValue(next.get("tf")) / nTerms;
            float idf = Double.valueOf(Math.log10(Float.valueOf(getFloatValue(next.get("idf"))).doubleValue())).floatValue();

            // ConceptNet5 Level_1 tags
            //long cn5_tag = Long.valueOf((String) next.get("cn5_l1_tag"));
            long cn5_tag = (long) next.get("cn5_l1_tag");
            float cn5_tag_w = getFloatValue(next.get("cn5_l1_tag_w"));

            if (cn5_tag > -1) {
                if (!result.containsKey(cn5_tag)) {
                    result.put(cn5_tag, tf);
                    result_idf.put(cn5_tag, idf);
                } else {
                    result.put(cn5_tag, result.get(cn5_tag) + tf);
                    if (result_idf.get(cn5_tag) < idf) // use the highest idf
                    {
                        result_idf.put(cn5_tag, idf);
                    }
                }
            } else {
                result.put(id, tf);
                result_idf.put(id, idf);
            }
        }

        result.keySet().forEach((key) -> {
            result.put(key, result.get(key) * result_idf.get(key));
        });
        return result;
    }
#vulnerable code 
                                private Map<Long, Float> createFeatureMapWithCN5New(long firstNode) throws QueryExecutionException {
        Map<String, Object> params = new HashMap<>();
        params.put("id", firstNode);
        Result res = database.execute("MATCH (doc:AnnotatedText)\n"
                + "WITH count(doc) as documentsCount\n"
                + "MATCH (document:AnnotatedText)-[:CONTAINS_SENTENCE]->(s:Sentence)-[ht:HAS_TAG]->(tag:Tag)\n"
                + "WHERE id(document) = {id} and not any (p in tag.pos where p in [\"CC\", \"CD\", \"DT\", \"IN\", \"MD\", \"PRP\", \"PRP$\", \"UH\", \"WDT\", \"WP\", \"WRB\", \"TO\", \"PDT\", \"RP\", \"WP$\"])\n" // JJR, JJS ?
                + "WITH tag, sum(ht.tf) as tf, documentsCount, document.numTerms as nTerms\n"
                + "OPTIONAL MATCH (tag)-[rt:IS_RELATED_TO]->(t2_l1:Tag)\n"
                + "WHERE id(t2_l1) = tag.idMaxConcept  and exists(t2_l1.word2vec) and com.graphaware.nlp.ml.similarity.cosine(tag.word2vec, t2_l1.word2vec)>0.2\n"
                + "WITH tag, tf, nTerms, id(t2_l1) as cn5_l1_tag, rt.weight as cn5_l1_tag_w, documentsCount\n"
                + "MATCH (a:AnnotatedText)-[:CONTAINS_SENTENCE]->(s:Sentence)-[ht:HAS_TAG]->(tag)\n"
                + "RETURN id(tag) as tagId, tf, (1.0f*documentsCount)/count(distinct a) as idf, nTerms, (case cn5_l1_tag when null then -1 else cn5_l1_tag end) as cn5_l1_tag, cn5_l1_tag_w\n"
                + "ORDER BY tagId, cn5_l1_tag", params);
        Map<Long, Float> result = new HashMap<>();
        Map<Long, Float> result_idf = new HashMap<>();
        while (res != null && res.hasNext()) {
            Map<String, Object> next = res.next();
            long id = (long) next.get("tagId");
            int nTerms = (int) next.get("nTerms");
            //float tf = getFloatValue(next.get("tf"));
            float tf = getFloatValue(next.get("tf")) / nTerms;
            float idf = Double.valueOf(Math.log10(Float.valueOf(getFloatValue(next.get("idf"))).doubleValue())).floatValue();

            // ConceptNet5 Level_1 tags
            //long cn5_tag = Long.valueOf((String) next.get("cn5_l1_tag"));
            long cn5_tag = (long) next.get("cn5_l1_tag");
            float cn5_tag_w = getFloatValue(next.get("cn5_l1_tag_w"));

            if (cn5_tag>-1) {
              if (!result.containsKey(cn5_tag)) {
                  result.put(cn5_tag, tf);   
                  result_idf.put(cn5_tag, idf);
              } else {
                  result.put(cn5_tag, result.get(cn5_tag) + tf);
                  if (result_idf.get(cn5_tag) < idf) // use the highest idf
                      result_idf.put(cn5_tag, idf);
              }
            } else {
                result.put(id, tf);
                result_idf.put(id, idf);
            }
        }
        
        for (Long key: result.keySet()) {
            result.put(key, result.get(key) * result_idf.get(key));
        }
        return result;
    } 
                            #location 46 
                            #vulnerability type NULL_DEREFERENCE