Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
METRICS-3129: Fix NPE in HttpClient 3 and 4 plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Shachar Anchelovich committed Dec 3, 2012
1 parent 7f912aa commit a31d8a5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,12 @@ public aspect HttpClientExecutionCollectionAspect extends OperationCollectionAsp
op.put(HttpStatusTraceErrorAnalyzer.STATUS_CODE_ATTR, statusCode);

if (collectExtra) {
op.putAnyNonEmpty(HttpStatusTraceErrorAnalyzer.REASON_PHRASE_ATTR, method.getStatusText());
StatusLine statusLine = method.getStatusLine();

if (statusLine != null) {
op.putAnyNonEmpty(HttpStatusTraceErrorAnalyzer.REASON_PHRASE_ATTR, statusLine.getReasonPhrase());
}

fillInMethodHeaders(op.createList("headers"), method, false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<@insight.title>Apache HC3 Summary</@insight.title>
<code class="raw http">${request.method?html} ${request.uri?html} ${request.protocol?html}</code>
<code class="raw http">${request.protocol?html} ${response.statusCode?html} ${response.reasonPhrase?html}</code>
<code class="raw http"><#if request.protocol??>${request.protocol?html}</#if> <#if request.statusCode??>${response.statusCode?html}</#if> <#if request.reasonPhrase??>${response.reasonPhrase?html}</#if></code>

<@insight.group label="Request Headers" if=request.headers?has_content collection=request.headers ; h>
<@insight.entry name=h.name value=h.value required="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,15 @@ public aspect HttpClientExecutionCollectionAspect extends OperationCollectionAsp

OperationMap fillInResponseDetails(OperationMap op, HttpResponse response, boolean collectExtra) {
StatusLine statusLine = response.getStatusLine();
op.put("statusCode", statusLine.getStatusCode());

if (collectExtra) {
op.putAnyNonEmpty("reasonPhrase", statusLine.getReasonPhrase());
fillInMessageHeaders(op.createList("headers"), response);

if (statusLine != null) {
op.put("statusCode", statusLine.getStatusCode());
}
if (collectExtra) {
if (statusLine != null) {
op.putAnyNonEmpty("reasonPhrase", statusLine.getReasonPhrase());
}
fillInMessageHeaders(op.createList("headers"), response);
}

return op;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<@insight.title>Apache HC4 Summary</@insight.title>
<code class="raw http">${request.method?html} ${request.uri?html} ${request.protocol?html}</code>
<code class="raw http">${request.protocol?html} ${response.statusCode?html} ${response.reasonPhrase?html}</code>
<code class="raw http"><#if request.protocol??>${request.protocol?html}</#if> <#if request.statusCode??>${response.statusCode?html}</#if> <#if request.reasonPhrase??>${response.reasonPhrase?html}</#if></code>

<@insight.group label="Request Headers" if=request.headers?has_content collection=request.headers ; h>
<@insight.entry name=h.name value=h.value required="true" />
Expand Down

0 comments on commit a31d8a5

Please sign in to comment.