You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2016/09/21 07:39:53 UTC

[1/2] camel git commit: check for null

Repository: camel
Updated Branches:
  refs/heads/master 011e4ec57 -> 246c45043


check for null


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

Branch: refs/heads/master
Commit: 246c450439eca8adcb079361af245aadd92be42b
Parents: c6a331c
Author: Alexander Friedrichs <un...@users.noreply.github.com>
Authored: Wed Sep 21 09:23:02 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Wed Sep 21 09:38:11 2016 +0200

----------------------------------------------------------------------
 .../org/apache/camel/component/dropbox/DropboxComponent.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/246c4504/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/DropboxComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/DropboxComponent.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/DropboxComponent.java
index fdad2c2..a2b9723 100755
--- a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/DropboxComponent.java
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/DropboxComponent.java
@@ -50,7 +50,10 @@ public class DropboxComponent extends UriEndpointComponent {
         // set options from component
         configuration.setAccessToken((String)parameters.get("accessToken"));
         configuration.setLocalPath((String)parameters.get("localPath"));
-        configuration.setRemotePath(((String)parameters.get("remotePath")).replaceAll("\\s","+"));
+        configuration.setRemotePath(
+                parameters.get("remotePath") != null
+                    ? ((String) parameters.get("remotePath")).replaceAll("\\s", "+")
+                    : null);
         configuration.setNewRemotePath((String)parameters.get("newRemotePath"));
         configuration.setQuery((String)parameters.get("query"));
         configuration.setOperation(DropboxOperation.valueOf(remaining));


[2/2] camel git commit: Handle whitespaces in remotePath

Posted by ac...@apache.org.
Handle whitespaces in remotePath


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

Branch: refs/heads/master
Commit: c6a331c2059c8f94a5a3cc46fca677babbad6998
Parents: 011e4ec
Author: Alexander Friedrichs <un...@users.noreply.github.com>
Authored: Wed Sep 21 08:03:12 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Wed Sep 21 09:38:11 2016 +0200

----------------------------------------------------------------------
 .../component/dropbox/DropboxComponent.java      |  2 +-
 .../component/dropbox/DropboxConsumerTest.java   | 19 +++++++++++++++----
 2 files changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c6a331c2/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/DropboxComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/DropboxComponent.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/DropboxComponent.java
index 9403864..fdad2c2 100755
--- a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/DropboxComponent.java
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/DropboxComponent.java
@@ -50,7 +50,7 @@ public class DropboxComponent extends UriEndpointComponent {
         // set options from component
         configuration.setAccessToken((String)parameters.get("accessToken"));
         configuration.setLocalPath((String)parameters.get("localPath"));
-        configuration.setRemotePath((String)parameters.get("remotePath"));
+        configuration.setRemotePath(((String)parameters.get("remotePath")).replaceAll("\\s","+"));
         configuration.setNewRemotePath((String)parameters.get("newRemotePath"));
         configuration.setQuery((String)parameters.get("query"));
         configuration.setOperation(DropboxOperation.valueOf(remaining));

http://git-wip-us.apache.org/repos/asf/camel/blob/c6a331c2/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/DropboxConsumerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/DropboxConsumerTest.java b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/DropboxConsumerTest.java
index 8ae984a..646a6ea 100644
--- a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/DropboxConsumerTest.java
+++ b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/DropboxConsumerTest.java
@@ -34,7 +34,9 @@ public class DropboxConsumerTest extends DropboxTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("dropbox://get?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&remotePath=/path").to("mock:test");
+                from("dropbox://get?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&remotePath=/path").to("mock:test1");
+                
+                from("dropbox://get?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&remotePath=/path with spaces/file").to("mock:test2");
             }
         };
     }
@@ -42,13 +44,22 @@ public class DropboxConsumerTest extends DropboxTestSupport {
     @Test
     public void shouldCreateGetConsumer() throws Exception {
         // Given
-        Endpoint dropboxEndpoint = context.getEndpoint("dropbox://get?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&remotePath=/path");
+        Endpoint dropboxEndpoint1 = context.getEndpoint("dropbox://get?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&remotePath=/path");
 
         // When
-        Consumer consumer = dropboxEndpoint.createConsumer(null);
+        Consumer consumer1 = dropboxEndpoint1.createConsumer(null);
 
         // Then
-        Assert.assertTrue(consumer instanceof DropboxScheduledPollGetConsumer);
+        Assert.assertTrue(consumer1 instanceof DropboxScheduledPollGetConsumer);
+        
+        // Given
+        Endpoint dropboxEndpoint2 = context.getEndpoint("dropbox://get?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&remotePath=/path with spaces/file");
+
+        // When
+        Consumer consumer2 = dropboxEndpoint2.createConsumer(null);
+
+        // Then
+        Assert.assertTrue(consumer2 instanceof DropboxScheduledPollGetConsumer);
     }
 
 }
\ No newline at end of file