#vulnerable code 
                                public static void writeImage(final BufferedImage src, final File file,
            final ImageFormat format, final Map<String, Object> params) throws ImageWriteException,
            IOException {
        OutputStream os = null;
        boolean canThrow = false;
        try {
            os = new FileOutputStream(file);
            os = new BufferedOutputStream(os);

            writeImage(src, os, format, params);
            canThrow = true;
        } finally {
            IoUtils.closeQuietly(canThrow, os);
        }
    } 
                            #location 13 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public static void writeImage(final BufferedImage src, final File file,
            final ImageFormat format, final Map<String, Object> params) throws ImageWriteException,
            IOException {
        try (FileOutputStream fos = new FileOutputStream(file);
                BufferedOutputStream os = new BufferedOutputStream(fos)) {
            writeImage(src, os, format, params);
        }
    }