Code example for AuthenticationException

0
    Log.d(TAG, "Auth Response was " + response);
    if(resp.getStatusLine().getStatusCode() == HttpStatus.SC_NOT_IMPLEMENTED){
      throw new APIVersionException(); 
    } 
    else if(resp.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED){
      throw new AuthenticationException();
    } 
    else{ 
      JSONObject authResponse = new JSONObject(response);
      return new AuthResult( 
        authResponse.getString("ticket_hash"),
        authResponse.getString("user_id"));
    } 
  } 
 
  private static void basicResponseErrorCheck( 
    HttpResponse resp, 
    String response
  ) 
    throws AuthenticationException, IOException