Skip to content

Commit 771171b

Browse files
committed
VersionUtils: refactor manifest version extraction
1 parent 8b14f8a commit 771171b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/main/java/org/scijava/util/VersionUtils.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ public static String getVersion(final Class<?> c, final String groupId,
7979
public static String getVersionFromManifest(final Class<?> c) {
8080
final Manifest m = Manifest.getManifest(c);
8181
if (m == null) return null;
82-
final String manifestVersion = m.getImplementationVersion();
83-
return manifestVersion == null ? null : m.getSpecificationVersion();
82+
return getVersionFromManifest(m);
8483
}
8584

8685
/**
@@ -99,4 +98,13 @@ public static String getVersionFromPOM(final Class<?> c,
9998
final POM pom = POM.getPOM(c, groupId, artifactId);
10099
return pom == null ? null : pom.getVersion();
101100
}
101+
102+
// -- Helper methods --
103+
104+
private static String getVersionFromManifest(final Manifest m) {
105+
final String manifestVersion = m.getImplementationVersion();
106+
if (manifestVersion != null) return manifestVersion;
107+
return m.getSpecificationVersion();
108+
}
109+
102110
}

0 commit comments

Comments
 (0)