#vulnerable code 
                                @Test
    public void testFromJson() throws IOException {
        String json = "{analyzers:{" +
                      "custom:{type:\"classpath\",class:\"org.apache.lucene.analysis.en.EnglishAnalyzer\"}," +
                      "snowball:{type:\"snowball\",language:\"English\",stopwords:\"the,at\"}}," +
                      "default_analyzer:\"custom\"," +
                      "fields:" +
                      "{big_int:{type:\"bigint\",digits:10}," +
                      "big_dec:{type:\"bigdec\",indexed:false,sorted:true}," +
                      "bitemporal:{type:\"bitemporal\",vt_from:\"vtFrom\",vt_to:\"vtTo\",tt_from:\"ttFrom\",tt_to:\"ttTo\"}," +
                      "blob:{type:\"bytes\"}," +
                      "bool:{type:\"boolean\"}," +
                      "date:{type:\"date\"}," +
                      "date_range:{type:\"date_range\",from:\"from\",to:\"to\"}," +
                      "double:{type:\"double\"}," +
                      "float:{type:\"float\"}," +
                      "geo:{type:\"geo_point\",latitude:\"lat\",longitude:\"lon\"}," +
                      "inet:{type:\"inet\"}," +
                      "int:{type:\"integer\",boost:0.3}," +
                      "long:{type:\"long\"}," +
                      "string:{type:\"string\"}," +
                      "text:{type:\"text\"}," +
                      "uuid:{type:\"uuid\"}}}";
        Schema schema = SchemaBuilder.fromJson(json).build();
        assertEquals("Failed schema JSON parsing", EnglishAnalyzer.class, schema.getDefaultAnalyzer().getClass());
        assertEquals("Failed schema JSON parsing", EnglishAnalyzer.class, schema.getAnalyzer("custom").getClass());
        assertEquals("Failed schema JSON parsing", SnowballAnalyzer.class, schema.getAnalyzer("snowball").getClass());
        assertEquals("Failed schema JSON parsing", BigIntegerMapper.class, schema.getMapper("big_int").getClass());
        assertEquals("Failed schema JSON parsing", BigDecimalMapper.class, schema.getMapper("big_dec").getClass());
        assertEquals("Failed schema JSON parsing", BitemporalMapper.class, schema.getMapper("bitemporal").getClass());
        assertEquals("Failed schema JSON parsing", BlobMapper.class, schema.getMapper("blob").getClass());
        assertEquals("Failed schema JSON parsing", BooleanMapper.class, schema.getMapper("bool").getClass());
        assertEquals("Failed schema JSON parsing", DateMapper.class, schema.getMapper("date").getClass());
        assertEquals("Failed schema JSON parsing", DateRangeMapper.class, schema.getMapper("date_range").getClass());
        assertEquals("Failed schema JSON parsing", DoubleMapper.class, schema.getMapper("double").getClass());
        assertEquals("Failed schema JSON parsing", FloatMapper.class, schema.getMapper("float").getClass());
        assertEquals("Failed schema JSON parsing", GeoPointMapper.class, schema.getMapper("geo").getClass());
        assertEquals("Failed schema JSON parsing", InetMapper.class, schema.getMapper("inet").getClass());
        assertEquals("Failed schema JSON parsing", IntegerMapper.class, schema.getMapper("int").getClass());
        assertEquals("Failed schema JSON parsing", LongMapper.class, schema.getMapper("long").getClass());
        assertEquals("Failed schema JSON parsing", StringMapper.class, schema.getMapper("string").getClass());
        assertEquals("Failed schema JSON parsing", TextMapper.class, schema.getMapper("text").getClass());
        assertEquals("Failed schema JSON parsing", UUIDMapper.class, schema.getMapper("uuid").getClass());
    } 
                            #location 25 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                @Test
    public void testFromJson() throws IOException {
        String json = "{analyzers:{" +
                      "custom:{type:\"classpath\",class:\"org.apache.lucene.analysis.en.EnglishAnalyzer\"}," +
                      "snowball:{type:\"snowball\",language:\"English\",stopwords:\"the,at\"}}," +
                      "default_analyzer:\"custom\"," +
                      "fields:" +
                      "{big_int:{type:\"bigint\",digits:10}," +
                      "big_dec:{type:\"bigdec\",indexed:false,sorted:true}," +
                      "bitemporal:{type:\"bitemporal\",vt_from:\"vtFrom\",vt_to:\"vtTo\",tt_from:\"ttFrom\",tt_to:\"ttTo\"}," +
                      "blob:{type:\"bytes\"}," +
                      "bool:{type:\"boolean\"}," +
                      "date:{type:\"date\"}," +
                      "date_range:{type:\"date_range\",from:\"from\",to:\"to\"}," +
                      "double:{type:\"double\"}," +
                      "float:{type:\"float\"}," +
                      "geo:{type:\"geo_point\",latitude:\"lat\",longitude:\"lon\"}," +
                      "inet:{type:\"inet\"}," +
                      "int:{type:\"integer\",boost:0.3}," +
                      "long:{type:\"long\"}," +
                      "string:{type:\"string\"}," +
                      "text:{type:\"text\",analyzer:\"snowball\"}," +
                      "uuid:{type:\"uuid\"}}}";
        Schema schema = SchemaBuilder.fromJson(json).build();
        assertEquals("Failed schema JSON parsing", EnglishAnalyzer.class, schema.getDefaultAnalyzer().getClass());
        assertEquals("Failed schema JSON parsing", BigIntegerMapper.class, schema.getMapper("big_int").getClass());
        assertEquals("Failed schema JSON parsing", BigDecimalMapper.class, schema.getMapper("big_dec").getClass());
        assertEquals("Failed schema JSON parsing", BitemporalMapper.class, schema.getMapper("bitemporal").getClass());
        assertEquals("Failed schema JSON parsing", BlobMapper.class, schema.getMapper("blob").getClass());
        assertEquals("Failed schema JSON parsing", BooleanMapper.class, schema.getMapper("bool").getClass());
        assertEquals("Failed schema JSON parsing", DateMapper.class, schema.getMapper("date").getClass());
        assertEquals("Failed schema JSON parsing", DateRangeMapper.class, schema.getMapper("date_range").getClass());
        assertEquals("Failed schema JSON parsing", DoubleMapper.class, schema.getMapper("double").getClass());
        assertEquals("Failed schema JSON parsing", FloatMapper.class, schema.getMapper("float").getClass());
        assertEquals("Failed schema JSON parsing", GeoPointMapper.class, schema.getMapper("geo").getClass());
        assertEquals("Failed schema JSON parsing", InetMapper.class, schema.getMapper("inet").getClass());
        assertEquals("Failed schema JSON parsing", IntegerMapper.class, schema.getMapper("int").getClass());
        assertEquals("Failed schema JSON parsing", LongMapper.class, schema.getMapper("long").getClass());
        assertEquals("Failed schema JSON parsing", StringMapper.class, schema.getMapper("string").getClass());
        assertEquals("Failed schema JSON parsing", TextMapper.class, schema.getMapper("text").getClass());
        assertEquals("Failed schema JSON parsing", SnowballAnalyzer.class, schema.getAnalyzer("text").getClass());
        assertEquals("Failed schema JSON parsing", SnowballAnalyzer.class, schema.getAnalyzer("text.name").getClass());
        assertEquals("Failed schema JSON parsing", UUIDMapper.class, schema.getMapper("uuid").getClass());
    }