src/main/java/com/amazonaws/hal/client/StatusCodeErrorResponseHandler.java
private JSONObject getBodyAsJson(HttpResponse response) {
        try (InputStream stream = response.getContent()) {
            BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
            StringBuilder sb = new StringBuilder();

            while (true) {
                String line = reader.readLine();

                if (line == null) {
                    break;
                }

                sb.append(line);
            }

            return new JSONObject(sb.length() == 0 ? "{}" : sb.toString());
        } catch (IOException e) {
            throw new AmazonClientException("Unable to read error response: " + e.getMessage(), e);
        } catch (JSONException e) {
            throw new AmazonClientException("Unable to parse error response: " + e.getMessage(), e);
        }
    }
private JSONObject getBodyAsJson(HttpResponse response) {
        try (InputStream stream = response.getContent()) {
            BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
            StringBuilder sb = new StringBuilder();

            while (true) {
                String line = reader.readLine();

                if (line == null) {
                    break;
                }

                sb.append(line);
            }

            return new JSONObject(sb.length() == 0 ? "{}" : sb.toString());
        } catch (IOException e) {
            throw new AmazonClientException("Unable to read error response: " + e.getMessage(), e);
        } catch (JSONException e) {
            throw new AmazonClientException("Unable to parse error response: " + e.getMessage(), e);
        }
    }
-------------------------------------------------------------