Code example for AuthenticationException

0
                friendList.add(User.valueOf(friends.getJSONObject(i)));
            } 
        } else { 
            if (resp.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
                Log.e(TAG, "Authentication exception in fetching remote contacts");
                throw new AuthenticationException();
            }  else if(resp.getStatusLine().getStatusCode() == HttpStatus.SC_FORBIDDEN) {
            	Log.e(TAG, "Fetching contact updates forbidden");
            	throw new FeedForbiddenException(); 
            } else { 
                Log.e(TAG, "Server error in fetching remote contacts: "
                    + resp.getStatusLine());
                throw new IOException();
            } 
        } 
        return friendList;
    } 
     
    /** 
     * Retrieves a list of bookmark updates for contacts in a users network.