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

karaf git commit: [KARAF-3813] Fix assembly problems with feature repositories copied from kars

Repository: karaf
Updated Branches:
  refs/heads/master 96f9b6c25 -> 98b83da57


[KARAF-3813] Fix assembly problems with feature repositories copied from kars

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

Branch: refs/heads/master
Commit: 98b83da5738f078759c54f89decaed1a4c8ce79c
Parents: 96f9b6c
Author: Guillaume Nodet <gn...@apache.org>
Authored: Wed Jul 8 18:40:01 2015 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Wed Jul 8 18:40:01 2015 +0200

----------------------------------------------------------------------
 .../apache/karaf/profile/assembly/Builder.java    | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/98b83da5/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java b/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
index 53eb178..ce2e495 100644
--- a/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
+++ b/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
@@ -963,7 +963,7 @@ public class Builder {
                     if (Blacklist.isBundleBlacklisted(blacklistedBundles, uri)) {
                         throw new RuntimeException("Bundle " + uri + " is blacklisted");
                     }
-                    Path path = systemDirectory.resolve(Parser.pathFromMaven(uri));
+                    Path path = systemDirectory.resolve(pathFromProviderUrl(uri));
                     synchronized (provider) {
                         Files.createDirectories(path.getParent());
                         Files.copy(provider.getFile().toPath(), path, StandardCopyOption.REPLACE_EXISTING);
@@ -1037,7 +1037,7 @@ public class Builder {
                 public void downloaded(final StreamProvider provider) throws Exception {
                     if (install) {
                         synchronized (provider) {
-                            Path path = systemDirectory.resolve(Parser.pathFromMaven(provider.getUrl()));
+                            Path path = systemDirectory.resolve(pathFromProviderUrl(provider.getUrl()));
                             Files.createDirectories(path.getParent());
                             Files.copy(provider.getFile().toPath(), path, StandardCopyOption.REPLACE_EXISTING);
                         }
@@ -1188,4 +1188,18 @@ public class Builder {
         throw new IllegalArgumentException("Resource " + provider.getUrl() + " does not contain a manifest");
     }
 
+    private static String pathFromProviderUrl(String url) throws MalformedURLException {
+        String pathString;
+        if (url.startsWith("file:")) {
+            pathString = url.substring("file:".length());
+        }
+        else if (url.startsWith("mvn:")) {
+            pathString = Parser.pathFromMaven(url);
+        }
+        else {
+            pathString = url;
+        }
+        return pathString;
+    }
+
 }