Source:
protected void getFollowing(Long id) { Preconditions.checkArgument(endpoint.equals("friends") || endpoint.equals("followers")); int keepTrying = 0; long curser = -1; do { try { twitter4j.User followee4j; String followeeJson; try { followee4j = client.users().showUser(id); followeeJson = TwitterObjectFactory.getRawJSON(followee4j); } catch (TwitterException e) { LOGGER.error("Failure looking up " + id); break; } PagableResponseList<twitter4j.User> list = null; if( endpoint.equals("followers") ) list = client.friendsFollowers().getFollowersList(id.longValue(), curser, max_per_page); else if( endpoint.equals("friends") ) list = client.friendsFollowers().getFriendsList(id.longValue(), curser, max_per_page); Preconditions.checkNotNull(list); Preconditions.checkArgument(list.size() > 0); for (twitter4j.User follower4j : list) { String followerJson = TwitterObjectFactory.getRawJSON(follower4j); try { Follow follow = new Follow() .withFollowee(mapper.readValue(followeeJson, User.class)) .withFollower(mapper.readValue(followerJson, User.class)); ComponentUtils.offerUntilSuccess(new StreamsDatum(follow), provider.providerQueue); } catch (JsonParseException e) { LOGGER.warn(e.getMessage()); } catch (JsonMappingException e) { LOGGER.warn(e.getMessage()); } catch (IOException e) { LOGGER.warn(e.getMessage()); } } if( list.size() == max_per_page ) curser = list.getNextCursor(); else break; } catch(TwitterException twitterException) { keepTrying += TwitterErrorHandler.handleTwitterError(client, twitterException); } catch(Exception e) { keepTrying += TwitterErrorHandler.handleTwitterError(client, e); } } while (curser != 0 && keepTrying < 50); }

Target:
protected void getFollowing(Long id) { Preconditions.checkArgument(endpoint.equals("friends") || endpoint.equals("followers")); int keepTrying = 0; long curser = -1; do { try { twitter4j.User followee4j; String followeeJson; try { followee4j = client.users().showUser(id); followeeJson = TwitterObjectFactory.getRawJSON(followee4j); } catch (TwitterException e) { LOGGER.error("Failure looking up " + id); break; } PagableResponseList<twitter4j.User> list = null; if( endpoint.equals("followers") ) list = client.friendsFollowers().getFollowersList(id.longValue(), curser, max_per_page); else if( endpoint.equals("friends") ) list = client.friendsFollowers().getFriendsList(id.longValue(), curser, max_per_page); Preconditions.checkNotNull(list); Preconditions.checkArgument(list.size() > 0); for (twitter4j.User follower4j : list) { String followerJson = TwitterObjectFactory.getRawJSON(follower4j); try { Follow follow = new Follow() .withFollowee(mapper.readValue(followeeJson, User.class)) .withFollower(mapper.readValue(followerJson, User.class)); ComponentUtils.offerUntilSuccess(new StreamsDatum(follow), provider.providerQueue); } catch (JsonParseException e) { LOGGER.warn(e.getMessage()); } catch (JsonMappingException e) { LOGGER.warn(e.getMessage()); } catch (IOException e) { LOGGER.warn(e.getMessage()); } } if( list.size() == max_per_page ) curser = list.getNextCursor(); else break; } catch(TwitterException twitterException) { keepTrying += TwitterErrorHandler.handleTwitterError(client, twitterException); } catch(Exception e) { keepTrying += TwitterErrorHandler.handleTwitterError(client, e); } } while (curser != 0 && keepTrying < 10); }