You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by mf...@apache.org on 2014/05/12 21:54:17 UTC
[5/9] git commit: While running this,
I found a null bug that prevented the flag for "wasRedirected" to
never be set. This corrects that issue.
While running this, I found a null bug that prevented the flag for "wasRedirected" to never be set. This corrects that issue.
Project: http://git-wip-us.apache.org/repos/asf/incubator-streams/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-streams/commit/d2a8aa04
Tree: http://git-wip-us.apache.org/repos/asf/incubator-streams/tree/d2a8aa04
Diff: http://git-wip-us.apache.org/repos/asf/incubator-streams/diff/d2a8aa04
Branch: refs/heads/master
Commit: d2a8aa046dc01e4105aa436cbd1cf38ef960e75b
Parents: 9681392
Author: Matthew Hager <Ma...@gmail.com>
Authored: Thu May 8 22:51:46 2014 -0500
Committer: Matthew Hager <Ma...@gmail.com>
Committed: Thu May 8 22:51:46 2014 -0500
----------------------------------------------------------------------
.../main/java/org/apache/streams/urls/LinkResolver.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/d2a8aa04/streams-contrib/streams-processor-urls/src/main/java/org/apache/streams/urls/LinkResolver.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-processor-urls/src/main/java/org/apache/streams/urls/LinkResolver.java b/streams-contrib/streams-processor-urls/src/main/java/org/apache/streams/urls/LinkResolver.java
index f42342b..358eebd 100644
--- a/streams-contrib/streams-processor-urls/src/main/java/org/apache/streams/urls/LinkResolver.java
+++ b/streams-contrib/streams-processor-urls/src/main/java/org/apache/streams/urls/LinkResolver.java
@@ -107,12 +107,16 @@ public class LinkResolver implements Serializable {
Preconditions.checkNotNull(linkDetails.getOriginalURL());
linkDetails.setStartTime(DateTime.now());
- // we are going to try three times just incase we catch the service off-guard
- // this is mainly to help us with our tests.
- for (int i = 0; (i < 3) && linkDetails.getFinalURL() == null; i++) {
+
+ // we are going to try three times just in case we catch a slow server or one that needs
+ // to be warmed up. This tends to happen many times with smaller private servers
+ for (int i = 0; (i < 3) && linkDetails.getFinalURL() == null; i++)
if (linkDetails.getLinkStatus() != LinkDetails.LinkStatus.SUCCESS)
unwindLink(linkDetails.getOriginalURL());
- }
+
+ // because this is a POJO we need to make sure that we set this to false if it was never re-directed
+ if(this.linkDetails.getRedirectCount() == 0 || this.linkDetails.getRedirected() == null)
+ this.linkDetails.setRedirected(false);
linkDetails.setFinalURL(cleanURL(linkDetails.getFinalURL()));
linkDetails.setNormalizedURL(normalizeURL(linkDetails.getFinalURL()));