From 4dba0ebe17b7e0622b24a2171fb7237889fba3f2 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Fri, 22 Feb 2013 16:06:34 +0100 Subject: Update the way to download plugins when url is a file --- .../src/main/java/org/sonar/server/plugins/PluginDownloader.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/PluginDownloader.java b/sonar-server/src/main/java/org/sonar/server/plugins/PluginDownloader.java index 5658de4e291..dfa56028aa3 100644 --- a/sonar-server/src/main/java/org/sonar/server/plugins/PluginDownloader.java +++ b/sonar-server/src/main/java/org/sonar/server/plugins/PluginDownloader.java @@ -95,13 +95,12 @@ public class PluginDownloader implements ServerComponent { private void downloadRelease(Release release) throws URISyntaxException, IOException { String url = release.getDownloadUrl(); + URI uri = new URI(url); if (!url.startsWith("file:")) { - URI uri = new URI(url); String filename = StringUtils.substringAfterLast(uri.getPath(), "/"); downloader.download(uri, new File(downloadDir, filename)); } else { - String filePath = url.replaceFirst("file:", ""); - File file = new File(filePath); + File file = FileUtils.toFile(uri.toURL()); FileUtils.copyFileToDirectory(file, downloadDir); } } -- cgit v1.2.3