Repository: jclouds
Updated Branches:
  refs/heads/master ee89c253b -> fc14dce5c


Avoid creating temporary files via relative paths

This avoids creating junk in the source directory.


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

Branch: refs/heads/master
Commit: fc14dce5ce0194c4a73df5f88982731b6e092709
Parents: ee89c25
Author: Andrew Gaul <[email protected]>
Authored: Mon Nov 7 10:43:32 2016 -0800
Committer: Andrew Gaul <[email protected]>
Committed: Tue Nov 15 20:28:31 2016 -0800

----------------------------------------------------------------------
 .../swift/v1/blobstore/RegionScopedSwiftBlobStore.java      | 2 +-
 .../RegionScopedSwiftBlobStoreParallelLiveTest.java         | 9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/fc14dce5/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/blobstore/RegionScopedSwiftBlobStore.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/blobstore/RegionScopedSwiftBlobStore.java
 
b/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/blobstore/RegionScopedSwiftBlobStore.java
index 66dd818..91d70c3 100644
--- 
a/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/blobstore/RegionScopedSwiftBlobStore.java
+++ 
b/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/blobstore/RegionScopedSwiftBlobStore.java
@@ -679,7 +679,7 @@ public class RegionScopedSwiftBlobStore implements 
BlobStore {
 
       ListeningExecutorService listeningExecutor = 
MoreExecutors.listeningDecorator(executor);
       RandomAccessFile raf = null;
-      File tempFile = new File(destination.getName() + "." + 
UUID.randomUUID());
+      File tempFile = new File(destination + "." + UUID.randomUUID());
       try {
          long contentLength = api
                .getObjectApi(regionId, container)

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fc14dce5/apis/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/blobstore/RegionScopedSwiftBlobStoreParallelLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/blobstore/RegionScopedSwiftBlobStoreParallelLiveTest.java
 
b/apis/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/blobstore/RegionScopedSwiftBlobStoreParallelLiveTest.java
index 50e3ea9..7a99121 100644
--- 
a/apis/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/blobstore/RegionScopedSwiftBlobStoreParallelLiveTest.java
+++ 
b/apis/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/blobstore/RegionScopedSwiftBlobStoreParallelLiveTest.java
@@ -56,7 +56,7 @@ import com.google.common.util.concurrent.MoreExecutors;
 @Test(groups = "live", singleThreaded = true)
 public class RegionScopedSwiftBlobStoreParallelLiveTest extends 
BaseBlobStoreIntegrationTest {
 
-   private final File BIG_FILE = new File("random.dat");
+   private final File BIG_FILE;
    private final long SIZE = 10 * 1000 * 1000;
    private BlobStore blobStore;
    private String ETAG;
@@ -71,6 +71,11 @@ public class RegionScopedSwiftBlobStoreParallelLiveTest 
extends BaseBlobStoreInt
 
    public RegionScopedSwiftBlobStoreParallelLiveTest() {
       provider = "openstack-swift";
+      try {
+         BIG_FILE = File.createTempFile("random", "dat");
+      } catch (IOException ioe) {
+         throw new RuntimeException(ioe);
+      }
    }
 
    // Override as needed for the right region
@@ -121,7 +126,7 @@ public class RegionScopedSwiftBlobStoreParallelLiveTest 
extends BaseBlobStoreInt
 
    @Test(dependsOnMethods = "uploadMultipartBlob", singleThreaded = true)
    public void downloadParallelBlob() throws IOException {
-      final File downloadedFile = new File(BIG_FILE.getName() + ".downloaded");
+      final File downloadedFile = new File(BIG_FILE + ".downloaded");
       blobStore.downloadBlob(CONTAINER, BIG_FILE.getName(), downloadedFile, 
executor);
       String eTag = Files.hash(downloadedFile, Hashing.md5()).toString();
       assertEquals(eTag, ETAG);

Reply via email to