/** * Extracts the version information data from the manifest's attributes and puts them into a VersionInfo * instance. * * @param manifest * the manifest information * @return the version information from the manifest */ protected static VersionInfo createVersionInfo( final Manifest manifest ) { final VersionInfo versionInfo = new VersionInfo(); final Attributes mainAttributes = manifest.getMainAttributes(); versionInfo.setFromManifest( true ); versionInfo.setProductID( mainAttributes.getValue( "Implementation-ProductID" ) ); //$NON-NLS-1$ versionInfo.setTitle( mainAttributes.getValue( "Implementation-Title" ) ); //$NON-NLS-1$ versionInfo.setVersion( mainAttributes.getValue( "Implementation-Version" ) ); //$NON-NLS-1$ return versionInfo; }
protected static VersionInfo getVersionInfoFromProperties(ResourceBundle assemblyBundle) { final VersionInfo versionInfo = new VersionInfo(); try { versionInfo.setFromManifest( false ); versionInfo.setTitle( assemblyBundle.getString( "assembly.title" ) ); versionInfo.setProductID( assemblyBundle.getString( "assembly.productid" ) ); versionInfo.setVersion( assemblyBundle.getString("assembly.version") ); } catch (Exception ignored) { // ex.printStackTrace(); versionInfo.setVersionRelease( "-error-" ); } return versionInfo; }
try { final ResourceBundle bundle = ResourceBundle.getBundle( "build-res.version" ); //$NON-NLS-1$ versionInfo.setFromManifest( false ); versionInfo.setProductID( bundle.getString( "impl.productID" ) ); //$NON-NLS-1$ versionInfo.setTitle( bundle.getString( "impl.title" ) ); //$NON-NLS-1$
info.setFromManifest( fromManifest ); info.setProductID( productID ); info.setTitle( title );