#vulnerable code 
                                public void testClassParsing() throws Exception {
        Parser parser = new AutoDetectParser(); // Should auto-detect!
        ContentHandler handler = new BodyContentHandler();
        Metadata metadata = new Metadata();

        InputStream stream = ClassParserTest.class.getResourceAsStream(
                "/test-documents/AutoDetectParser.class");
        try {
            parser.parse(stream, handler, metadata);
        } finally {
            stream.close();
        }

        assertEquals("AutoDetectParser", metadata.get(Metadata.TITLE));
        assertEquals(
                "AutoDetectParser.class",
                metadata.get(Metadata.RESOURCE_NAME_KEY));

        String content = handler.toString();
        assertTrue(content.contains("package org.apache.tika.parser;"));
        assertTrue(content.contains(
                "class AutoDetectParser extends CompositeParser"));
        assertTrue(content.contains(
                "private org.apache.tika.mime.MimeTypes types"));
        assertTrue(content.contains(
                "public void parse("
                + "java.io.InputStream, org.xml.sax.ContentHandler,"
                + " org.apache.tika.metadata.Metadata) throws"
                + " java.io.IOException, org.xml.sax.SAXException,"
                + " org.apache.tika.exception.TikaException;"));
        assertTrue(content.contains(
                "private byte[] getPrefix(java.io.InputStream, int)"
                + " throws java.io.IOException;"));
    } 
                            #location 9 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                public void testClassParsing() throws Exception {
        String path = "/test-documents/AutoDetectParser.class";
        Metadata metadata = new Metadata();
        String content = Tika.parseToString(
                ClassParserTest.class.getResourceAsStream(path), metadata);

        assertEquals("AutoDetectParser", metadata.get(Metadata.TITLE));
        assertEquals(
                "AutoDetectParser.class",
                metadata.get(Metadata.RESOURCE_NAME_KEY));

        assertTrue(content.contains("package org.apache.tika.parser;"));
        assertTrue(content.contains(
                "class AutoDetectParser extends CompositeParser"));
        assertTrue(content.contains(
                "private org.apache.tika.mime.MimeTypes types"));
        assertTrue(content.contains(
                "public void parse("
                + "java.io.InputStream, org.xml.sax.ContentHandler,"
                + " org.apache.tika.metadata.Metadata) throws"
                + " java.io.IOException, org.xml.sax.SAXException,"
                + " org.apache.tika.exception.TikaException;"));
        assertTrue(content.contains(
                "private byte[] getPrefix(java.io.InputStream, int)"
                + " throws java.io.IOException;"));
    }