Repository: camel
Updated Branches:
  refs/heads/master bba267737 -> f73d1b888


CAMEL-11680: Camel-dropbox should support Put not only from localPath


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

Branch: refs/heads/master
Commit: f73d1b88865444ef9ca991735126342bef23021d
Parents: bba2677
Author: Claus Ibsen <davscl...@apache.org>
Authored: Fri Sep 8 09:03:25 2017 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Fri Sep 8 09:03:25 2017 +0200

----------------------------------------------------------------------
 .../camel/component/dropbox/core/DropboxAPIFacade.java | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f73d1b88/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/core/DropboxAPIFacade.java
----------------------------------------------------------------------
diff --git 
a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/core/DropboxAPIFacade.java
 
b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/core/DropboxAPIFacade.java
index 4daf08f..c6a1739 100755
--- 
a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/core/DropboxAPIFacade.java
+++ 
b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/core/DropboxAPIFacade.java
@@ -43,6 +43,7 @@ import 
org.apache.camel.component.dropbox.util.DropboxException;
 import org.apache.camel.component.dropbox.util.DropboxResultCode;
 import org.apache.camel.component.dropbox.util.DropboxUploadMode;
 import org.apache.camel.converter.stream.OutputStreamBuilder;
+import org.apache.camel.util.IOHelper;
 import org.apache.commons.io.FileUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -51,13 +52,12 @@ import static 
org.apache.camel.component.dropbox.util.DropboxConstants.HEADER_PU
 
 public final class DropboxAPIFacade {
 
-    private static final transient Logger LOG = 
LoggerFactory.getLogger(DropboxAPIFacade.class);
+    private static final Logger LOG = 
LoggerFactory.getLogger(DropboxAPIFacade.class);
 
     private final DbxClient client;
 
     private final Exchange exchange;
 
-
     /**
      * @param client the DbxClient performing dropbox low level operations
      * @param exchange the current Exchange
@@ -181,10 +181,6 @@ public final class DropboxAPIFacade {
             name = exchange.getIn().getMessageId();
         }
 
-        //check if dropbox file exists
-        if (entry != null && !entry.isFile()) {
-            throw new DropboxException(dropboxPath + " exists on dropbox and 
is not a file!");
-        }
         //in case the entry not exists on dropbox check if the filename should 
be appended
         if (entry == null) {
             if (dropboxPath.endsWith(DropboxConstants.DROPBOX_FILE_SEPARATOR)) 
{
@@ -206,7 +202,6 @@ public final class DropboxAPIFacade {
             result = new DropboxFileUploadResult(dropboxPath, 
DropboxResultCode.KO);
         }
         return result;
-
     }
 
     private DbxEntry.File putSingleFile(File inputFile, String dropboxPath, 
DropboxUploadMode mode) throws Exception {
@@ -222,7 +217,7 @@ public final class DropboxAPIFacade {
             uploadedFile = client.uploadFile(dropboxPath, uploadMode, 
inputFile.length(), inputStream);
             return uploadedFile;
         } finally {
-            inputStream.close();
+            IOHelper.close(inputStream);
         }
     }
 
@@ -240,7 +235,7 @@ public final class DropboxAPIFacade {
             uploadedFile = client.uploadFile(dropboxPath, uploadMode, 
data.length, is);
             return uploadedFile;
         } finally {
-            is.close();
+            IOHelper.close(is);
         }
     }
 

Reply via email to