You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by sb...@apache.org on 2015/10/23 23:18:37 UTC
incubator-streams git commit: resolves STREAMS-375
Repository: incubator-streams
Updated Branches:
refs/heads/STREAMS-375 [created] 00701411a
resolves STREAMS-375
Project: http://git-wip-us.apache.org/repos/asf/incubator-streams/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-streams/commit/00701411
Tree: http://git-wip-us.apache.org/repos/asf/incubator-streams/tree/00701411
Diff: http://git-wip-us.apache.org/repos/asf/incubator-streams/diff/00701411
Branch: refs/heads/STREAMS-375
Commit: 00701411a8c36710e2557bf5604c579a198184f1
Parents: 8154b04
Author: Steve Blackmon <sb...@apache.org>
Authored: Fri Oct 23 16:18:32 2015 -0500
Committer: Steve Blackmon <sb...@apache.org>
Committed: Fri Oct 23 16:18:32 2015 -0500
----------------------------------------------------------------------
.../twitter/provider/TwitterErrorHandler.java | 15 ++++++++++++++-
.../provider/TwitterFollowingProviderTask.java | 2 +-
.../provider/TwitterTimelineProviderTask.java | 4 ++--
3 files changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/00701411/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterErrorHandler.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterErrorHandler.java b/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterErrorHandler.java
index 448f6ae..7f515ee 100644
--- a/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterErrorHandler.java
+++ b/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterErrorHandler.java
@@ -33,7 +33,12 @@ public class TwitterErrorHandler
// selected because 3 * 5 + n >= 15 for positive n
protected static final long retry = 3*60*1000;
- public static int handleTwitterError(Twitter twitter, Exception exception)
+ @Deprecated
+ public static int handleTwitterError(Twitter twitter, Exception exception) {
+ return handleTwitterError( twitter, null, exception);
+ }
+
+ public static int handleTwitterError(Twitter twitter, Long id, Exception exception)
{
if(exception instanceof TwitterException)
{
@@ -78,6 +83,14 @@ public class TwitterErrorHandler
// This is a known weird issue, not exactly sure the cause, but you'll never be able to get the data.
return 5;
}
+ else if(e.getExceptionCode().equals("4be80492-0a7bf7c7")) {
+ // This is a 401 reflecting credentials don't have access to the requested resource.
+ if( id != null )
+ LOGGER.warn("Authentication Exception accessing id: {}", id);
+ else
+ LOGGER.warn("Authentication Exception");
+ return 5;
+ }
else
{
LOGGER.warn("Unknown Twitter Exception...");
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/00701411/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterFollowingProviderTask.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterFollowingProviderTask.java b/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterFollowingProviderTask.java
index e298827..5397757 100644
--- a/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterFollowingProviderTask.java
+++ b/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterFollowingProviderTask.java
@@ -208,7 +208,7 @@ public class TwitterFollowingProviderTask implements Runnable {
else break;
}
catch(TwitterException twitterException) {
- keepTrying += TwitterErrorHandler.handleTwitterError(client, twitterException);
+ keepTrying += TwitterErrorHandler.handleTwitterError(client, id, twitterException);
}
catch(Exception e) {
keepTrying += TwitterErrorHandler.handleTwitterError(client, e);
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/00701411/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterTimelineProviderTask.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterTimelineProviderTask.java b/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterTimelineProviderTask.java
index bbd0dee..adc37ca 100644
--- a/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterTimelineProviderTask.java
+++ b/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterTimelineProviderTask.java
@@ -81,10 +81,10 @@ public class TwitterTimelineProviderTask implements Runnable {
keepTrying = 10;
}
catch(TwitterException twitterException) {
- keepTrying += TwitterErrorHandler.handleTwitterError(client, twitterException);
+ keepTrying += TwitterErrorHandler.handleTwitterError(client, id, twitterException);
}
catch(Exception e) {
- keepTrying += TwitterErrorHandler.handleTwitterError(client, e);
+ keepTrying += TwitterErrorHandler.handleTwitterError(client, id, e);
}
}
}