You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by cs...@apache.org on 2015/10/29 11:35:41 UTC

karaf git commit: [KARAF-4086] Ignore jars without symbolic name

Repository: karaf
Updated Branches:
  refs/heads/master a2630e694 -> eb1d3c1d0


[KARAF-4086] Ignore jars without symbolic name


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/eb1d3c1d
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/eb1d3c1d
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/eb1d3c1d

Branch: refs/heads/master
Commit: eb1d3c1d0366cfc9708d07b008f62beeacd6718d
Parents: a2630e6
Author: Christian Schneider <ch...@die-schneider.net>
Authored: Thu Oct 29 11:35:15 2015 +0100
Committer: Christian Schneider <ch...@die-schneider.net>
Committed: Thu Oct 29 11:35:15 2015 +0100

----------------------------------------------------------------------
 .../features/ExportFeatureMetaDataMojo.java     | 22 ++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/eb1d3c1d/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ExportFeatureMetaDataMojo.java
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ExportFeatureMetaDataMojo.java b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ExportFeatureMetaDataMojo.java
index b18001f..c0aeb2b 100644
--- a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ExportFeatureMetaDataMojo.java
+++ b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ExportFeatureMetaDataMojo.java
@@ -92,7 +92,12 @@ public class ExportFeatureMetaDataMojo extends AbstractFeatureMojo {
         Set<String> bundleIds = new HashSet<String>();
         for (Feature feature : featuresSet) {
             for (Bundle bundle : feature.getBundle()) {
-                String bundleId = getBundleSymbolicName(bundle) + ":" + getBundleVersion(bundle);
+                String symbolicName = getBundleSymbolicName(bundle);
+                if (symbolicName == null) {
+                    logIgnored(bundle);
+                    continue;
+                }
+                String bundleId = symbolicName + ":" + getBundleVersion(bundle);
                 if (!bundleIds.contains(bundleId)) {
                     bundleIds.add(bundleId);
                     merged.getBundle().add(bundle);
@@ -107,15 +112,20 @@ public class ExportFeatureMetaDataMojo extends AbstractFeatureMojo {
         Map<String, Bundle> bundleVersions = new HashMap<>();
         for (Feature feature : featuresSet) {
             for (Bundle bundle : feature.getBundle()) {
-                Bundle existingBundle = bundleVersions.get(getBundleSymbolicName(bundle));
+                String symbolicName = getBundleSymbolicName(bundle);
+                if (symbolicName == null) {
+                    logIgnored(bundle);
+                    continue;
+                }
+                Bundle existingBundle = bundleVersions.get(symbolicName);
                 if (existingBundle != null) {
                     Version existingVersion = new Version(getBundleVersion(existingBundle));
                     Version newVersion = new Version(getBundleVersion(bundle));
                     if (newVersion.compareTo(existingVersion) > 0) {
-                        bundleVersions.put(getBundleSymbolicName(bundle), bundle);
+                        bundleVersions.put(symbolicName, bundle);
                     }
                 } else {
-                    bundleVersions.put(getBundleSymbolicName(bundle), bundle);
+                    bundleVersions.put(symbolicName, bundle);
                 }
             }
         }
@@ -125,6 +135,10 @@ public class ExportFeatureMetaDataMojo extends AbstractFeatureMojo {
         return merged;
     }
 
+    private void logIgnored(Bundle bundle) {
+        getLog().warn("Ignoring jar without BundleSymbolicName: " + bundle.getLocation());
+    }
+
     private Map<String, Attributes> manifests = new HashMap<>();
 
     private String getBundleVersion(Bundle bundle) throws MojoExecutionException {