#vulnerable code 
                                @Test
    public void testParseJSONWithNullDefaultAnalyzer() throws IOException {

        String json = "{" +
                      "  analyzers:{" +
                      "    spanish_analyzer : {" +
                      "      type:\"classpath\", " +
                      "      class:\"org.apache.lucene.analysis.es.SpanishAnalyzer\"}," +
                      "    snowball_analyzer : {" +
                      "      type:\"snowball\", " +
                      "      language:\"Spanish\", " +
                      "      stopwords : \"el,la,lo,lo,as,las,a,ante,con,contra\"}" +
                      "  }," +
                      "  fields : { id : {type : \"integer\"} }" +
                      " }'";
        Schema schema = SchemaBuilder.fromJson(json).build();

        Analyzer defaultAnalyzer = schema.getDefaultAnalyzer();
        assertEquals("Expected default analyzer",
                     PreBuiltAnalyzers.DEFAULT.get().getClass(),
                     defaultAnalyzer.getClass());

        Analyzer spanishAnalyzer = schema.getAnalyzer("spanish_analyzer");
        assertTrue("Expected SpanishAnalyzer", spanishAnalyzer instanceof SpanishAnalyzer);

        schema.close();
    } 
                            #location 21 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                @Test
    public void testParseJSONWithNullDefaultAnalyzer() throws IOException {

        String json = "{" +
                      "  analyzers:{" +
                      "    spanish_analyzer : {" +
                      "      type:\"classpath\", " +
                      "      class:\"org.apache.lucene.analysis.es.SpanishAnalyzer\"}," +
                      "    snowball_analyzer : {" +
                      "      type:\"snowball\", " +
                      "      language:\"Spanish\", " +
                      "      stopwords : \"el,la,lo,lo,as,las,a,ante,con,contra\"}" +
                      "  }," +
                      "  fields : { id : {type : \"integer\"}, text : {type : \"text\"} }" +
                      " }'";
        Schema schema = SchemaBuilder.fromJson(json).build();

        Analyzer defaultAnalyzer = schema.getDefaultAnalyzer();
        assertEquals("Expected default analyzer",
                     PreBuiltAnalyzers.DEFAULT.get().getClass(),
                     defaultAnalyzer.getClass());

        Analyzer textAnalyzer = schema.getAnalyzer("text");
        assertEquals("Expected default analyzer", PreBuiltAnalyzers.DEFAULT.get().getClass(), textAnalyzer.getClass());
        textAnalyzer = schema.getAnalyzer("text.name");
        assertEquals("Expected default analyzer", PreBuiltAnalyzers.DEFAULT.get().getClass(), textAnalyzer.getClass());

        schema.close();
    }