static Map < String , String > getVersionAttributes ( URL url ) throws IOException { Map < String , String > ret = new LinkedHashMap <> ( ) ; try ( InputStream inputStream = url . openStream ( ) ) { Manifest manifest = new Manifest ( inputStream ) ; Attributes attributes = manifest . getMainAttributes ( ) ; for ( String key : VERSION_ATTRIBUTES ) { final String value = attributes . getValue ( key ) ; ret . put ( key , value == null ? UNKNOWN_VALUE : value ) ; } } return ret ; }
For the sake of unit testing