streams-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From steveblackmon <...@git.apache.org>
Subject [GitHub] incubator-streams pull request: resolves STREAMS-371
Date Mon, 19 Oct 2015 19:29:57 GMT
Github user steveblackmon commented on a diff in the pull request:

    https://github.com/apache/incubator-streams/pull/263#discussion_r42414929
  
    --- Diff: streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterFollowingProviderTask.java
---
    @@ -144,6 +165,57 @@ else if( endpoint.equals("friends") )
             } while (curser != 0 && keepTrying < 10);
         }
     
    +    private void collectIds(Long id) {
    +        int keepTrying = 0;
    +
    +        long curser = -1;
    +
    +        do
    +        {
    +            try
    +            {
    +                twitter4j.IDs ids = null;
    +                if( endpoint.equals("followers") )
    +                    ids = client.friendsFollowers().getFollowersIDs(id.longValue(), curser,
max_per_page);
    +                else if( endpoint.equals("friends") )
    +                    ids = client.friendsFollowers().getFriendsIDs(id.longValue(), curser,
max_per_page);
    +
    +                Preconditions.checkNotNull(ids);
    +                Preconditions.checkArgument(ids.getIDs().length > 0);
    +
    +                for (long otherId : ids.getIDs()) {
    +
    +                    try {
    +                        Follow follow;
    +                        if( endpoint.equals("followers") ) {
    +                            follow = new Follow()
    +                                    .withFollowee(new User().withId(id))
    +                                    .withFollower(new User().withId(otherId));
    +                        } else if( endpoint.equals("friends") ) {
    +                            follow = new Follow()
    +                                    .withFollowee(new User().withId(otherId))
    +                                    .withFollower(new User().withId(id));
    +                        } else {
    +                            throw new Exception("endpoint must be set to 'friends' or
'followers'");
    --- End diff --
    
    the precondition was already being checked, just outside the method where the compiler
couldn't trace.  changed to a not null precondition here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message