From 1c4731903f24581c4a5c5901ebc3ff71aa73a494 Mon Sep 17 00:00:00 2001 From: BJ Hargrave Date: Fri, 5 Jun 2020 14:49:03 -0400 Subject: [PATCH] mainclass: Version attributes must be of type Version Signed-off-by: BJ Hargrave --- .../src/aQute/bnd/osgi/resource/MainClassNamespace.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/biz.aQute.bndlib/src/aQute/bnd/osgi/resource/MainClassNamespace.java b/biz.aQute.bndlib/src/aQute/bnd/osgi/resource/MainClassNamespace.java index 10a073c81e..902a7ba27d 100644 --- a/biz.aQute.bndlib/src/aQute/bnd/osgi/resource/MainClassNamespace.java +++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/resource/MainClassNamespace.java @@ -1,6 +1,6 @@ package aQute.bnd.osgi.resource; -import org.osgi.framework.Constants; +import org.osgi.framework.Version; import org.osgi.framework.VersionRange; import aQute.bnd.osgi.Domain; @@ -30,9 +30,11 @@ public static void build(CapabilityBuilder mc, Domain manifest) { mainClass = mainClass.replace('/', '.'); // yeah, it happens! mc.addAttribute(MainClassNamespace.MAINCLASS_NAMESPACE, mainClass); - String version = manifest.get(Constants.BUNDLE_VERSION); - if (version != null) + String versionString = manifest.getBundleVersion(); + if ((versionString != null) && aQute.bnd.version.Version.isVersion(versionString)) { + Version version = Version.parseVersion(versionString); mc.addAttribute(VERSION_ATTRIBUTE, version); + } } public static String filter(String mainClass, VersionRange range) {