Source:
<code>private AuthenticationResult processTokenResponse(HttpWebResponse webResponse) { AuthenticationResult result = new AuthenticationResult(); String correlationIdInHeader = null; if (webResponse.getResponseHeaders() != null && webResponse.getResponseHeaders().containsKey( AuthenticationConstants.AAD.CLIENT_REQUEST_ID)) { List<String> listOfHeaders = webResponse.getResponseHeaders().get( AuthenticationConstants.AAD.CLIENT_REQUEST_ID); if (listOfHeaders != null && listOfHeaders.size() > 0) { correlationIdInHeader = listOfHeaders.get(0); } } final boolean isResponseBodyEmpty = webResponse.getBody() == null || webResponse.getBody().length == 0; final int statusCode = webResponse.getStatusCode(); if (isResponseBodyEmpty) { Logger.v(TAG, "Token request return an empty response body."); result = new AuthenticationResult(String.valueOf(statusCode), "", null); } else { switch(statusCode) { case HttpURLConnection.HTTP_OK: case HttpURLConnection.HTTP_BAD_REQUEST: case HttpURLConnection.HTTP_UNAUTHORIZED: try { result = parseJsonResponse(webResponse.getBody()); } catch (final JSONException ex) { <START> Logger.e(TAG, "Cannot parse response as JSON" + ex.getMessage(), "", ADALError.SERVER_INVALID_JSON_RESPONSE, ex); <END> result = new AuthenticationResult(String.valueOf(statusCode), webResponse.getBody().toString(), null); } break; default: result = new AuthenticationResult(String.valueOf(statusCode), webResponse.getBody().toString(), null); } } if (correlationIdInHeader != null && !correlationIdInHeader.isEmpty()) { try { UUID correlation = UUID.fromString(correlationIdInHeader); if (!correlation.equals(mRequest.getCorrelationId())) { Logger.w(TAG, "CorrelationId is not matching", "", ADALError.CORRELATION_ID_NOT_MATCHING_REQUEST_RESPONSE); } Logger.v(TAG, "Response correlationId:" + correlationIdInHeader); } catch (IllegalArgumentException ex) { Logger.e(TAG, "Wrong format of the correlation ID:" + correlationIdInHeader, "", ADALError.CORRELATION_ID_FORMAT, ex); } } return result; }</code><technical_language>@weijjia log status code well</technical_language>

Target:
private AuthenticationResult processTokenResponse(HttpWebResponse webResponse) throws HttpResponseException { AuthenticationResult result = new AuthenticationResult(); String correlationIdInHeader = null; if (webResponse.getResponseHeaders() != null && webResponse.getResponseHeaders().containsKey( AuthenticationConstants.AAD.CLIENT_REQUEST_ID)) { List<String> listOfHeaders = webResponse.getResponseHeaders().get( AuthenticationConstants.AAD.CLIENT_REQUEST_ID); if (listOfHeaders != null && listOfHeaders.size() > 0) { correlationIdInHeader = listOfHeaders.get(0); } } final boolean isResponseBodyEmpty = (webResponse.getBody() == null) || (webResponse.getBody().length == 0); final int statusCode = webResponse.getStatusCode(); if (isResponseBodyEmpty) { Logger.v(TAG, "Token request returned an empty response body."); throw new HttpResponseException(String.valueOf(statusCode)); } else { Logger.v(TAG, "Start parsing response body from token request."); switch(statusCode) { case HttpURLConnection.HTTP_OK: case HttpURLConnection.HTTP_BAD_REQUEST: case HttpURLConnection.HTTP_UNAUTHORIZED: try { result = parseJsonResponse(webResponse.getBody()); } catch (final JSONException ex) { final String message = "Status code: " + statusCode + ". Cannot parse response as JSON " + ex.getMessage(); Logger.e(TAG, message, "", ADALError.SERVER_INVALID_JSON_RESPONSE, ex); throw new HttpResponseException(String.valueOf(statusCode), new String(webResponse.getBody())); } break; default: throw new HttpResponseException(String.valueOf(statusCode), new String(webResponse.getBody())); } } logResponseCorrelationId(correlationIdInHeader); return result; }