#vulnerable code 
                                protected String parse(InputStream stream, Iterable<Content> contents)
            throws IOException, TikaException {
        StringBuffer sb = new StringBuffer();
        BufferedReader br = new BufferedReader(new InputStreamReader(stream));
        String line = null;
        while ((line = br.readLine()) != null) {
            sb.append(line);
            sb.append(" ");
        }
        return sb.toString();
    } 
                            #location 10 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                protected String parse(InputStream stream, Iterable<Content> contents)
            throws IOException, TikaException {
        StringBuilder sb = new StringBuilder();
        BufferedReader br = new BufferedReader(new InputStreamReader(stream));

        int charAsInt;

        while ((charAsInt = br.read()) != -1) {
            sb.append((char) charAsInt);
        }

        return sb.toString();
    }