#vulnerable code 
                                public static WebDocument fromText(String meta, List<String> pageData) {

        String url = Regexps.firstMatch(urlPattern, meta, 2);
        String id = url.replaceAll("http://|https://", "");
        String source = Regexps.firstMatch(sourcePattern, meta, 2);
        String crawlDate = Regexps.firstMatch(crawlDatePattern, meta, 2);
        String labels = Regexps.firstMatch(labelPattern, meta, 2).replace('\"', ' ').trim();
        String category = Regexps.firstMatch(categoryPattern, meta, 2).replace('\"', ' ').trim();
        String title = Regexps.firstMatch(titlePattern, meta, 2).replace('\"', ' ').trim();


        int i = source.lastIndexOf("/");
        if (i >= 0 && i < source.length()) {
            source = source.substring(i + 1);
        }
        return new WebDocument(source, id, title, pageData, url, crawlDate, labels, category);
    } 
                            #location 8 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                public static WebDocument fromText(String meta, List<String> pageData) {

        String url = Regexps.firstMatch(urlPattern, meta, 2);
        String id = url.replaceAll("http://|https://", "");
        String source = Regexps.firstMatch(sourcePattern, meta, 2);
        String crawlDate = Regexps.firstMatch(crawlDatePattern, meta, 2);
        String labels =  getAttribute(Regexps.firstMatch(labelPattern, meta, 2));

        String category = getAttribute(Regexps.firstMatch(categoryPattern, meta, 2));
        String title = getAttribute(Regexps.firstMatch(titlePattern, meta, 2));

        int i = source.lastIndexOf("/");
        if (i >= 0 && i < source.length()) {
            source = source.substring(i + 1);
        }
        return new WebDocument(source, id, title, pageData, url, crawlDate, labels, category);
    }