From df9ff7f340a5ab4e07efc613f5f264eeae63d4c7 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 3 Jul 2014 16:06:47 +0200 Subject: Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) - Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines --- src/java/com/jogamp/common/util/VersionUtil.java | 26 +++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src/java/com/jogamp/common/util/VersionUtil.java') diff --git a/src/java/com/jogamp/common/util/VersionUtil.java b/src/java/com/jogamp/common/util/VersionUtil.java index c4451ac..6949d62 100644 --- a/src/java/com/jogamp/common/util/VersionUtil.java +++ b/src/java/com/jogamp/common/util/VersionUtil.java @@ -40,6 +40,8 @@ import java.util.Set; import java.util.jar.Attributes; import java.util.jar.Manifest; +import jogamp.common.os.PlatformPropsImpl; + public class VersionUtil { public static final String SEPERATOR = "-----------------------------------------------------------------------------------------------------"; @@ -68,7 +70,7 @@ public class VersionUtil { Platform.getMachineDescription().toString(sb).append(Platform.getNewline()); // JVM/JRE - sb.append("Platform: Java Version: ").append(Platform.getJavaVersion()).append(" (").append(Platform.getJavaVersionNumber()).append("u").append(Platform.JAVA_VERSION_UPDATE).append("), VM: ").append(Platform.getJavaVMName()); + sb.append("Platform: Java Version: ").append(Platform.getJavaVersion()).append(" (").append(Platform.getJavaVersionNumber()).append("u").append(PlatformPropsImpl.JAVA_VERSION_UPDATE).append("), VM: ").append(Platform.getJavaVMName()); sb.append(", Runtime: ").append(Platform.getJavaRuntimeName()).append(Platform.getNewline()); sb.append("Platform: Java Vendor: ").append(Platform.getJavaVendor()).append(", ").append(Platform.getJavaVendorURL()); sb.append(", JavaSE: ").append(Platform.isJavaSE()); @@ -94,7 +96,7 @@ public class VersionUtil { * @param extension The value of the 'Extension-Name' jar-manifest attribute; used to identify the manifest. * @return the requested manifest or null when not found. */ - public static Manifest getManifest(ClassLoader cl, String extension) { + public static Manifest getManifest(final ClassLoader cl, final String extension) { return getManifest(cl, new String[] { extension } ); } @@ -106,10 +108,10 @@ public class VersionUtil { * Matching is applied in decreasing order, i.e. first element is favored over the second, etc. * @return the requested manifest or null when not found. */ - public static Manifest getManifest(ClassLoader cl, String[] extensions) { + public static Manifest getManifest(final ClassLoader cl, final String[] extensions) { final Manifest[] extManifests = new Manifest[extensions.length]; try { - Enumeration resources = cl.getResources("META-INF/MANIFEST.MF"); + final Enumeration resources = cl.getResources("META-INF/MANIFEST.MF"); while (resources.hasMoreElements()) { final InputStream is = resources.nextElement().openStream(); final Manifest manifest; @@ -118,7 +120,7 @@ public class VersionUtil { } finally { IOUtil.close(is, false); } - Attributes attributes = manifest.getMainAttributes(); + final Attributes attributes = manifest.getMainAttributes(); if(attributes != null) { for(int i=0; i < extensions.length && null == extManifests[i]; i++) { final String extension = extensions[i]; @@ -131,7 +133,7 @@ public class VersionUtil { } } } - } catch (IOException ex) { + } catch (final IOException ex) { throw new RuntimeException("Unable to read manifest.", ex); } for(int i=1; i keys = attr.keySet(); - for(Iterator iter=keys.iterator(); iter.hasNext(); ) { - Attributes.Name key = (Attributes.Name) iter.next(); - String val = attr.getValue(key); + final Attributes attr = mf.getMainAttributes(); + final Set keys = attr.keySet(); + for(final Iterator iter=keys.iterator(); iter.hasNext(); ) { + final Attributes.Name key = (Attributes.Name) iter.next(); + final String val = attr.getValue(key); sb.append(" "); sb.append(key); sb.append(" = "); -- cgit v1.2.3