Code example for AuthenticationException

0
		post.addAuthToken(authToken);
		post.addParam(PARAM_LAST_SYNC, String.valueOf(lastSync));
		post.addParam(PARAM_CLIENT_LIST, serverIdJSON);
		HttpResponse response = post.execute();
		if (response.getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
			throw new AuthenticationException();
		} 
 
		final ArrayList<RawContact> rawContacts = new ArrayList<RawContact>();
 
		// Fetch the response contact as JSON object 
		final JSONObject responseJSON = new JSONObject(response.getResponseBody());
		final JSONArray dirtyContacts = responseJSON.getJSONArray(RESPONSE_DATA);
 
		// Iterate each contact 
		for (int i = 0; i < dirtyContacts.length(); i++) {
			final JSONObject contactJSON = dirtyContacts.getJSONObject(i);
			rawContacts.add(RawContact.valueOf(contactJSON));
		} 
		return rawContacts;
	}