public static int getVersionFromProperties ( ) { String ver = version . get ( ) ; if ( ver == null ) { try { InputStream resourceAsStream = ProtocolUtil . class . getResourceAsStream ( "/japi-version.properties" ) ; Properties props = new Properties ( ) ; props . load ( resourceAsStream ) ; ver = props . getProperty ( "build.version" ) ; Matcher verMatch = versionPattern . matcher ( ver ) ; if ( verMatch . matches ( ) && verMatch . groupCount ( ) == 2 ) { int major = Integer . parseInt ( verMatch . group ( 1 ) ) ; int minor = Integer . parseInt ( verMatch . group ( 2 ) ) ; return ( major * 100 ) + minor ; } } catch ( Exception e ) { System . getLogger ( "ProtocolUtil" ) . log ( ERROR , "Did not successfully obtain version" , e ) ; } } return 0 ; }
gets and caches the current version from the version properties file