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 2017/06/28 18:30:12 UTC

karaf git commit: [KARAF-5229] The download manager may generate wrong jar with custom urls

Repository: karaf
Updated Branches:
  refs/heads/master fa13d830f -> 4f6af4eaa


[KARAF-5229] The download manager may generate wrong jar with custom urls

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

Branch: refs/heads/master
Commit: 4f6af4eaa2d7efa13461b19343525d90c5965cba
Parents: fa13d83
Author: Guillaume Nodet <gn...@apache.org>
Authored: Wed Jun 28 20:29:49 2017 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Wed Jun 28 20:29:49 2017 +0200

----------------------------------------------------------------------
 .../features/internal/download/impl/SimpleDownloadTask.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/4f6af4ea/features/core/src/main/java/org/apache/karaf/features/internal/download/impl/SimpleDownloadTask.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/download/impl/SimpleDownloadTask.java b/features/core/src/main/java/org/apache/karaf/features/internal/download/impl/SimpleDownloadTask.java
index 6e8c079..2dbf481 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/download/impl/SimpleDownloadTask.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/download/impl/SimpleDownloadTask.java
@@ -60,7 +60,7 @@ public class SimpleDownloadTask extends AbstractRetryableDownloadTask {
             }
 
             URL urlObj = new URL(url);
-            File file = new File(basePath, getFileName(urlObj.getFile()));
+            File file = new File(basePath, getFileName(urlObj));
             if (file.exists()) {
                 return file;
             }
@@ -92,14 +92,17 @@ public class SimpleDownloadTask extends AbstractRetryableDownloadTask {
     }
 
     // we only want the filename itself, not the whole path
-    private String getFileName(String url) {
+    private String getFileName(URL urlObj) {
+        String url = urlObj.getFile();
         // ENTESB-1394: we do not want all these decorators from wrap: protocol
         // or any inlined maven repos
         url = DownloadManagerHelper.stripUrl(url);
         url = DownloadManagerHelper.removeInlinedMavenRepositoryUrl(url);
         int unixPos = url.lastIndexOf('/');
         int windowsPos = url.lastIndexOf('\\');
-        return url.substring(Math.max(unixPos, windowsPos) + 1);
+        url = url.substring(Math.max(unixPos, windowsPos) + 1);
+        url = Integer.toHexString(urlObj.toString().hashCode()) + "-" + url;
+        return url;
     }
 
     protected File downloadBlueprintOrSpring() throws Exception {