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/10 09:31:51 UTC
[2/2] git commit: CAMEL-6847 Fixed the FacebookConsumer decoding
issue with thanks to Dhiraj
CAMEL-6847 Fixed the FacebookConsumer decoding issue 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/76cdbd87
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/76cdbd87
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/76cdbd87
Branch: refs/heads/camel-2.12.x
Commit: 76cdbd87eba442a7e33509c7dcd3d2b63d85aee1
Parents: ba784ad
Author: Willem Jiang <ni...@apache.org>
Authored: Thu Oct 10 15:14:56 2013 +0800
Committer: Willem Jiang <ni...@apache.org>
Committed: Thu Oct 10 15:22:03 2013 +0800
----------------------------------------------------------------------
.../camel/component/facebook/FacebookConsumer.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/76cdbd87/components/camel-facebook/src/main/java/org/apache/camel/component/facebook/FacebookConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-facebook/src/main/java/org/apache/camel/component/facebook/FacebookConsumer.java b/components/camel-facebook/src/main/java/org/apache/camel/component/facebook/FacebookConsumer.java
index 78c4764..3f438fe 100644
--- a/components/camel-facebook/src/main/java/org/apache/camel/component/facebook/FacebookConsumer.java
+++ b/components/camel-facebook/src/main/java/org/apache/camel/component/facebook/FacebookConsumer.java
@@ -16,7 +16,9 @@
*/
package org.apache.camel.component.facebook;
+import java.io.UnsupportedEncodingException;
import java.lang.reflect.Array;
+import java.net.URLDecoder;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Collections;
@@ -33,6 +35,7 @@ import facebook4j.Reading;
import facebook4j.json.DataObjectFactory;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
+import org.apache.camel.RuntimeCamelException;
import org.apache.camel.component.facebook.data.FacebookMethodsType;
import org.apache.camel.component.facebook.data.FacebookMethodsTypeHelper.MatchType;
import org.apache.camel.component.facebook.data.FacebookPropertiesHelper;
@@ -41,7 +44,6 @@ import org.apache.camel.impl.ScheduledPollConsumer;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import static org.apache.camel.component.facebook.FacebookConstants.FACEBOOK_DATE_FORMAT;
import static org.apache.camel.component.facebook.FacebookConstants.READING_PPROPERTY;
import static org.apache.camel.component.facebook.FacebookConstants.READING_PREFIX;
@@ -87,7 +89,13 @@ public class FacebookConsumer extends ScheduledPollConsumer {
if (endIndex == -1) {
endIndex = queryString.length();
}
- this.sinceTime = queryString.substring(startIndex, endIndex).replaceAll("%3(a|A)", ":");
+ final String strSince = queryString.substring(startIndex, endIndex);
+ try {
+ this.sinceTime = URLDecoder.decode(strSince, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeCamelException(String.format("Error decoding %s.since with value %s due to: %s"
+ , READING_PREFIX, strSince, e.getMessage()), e);
+ }
LOG.debug("Using supplied property {}since value {}", READING_PREFIX, this.sinceTime);
}
if (queryString.contains("until=")) {