You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2015/02/08 07:46:44 UTC

karaf git commit: [KARAF-3506] Handle locations starting/ending with whitespaces in InstallKarsMojo

Repository: karaf
Updated Branches:
  refs/heads/master 4337a9734 -> b6236361e


[KARAF-3506] Handle locations starting/ending with whitespaces in InstallKarsMojo


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

Branch: refs/heads/master
Commit: b6236361eb6948e381f8678b671165610cbb72dc
Parents: 4337a97
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Sun Feb 8 07:45:49 2015 +0100
Committer: Jean-Baptiste Onofré <jb...@apache.org>
Committed: Sun Feb 8 07:45:49 2015 +0100

----------------------------------------------------------------------
 .../karaf/tooling/features/InstallKarsMojo.java | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/b6236361/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
index 9210773..8c500c1 100644
--- a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
+++ b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
@@ -376,7 +376,7 @@ public class InstallKarsMojo extends MojoSupport {
         Map<String, Integer> allStartupBundles = new LinkedHashMap<>();
         for (Feature feature : startupFeatures) {
             for (Bundle bundleInfo : feature.getBundle()) {
-                String bundleLocation = bundleInfo.getLocation();
+                String bundleLocation = bundleInfo.getLocation().trim();
                 int bundleStartLevel = bundleInfo.getStartLevel() == 0 ? defaultStartLevel : bundleInfo.getStartLevel();
                 if (allStartupBundles.containsKey(bundleLocation)) {
                     bundleStartLevel = Math.min(bundleStartLevel, allStartupBundles.get(bundleLocation));
@@ -397,7 +397,7 @@ public class InstallKarsMojo extends MojoSupport {
                 }
                 if (doInstall) {
                     for (Bundle bundleInfo : cond.getBundle()) {
-                        String bundleLocation = bundleInfo.getLocation();
+                        String bundleLocation = bundleInfo.getLocation().trim();
                         int bundleStartLevel = bundleInfo.getStartLevel() == 0 ? defaultStartLevel : bundleInfo.getStartLevel();
                         if (allStartupBundles.containsKey(bundleLocation)) {
                             bundleStartLevel = Math.min(bundleStartLevel, allStartupBundles.get(bundleLocation));
@@ -411,7 +411,7 @@ public class InstallKarsMojo extends MojoSupport {
             }
             // Install config files
             for (ConfigFile configFile : feature.getConfigfile()) {
-                try (InputStream is = new URL(configFile.getLocation()).openStream()) {
+                try (InputStream is = new URL(configFile.getLocation().trim()).openStream()) {
                     String path = configFile.getFinalname();
                     if (path.startsWith("/")) {
                         path = path.substring(1);
@@ -422,7 +422,7 @@ public class InstallKarsMojo extends MojoSupport {
             }
             for (Conditional cond : feature.getConditional()) {
                 for (ConfigFile configFile : cond.getConfigfile()) {
-                    try (InputStream is = new URL(configFile.getLocation()).openStream()) {
+                    try (InputStream is = new URL(configFile.getLocation().trim()).openStream()) {
                         Path output = workDirectory.toPath().resolve(configFile.getFinalname());
                         Files.copy(is, output, StandardCopyOption.REPLACE_EXISTING); // TODO: be smarter about overwrites
                     }
@@ -532,13 +532,13 @@ public class InstallKarsMojo extends MojoSupport {
             Set<String> locations = new HashSet<>();
             for (Bundle bundle : feature.getBundle()) {
                 if (!ignoreDependencyFlag || !bundle.isDependency()) {
-                    locations.add(bundle.getLocation());
+                    locations.add(bundle.getLocation().trim());
                 }
             }
             for (Conditional cond : feature.getConditional()) {
                 for (Bundle bundle : cond.getBundle()) {
                     if (!ignoreDependencyFlag || !bundle.isDependency()) {
-                        locations.add(bundle.getLocation());
+                        locations.add(bundle.getLocation().trim());
                     }
                 }
             }
@@ -561,11 +561,11 @@ public class InstallKarsMojo extends MojoSupport {
             }
             // Install config files
             for (ConfigFile configFile : feature.getConfigfile()) {
-                installArtifact(configFile.getLocation());
+                installArtifact(configFile.getLocation().trim());
             }
             for (Conditional cond : feature.getConditional()) {
                 for (ConfigFile configFile : cond.getConfigfile()) {
-                    installArtifact(configFile.getLocation());
+                    installArtifact(configFile.getLocation().trim());
                 }
             }
         }
@@ -672,13 +672,13 @@ public class InstallKarsMojo extends MojoSupport {
         for (Feature feature : installedFeatures) {
             for (Bundle bundle : feature.getBundle()) {
                 if (!ignoreDependencyFlag || !bundle.isDependency()) {
-                    installArtifact(bundle.getLocation());
+                    installArtifact(bundle.getLocation().trim());
                 }
             }
             for (Conditional cond : feature.getConditional()) {
                 for (Bundle bundle : cond.getBundle()) {
                     if (!ignoreDependencyFlag || !bundle.isDependency()) {
-                        installArtifact(bundle.getLocation());
+                        installArtifact(bundle.getLocation().trim());
                     }
                 }
             }