public String getBackupVersion ( ) { try { try ( JarFile backupWar = new JarFile ( new File ( Lifecycle . get ( ) . getHudsonWar ( ) + ".bak" ) ) ) { Attributes attrs = backupWar . getManifest ( ) . getMainAttributes ( ) ; String v = attrs . getValue ( "Jenkins-Version" ) ; if ( v == null ) v = attrs . getValue ( "Hudson-Version" ) ; return v ; } } catch ( IOException e ) { LOGGER . log ( Level . WARNING , "Failed to read backup version " , e ) ; return null ; } }
Returns String with version of backup . war file if the file does not exists returns null