You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2013/10/09 06:27:20 UTC

[4/8] git commit: CAMEL-6839 Fixed the issue that Facebook endpoint incorrectly sets the nameStyle field to GET_AND_SEARCH even when no search* candidate methods are found with thanks to Dhiraj

CAMEL-6839 Fixed the issue that Facebook endpoint incorrectly sets the nameStyle field to GET_AND_SEARCH even when no search* candidate methods are found with thanks to Dhiraj


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

Branch: refs/heads/camel-2.12.x
Commit: 47742fbb4020367c09380f6a6d172c1be10342c1
Parents: 5b87e18
Author: Willem Jiang <ni...@apache.org>
Authored: Wed Oct 9 11:33:44 2013 +0800
Committer: Willem Jiang <ni...@apache.org>
Committed: Wed Oct 9 11:55:17 2013 +0800

----------------------------------------------------------------------
 .../camel/component/facebook/FacebookEndpoint.java      | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/47742fbb/components/camel-facebook/src/main/java/org/apache/camel/component/facebook/FacebookEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-facebook/src/main/java/org/apache/camel/component/facebook/FacebookEndpoint.java b/components/camel-facebook/src/main/java/org/apache/camel/component/facebook/FacebookEndpoint.java
index 02e9245..da2b0a7 100644
--- a/components/camel-facebook/src/main/java/org/apache/camel/component/facebook/FacebookEndpoint.java
+++ b/components/camel-facebook/src/main/java/org/apache/camel/component/facebook/FacebookEndpoint.java
@@ -16,7 +16,13 @@
  */
 package org.apache.camel.component.facebook;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
@@ -31,7 +37,6 @@ import org.apache.camel.util.EndpointHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import static org.apache.camel.component.facebook.data.FacebookMethodsTypeHelper.convertToGetMethod;
 import static org.apache.camel.component.facebook.data.FacebookMethodsTypeHelper.convertToSearchMethod;
 import static org.apache.camel.component.facebook.data.FacebookMethodsTypeHelper.getCandidateMethods;
@@ -135,6 +140,7 @@ public class FacebookEndpoint extends DefaultEndpoint implements FacebookConstan
                 this.nameStyle = FacebookNameStyle.GET;
             }
 
+            int nGetMethods = candidates.size();
             candidates.addAll(getCandidateMethods(convertToSearchMethod(methodName), argNames));
             // error if there are no candidates
             if (candidates.isEmpty()) {
@@ -145,7 +151,7 @@ public class FacebookEndpoint extends DefaultEndpoint implements FacebookConstan
             if (nameStyle == null) {
                 // no get* methods found
                 nameStyle = FacebookNameStyle.SEARCH;
-            } else {
+            } else if (candidates.size() > nGetMethods) {
                 // get* and search* methods found
                 nameStyle = FacebookNameStyle.GET_AND_SEARCH;
             }