#vulnerable code 
                                public static Version versionFor(Class<?> cls)
    {
        InputStream in;
        Version version = null;

        try {
            in = cls.getResourceAsStream(VERSION_FILE);
            if (in != null) {
                try {
                    BufferedReader br = new BufferedReader(new InputStreamReader(in, "UTF-8"));
                    String groupStr = null, artifactStr = null;
                    String versionStr = br.readLine();
                    if (versionStr != null) {
                        groupStr = br.readLine();
                        if (groupStr != null) {
                            groupStr = groupStr.trim();
                            artifactStr = br.readLine();
                            if (artifactStr != null) {
                                artifactStr = artifactStr.trim();
                            }
                        }
                    }
                    version = parseVersion(versionStr, groupStr, artifactStr);
                } finally {
                    try {
                        in.close();
                    } catch (IOException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        } catch (IOException e) { }
        return (version == null) ? Version.unknownVersion() : version;
    } 
                            #location 6 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public static Version versionFor(Class<?> cls)
    {
        final InputStream in = cls.getResourceAsStream(VERSION_FILE);

        if (in == null)
            return Version.unknownVersion();

        try {
            InputStreamReader reader = new InputStreamReader(in, "UTF-8");
            try {
                return doReadVersion(reader);
            } finally {
                try {
                    reader.close();
                } catch (IOException ignored) {
                }
            }
        } catch (UnsupportedEncodingException e) {
            return Version.unknownVersion();
        } finally {
            try {
                in.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }