Code example for AuthenticationException

            Log.d(TAG, "StatusCode:" + resp.getStatusLine().getStatusCode());
            if (resp.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
                if (resp.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
                    Log.e(TAG, "Authentication exception in sending to");
                    throw new AuthenticationException();
                } else { 
                    Log.e(TAG, "Server error in sending to " + resp.getStatusLine());
                    throw new IOException();
//        200 (OK)Request processed successfully 
//400 (Bad Request)Any case where a parameter is invalid, or a required parameter is missing. Additionnal information might be available, like when you try to access a resource that doesn’t belong to you :: 
//{"failed_events": [[{"feed_id": 1470, "value": 1432101829}, "(' - feed does not belong to user.',)"]]} 
//401 (Authorization Required)The key (sense_key or application_key) provided in the request was incorrect. 
//404 (Not found)Ressource does not exist (bad URL, path...) 
//500 (Internal Server Error) servers are not in good shape. The request might be valid, but needs to be retrieved later . 
Stop searching for code, let great code find you!  Add Codota to your java IDE