diff options
author | Sven Gothel <[email protected]> | 2015-08-18 02:50:49 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-08-18 02:50:49 +0200 |
commit | 32f09a5894ce3b157d5439df83703fa6f5336ff4 (patch) | |
tree | 69af265377fa69f385f3d0fe72d52622e2ca4a93 | |
parent | 6557eedd0f0ec98d743c762a698bb028e88a9e16 (diff) |
Bug 1145: Fix cc2: Null versions reported using the fat-jar (JogampVersion)
In case we run fat-jar file, the package name is 'com.jogamp'
and all entries are based upon GlueGen.
JogampVersion will fall back trying to find a fat-jar Manifest
in case a null Manifest is being passed.
-rw-r--r-- | src/java/com/jogamp/common/util/JogampVersion.java | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/java/com/jogamp/common/util/JogampVersion.java b/src/java/com/jogamp/common/util/JogampVersion.java index e9becc6..e06ce1f 100644 --- a/src/java/com/jogamp/common/util/JogampVersion.java +++ b/src/java/com/jogamp/common/util/JogampVersion.java @@ -46,6 +46,9 @@ public class JogampVersion { /** See {@link #getImplementationCommit()} */ public static final Attributes.Name IMPLEMENTATION_COMMIT = new Attributes.Name("Implementation-Commit"); + /** For FAT JogAmp jar files */ + private static final String packageNameFAT = "com.jogamp"; + private final String packageName; private final Manifest mf; private final int hash; @@ -55,12 +58,27 @@ public class JogampVersion { private final String androidPackageVersionName; protected JogampVersion(final String packageName, final Manifest mf) { - this.packageName = packageName; - this.mf = ( null != mf ) ? mf : new Manifest(); + if( null != mf ) { + // use provided valid data + this.mf = mf; + this.packageName = packageName; + } else { + // try FAT jar file + final Manifest fatMF = VersionUtil.getManifest(JogampVersion.class.getClassLoader(), packageNameFAT); + if( null != fatMF ) { + // use FAT jar file + this.mf = fatMF; + this.packageName = packageNameFAT; + } else { + // use faulty data, unresolvable .. + this.mf = new Manifest(); + this.packageName = packageName; + } + } this.hash = this.mf.hashCode(); mainAttributes = this.mf.getMainAttributes(); mainAttributeNames = mainAttributes.keySet(); - androidPackageVersionName = AndroidUtils.getPackageInfoVersionName(packageName); // null if !Android + androidPackageVersionName = AndroidUtils.getPackageInfoVersionName(this.packageName); // null if !Android } @Override |