protected synchronized void received(int responseCode,String stream,String json){
  FollowerInfo result=parseFollowers(stream,json);
  if (result != null) {
    noError(stream);
    cached.put(stream,result);
    if (type == Follower.Type.FOLLOWER) {
      listener.receivedFollowers(result);
      if (hasNewFollowers(result.followers)) {
        listener.newFollowers(result);
      }
    }
 else     if (type == Follower.Type.SUBSCRIBER) {
      listener.receivedSubscribers(result);
    }
    requested.add(stream);
  }
 else {
    String errorMessage="";
    if (responseCode == 404) {
      errorMessage="Channel not found.";
      error(stream,10);
    }
 else     if (responseCode == 200) {
      errorMessage="Parse error.";
      error(stream,1);
    }
 else     if (responseCode == 401 || responseCode == 403) {
      errorMessage="Access denied.";
      error(stream,1);
    }
 else     if (responseCode == 422) {
      errorMessage="No data for this channel.";
      error(stream,10);
    }
 else {
      errorMessage="Request error.";
      error(stream,1);
    }
    FollowerInfo errorResult=new FollowerInfo(type,stream,errorMessage);
    cached.put(stream,errorResult);
    if (type == Follower.Type.FOLLOWER) {
      listener.receivedFollowers(errorResult);
    }
 else     if (type == Follower.Type.SUBSCRIBER) {
      listener.receivedSubscribers(errorResult);
    }
  }
}

protected synchronized void received ( int responseCode , String stream , String json ) { FollowerInfo result = parseFollowers ( stream , json ) ; if ( result != null ) { noError ( stream ) ; cached . put ( stream , result ) ; if ( type == Follower . Type . FOLLOWER ) { listener . receivedFollowers ( result ) ; if ( hasNewFollowers ( result . followers ) ) { listener . newFollowers ( result ) ; } } else if ( type == Follower . Type . SUBSCRIBER ) { listener . receivedSubscribers ( result ) ; } requested . add ( stream ) ; } else { String errorMessage = "" ; if ( responseCode == 404 ) { errorMessage = "Channel not found." ; error ( stream , 10 ) ; } else if ( responseCode == 200 ) { errorMessage = "Parse error." ; error ( stream , 1 ) ; } else if ( responseCode == 401 || responseCode == 403 ) { errorMessage = "Access denied." ; error ( stream , 1 ) ; } else if ( responseCode == 422 ) { errorMessage = "No data for this channel." ; error ( stream , 10 ) ; } else { errorMessage = "Request error." ; error ( stream , 1 ) ; } FollowerInfo errorResult = new FollowerInfo ( type , stream , errorMessage ) ; cached . put ( stream , errorResult ) ; if ( type == Follower . Type . FOLLOWER ) { listener . receivedFollowers ( errorResult ) ; } else if ( type == Follower . Type . SUBSCRIBER ) { listener . receivedSubscribers ( errorResult ) ; } } }
received data from the api , so parse it or handle a possible error , then give it to the listener .
