Code example for ClientProtocolException

0
                String responseText = null;
                if (httpEntity != null) {
                    responseText = getResponseString(httpEntity);
                } 
                if (!isSuccess(status)) {
                    saveException(new ClientProtocolException(String.format("%d %s", status.getStatusCode(), status.getReasonPhrase())));
                } else if (responseText != null && responseText.length() > 0) {
                    try { 
                        results = (Result) parseJSON(new JSONObject(responseText));
                    } catch (JSONException e) {
                        saveException("Failed to parse response.", e);
                    } 
                } 
 
                return results != null ? results : (Result) Collections.<Result>emptyList();
            } catch (IOException e) {
                saveException(e);
                throw e;
            } 
        }