You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ga...@apache.org on 2016/02/05 09:54:26 UTC

jclouds git commit: Always delete tmpFile in filesystem putBlob

Repository: jclouds
Updated Branches:
  refs/heads/master 9feeee834 -> 6cefc99cf


Always delete tmpFile in filesystem putBlob

Previously we would only do this on the exceptional path.  Also throw
IOException on failed rename for consistency.


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

Branch: refs/heads/master
Commit: 6cefc99cf03d4609a53946f01675ce8f1f6e36dd
Parents: 9feeee8
Author: Andrew Gaul <ga...@apache.org>
Authored: Fri Feb 5 00:50:35 2016 -0800
Committer: Andrew Gaul <ga...@apache.org>
Committed: Fri Feb 5 00:52:37 2016 -0800

----------------------------------------------------------------------
 .../strategy/internal/FilesystemStorageStrategyImpl.java       | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/6cefc99c/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
----------------------------------------------------------------------
diff --git a/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java b/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
index 644159f..f67c5aa 100644
--- a/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
+++ b/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
@@ -494,11 +494,11 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
          setBlobAccess(containerName, tmpBlobName, BlobAccess.PRIVATE);
 
          if (!tmpFile.renameTo(outputFile)) {
-            throw new RuntimeException("Could not rename file " + tmpFile + " to " + outputFile);
+            throw new IOException("Could not rename file " + tmpFile + " to " + outputFile);
          }
 
          return base16().lowerCase().encode(actualHashCode.asBytes());
-      } catch (IOException ex) {
+      } finally {
          if (tmpFile != null) {
             try {
                delete(tmpFile);
@@ -506,8 +506,6 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
                logger.debug("Could not delete %s: %s", tmpFile, e);
             }
          }
-         throw ex;
-      } finally {
          closeQuietly(his);
          if (payload != null) {
             payload.release();