You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by bf...@apache.org on 2014/05/15 06:09:15 UTC

svn commit: r1594767 - /oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolHandler.java

Author: bfoster
Date: Thu May 15 04:09:15 2014
New Revision: 1594767

URL: http://svn.apache.org/r1594767
Log:
- Check whether the rename succeeded and throw on failure

OODT-695

Modified:
    oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolHandler.java

Modified: oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolHandler.java
URL: http://svn.apache.org/viewvc/oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolHandler.java?rev=1594767&r1=1594766&r2=1594767&view=diff
==============================================================================
--- oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolHandler.java (original)
+++ oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolHandler.java Thu May 15 04:09:15 2014
@@ -28,8 +28,10 @@ import org.apache.oodt.cas.protocol.exce
 import org.apache.oodt.cas.protocol.util.ProtocolFileFilter;
 import org.apache.oodt.cas.pushpull.exceptions.RemoteConnectionException;
 
+
 //JDK imports
 import java.io.File;
+import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.HashMap;
@@ -254,7 +256,10 @@ public class ProtocolHandler {
       protocol.get(fromFile, downloadFile);
 
       // rename file back to original name
-      downloadFile.renameTo(toFile);
+      if (!downloadFile.renameTo(toFile)) {
+        throw new IOException(
+            String.format("Failed to rename file %s to %s", downloadFile, toFile));
+      }
 
       // delete file is specified
       if (delete) {