#vulnerable code 
                                public static byte[] toUnixLineEndings(InputStream input) throws IOException {
        final Charset UTF8 = Charset.forName("UTF-8");
        final BufferedReader reader = new BufferedReader(new InputStreamReader(input));

        final ByteArrayOutputStream dataStream = new ByteArrayOutputStream();

        String line;
        while((line = reader.readLine()) != null) {
            dataStream.write(line.getBytes(UTF8));
            dataStream.write('\n');
        }
        reader.close();

        return dataStream.toByteArray();
    } 
                            #location 14 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public static byte[] toUnixLineEndings(InputStream input) throws IOException {
        String encoding = "ISO-8859-1";
        FixCrLfFilter filter = new FixCrLfFilter(new InputStreamReader(input, encoding));
        filter.setEol(FixCrLfFilter.CrLf.newInstance("unix"));
        
        ByteArrayOutputStream filteredFile = new ByteArrayOutputStream();
        Utils.copy(new ReaderInputStream(filter, encoding), filteredFile);
        
        return filteredFile.toByteArray();
    }