private static String loadVersion ( ClassLoader classLoader ) throws IOException { try { Enumeration < URL > resources = classLoader . getResources ( "META-INF/MANIFEST.MF" ) ; while ( resources . hasMoreElements ( ) ) { final URL url = resources . nextElement ( ) ; final Manifest manifest = new Manifest ( url . openStream ( ) ) ; final Attributes mainAttributes = manifest . getMainAttributes ( ) ; final String value = mainAttributes . getValue ( IMPL_VERSION ) ; if ( value != null ) { return value ; } } } catch ( IOException e ) { LOG . error ( "Failed to read manifest" , e ) ; throw new IOException ( "Failed to find manifest" , e ) ; } return null ; }
Tries to load the first Implementation - Version manifest entry it can find in the given classloader .