cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [1/2] git commit: updated refs/heads/master to 2cd789e
Date Mon, 02 Nov 2015 19:22:34 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 7f1326c21 -> 2cd789e93


Use java.io.tmpdir instead of hardcoded /tmp

This was submitted earlier in PR #884 but that did not merge
properly.

This is a new PR with the same change.


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

Branch: refs/heads/master
Commit: ea92fc15ce2084ef701bf1af7069b6a7ec7013da
Parents: 901d47c
Author: Wido den Hollander <wido@widodh.nl>
Authored: Fri Oct 30 14:19:38 2015 +0100
Committer: Wido den Hollander <wido@widodh.nl>
Committed: Sat Oct 31 12:03:11 2015 +0100

----------------------------------------------------------------------
 .../com/cloud/storage/template/LocalTemplateDownloader.java    | 2 +-
 .../cloud/storage/template/LocalTemplateDownloaderTest.java    | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ea92fc15/core/src/com/cloud/storage/template/LocalTemplateDownloader.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/template/LocalTemplateDownloader.java b/core/src/com/cloud/storage/template/LocalTemplateDownloader.java
index 3d33a21..564eba3 100644
--- a/core/src/com/cloud/storage/template/LocalTemplateDownloader.java
+++ b/core/src/com/cloud/storage/template/LocalTemplateDownloader.java
@@ -38,7 +38,7 @@ public class LocalTemplateDownloader extends TemplateDownloaderBase implements
T
 
     public LocalTemplateDownloader(StorageLayer storageLayer, String downloadUrl, String
toDir, long maxTemplateSizeInBytes, DownloadCompleteCallback callback) {
         super(storageLayer, downloadUrl, toDir, maxTemplateSizeInBytes, callback);
-        String filename = downloadUrl.substring(downloadUrl.lastIndexOf(File.separator));
+        String filename = new File(downloadUrl).getName();
         _toFile = toDir.endsWith(File.separator) ? (toDir + filename) : (toDir + File.separator
+ filename);
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ea92fc15/core/test/com/cloud/storage/template/LocalTemplateDownloaderTest.java
----------------------------------------------------------------------
diff --git a/core/test/com/cloud/storage/template/LocalTemplateDownloaderTest.java b/core/test/com/cloud/storage/template/LocalTemplateDownloaderTest.java
index 74d1adc..0a5d2f6 100644
--- a/core/test/com/cloud/storage/template/LocalTemplateDownloaderTest.java
+++ b/core/test/com/cloud/storage/template/LocalTemplateDownloaderTest.java
@@ -29,9 +29,9 @@ import org.junit.Test;
 public class LocalTemplateDownloaderTest {
 
     @Test
-    public void localTemplateDownloaderTest() {
-        String url =  "file://" + new File("pom.xml").getAbsolutePath();
-        TemplateDownloader td = new LocalTemplateDownloader(null, url, "/tmp", TemplateDownloader.DEFAULT_MAX_TEMPLATE_SIZE_IN_BYTES,
null);
+    public void localTemplateDownloaderTest() throws Exception {
+        String url = new File("pom.xml").toURI().toURL().toString();
+        TemplateDownloader td = new LocalTemplateDownloader(null, url, System.getProperty("java.io.tmpdir"),
TemplateDownloader.DEFAULT_MAX_TEMPLATE_SIZE_IN_BYTES, null);
         long bytes = td.download(true, null);
         if (!(bytes > 0)) {
             fail("Failed download");


Mime
View raw message