Program: 112226
Project: 112226
Buggy source:
protected void processAndAddLastClientInvocation(GenericClient theClient,ResultType theResultType,ModelMap theModelMap,long theLatency,String outcomeDescription,CaptureInterceptor theInterceptor,HomeRequest theRequest){
  try {
    IHttpRequest lastRequest=theInterceptor.getLastRequest();
    IHttpResponse lastResponse=theInterceptor.getLastResponse();
    String requestBody=null;
    String requestUrl=null;
    String action=null;
    String resultStatus=null;
    String resultBody=null;
    String mimeType=null;
    ContentType ct=null;
    if (lastRequest != null) {
      requestBody=lastRequest.getRequestBodyFromStream();
      requestUrl=lastRequest.getUri();
      action=lastRequest.getHttpVerbName();
    }
    if (lastResponse != null) {
      resultStatus="String_Node_Str" + lastResponse.getStatus() + "String_Node_Str"+ lastResponse.getStatusInfo();
      lastResponse.bufferEntity();
      resultBody=IOUtils.toString(lastResponse.readEntity(),Constants.CHARSET_UTF8);
      List<String> ctStrings=lastResponse.getAllHeaders().get(Constants.HEADER_CONTENT_TYPE);
      if (ctStrings != null && ctStrings.isEmpty() == false) {
        ct=ContentType.parse(ctStrings.get(0));
        mimeType=ct.getMimeType();
      }
    }
    EncodingEnum ctEnum=EncodingEnum.forContentType(mimeType);
    String narrativeString="String_Node_Str";
    StringBuilder resultDescription=new StringBuilder();
    Bundle bundle=null;
    IBaseResource riBundle=null;
    FhirContext context=getContext(theRequest);
    if (ctEnum == null) {
      resultDescription.append("String_Node_Str");
    }
 else {
switch (ctEnum) {
case JSON:
        if (theResultType == ResultType.RESOURCE) {
          narrativeString=parseNarrative(theRequest,ctEnum,resultBody);
          resultDescription.append("String_Node_Str");
        }
 else         if (theResultType == ResultType.BUNDLE) {
          resultDescription.append("String_Node_Str");
          if (context.getVersion().getVersion().isRi()) {
            riBundle=context.newJsonParser().parseResource(resultBody);
          }
 else {
            bundle=context.newJsonParser().parseBundle(resultBody);
          }
        }
      break;
case XML:
default :
    if (theResultType == ResultType.RESOURCE) {
      narrativeString=parseNarrative(theRequest,ctEnum,resultBody);
      resultDescription.append("String_Node_Str");
    }
 else     if (theResultType == ResultType.BUNDLE) {
      resultDescription.append("String_Node_Str");
      if (context.getVersion().getVersion().isRi()) {
        riBundle=context.newXmlParser().parseResource(resultBody);
      }
 else {
        bundle=context.newXmlParser().parseBundle(resultBody);
      }
    }
  break;
}
}
resultDescription.append("String_Node_Str").append(resultBody.length() + "String_Node_Str");
Header[] requestHeaders=lastRequest != null ? applyHeaderFilters(lastRequest.getAllHeaders()) : new Header[0];
Header[] responseHeaders=lastResponse != null ? applyHeaderFilters(lastResponse.getAllHeaders()) : new Header[0];
theModelMap.put("String_Node_Str",outcomeDescription);
theModelMap.put("String_Node_Str",resultDescription.toString());
theModelMap.put("String_Node_Str",action);
theModelMap.put("String_Node_Str",bundle);
theModelMap.put("String_Node_Str",riBundle);
theModelMap.put("String_Node_Str",resultStatus);
theModelMap.put("String_Node_Str",requestUrl);
theModelMap.put("String_Node_Str",formatUrl(theClient.getUrlBase(),requestUrl));
String requestBodyText=format(requestBody,ctEnum);
theModelMap.put("String_Node_Str",requestBodyText);
String resultBodyText=format(resultBody,ctEnum);
theModelMap.put("String_Node_Str",resultBodyText);
theModelMap.put("String_Node_Str",resultBodyText.length() > 1000);
theModelMap.put("String_Node_Str",requestHeaders);
theModelMap.put("String_Node_Str",responseHeaders);
theModelMap.put("String_Node_Str",narrativeString);
theModelMap.put("String_Node_Str",theLatency);
}
 catch (Exception e) {
ourLog.error("String_Node_Str",e);
theModelMap.put("String_Node_Str","String_Node_Str" + e.getMessage());
}
}

Fixed version (ground truth):
protected void processAndAddLastClientInvocation(GenericClient theClient,ResultType theResultType,ModelMap theModelMap,long theLatency,String outcomeDescription,CaptureInterceptor theInterceptor,HomeRequest theRequest){
  try {
    IHttpRequest lastRequest=theInterceptor.getLastRequest();
    IHttpResponse lastResponse=theInterceptor.getLastResponse();
    String requestBody=null;
    String requestUrl=null;
    String action=null;
    String resultStatus=null;
    String resultBody=null;
    String mimeType=null;
    ContentType ct=null;
    if (lastRequest != null) {
      requestBody=lastRequest.getRequestBodyFromStream();
      requestUrl=lastRequest.getUri();
      action=lastRequest.getHttpVerbName();
    }
    if (lastResponse != null) {
      resultStatus="String_Node_Str" + lastResponse.getStatus() + "String_Node_Str"+ lastResponse.getStatusInfo();
      lastResponse.bufferEntity();
      resultBody=IOUtils.toString(lastResponse.readEntity(),Constants.CHARSET_UTF8);
      List<String> ctStrings=lastResponse.getHeaders(Constants.HEADER_CONTENT_TYPE);
      if (ctStrings != null && ctStrings.isEmpty() == false) {
        ct=ContentType.parse(ctStrings.get(0));
        mimeType=ct.getMimeType();
      }
    }
    EncodingEnum ctEnum=EncodingEnum.forContentType(mimeType);
    String narrativeString="String_Node_Str";
    StringBuilder resultDescription=new StringBuilder();
    Bundle bundle=null;
    IBaseResource riBundle=null;
    FhirContext context=getContext(theRequest);
    if (ctEnum == null) {
      resultDescription.append("String_Node_Str");
    }
 else {
switch (ctEnum) {
case JSON:
        if (theResultType == ResultType.RESOURCE) {
          narrativeString=parseNarrative(theRequest,ctEnum,resultBody);
          resultDescription.append("String_Node_Str");
        }
 else         if (theResultType == ResultType.BUNDLE) {
          resultDescription.append("String_Node_Str");
          if (context.getVersion().getVersion().isRi()) {
            riBundle=context.newJsonParser().parseResource(resultBody);
          }
 else {
            bundle=context.newJsonParser().parseBundle(resultBody);
          }
        }
      break;
case XML:
default :
    if (theResultType == ResultType.RESOURCE) {
      narrativeString=parseNarrative(theRequest,ctEnum,resultBody);
      resultDescription.append("String_Node_Str");
    }
 else     if (theResultType == ResultType.BUNDLE) {
      resultDescription.append("String_Node_Str");
      if (context.getVersion().getVersion().isRi()) {
        riBundle=context.newXmlParser().parseResource(resultBody);
      }
 else {
        bundle=context.newXmlParser().parseBundle(resultBody);
      }
    }
  break;
}
}
resultDescription.append("String_Node_Str").append(resultBody.length() + "String_Node_Str");
Header[] requestHeaders=lastRequest != null ? applyHeaderFilters(lastRequest.getAllHeaders()) : new Header[0];
Header[] responseHeaders=lastResponse != null ? applyHeaderFilters(lastResponse.getAllHeaders()) : new Header[0];
theModelMap.put("String_Node_Str",outcomeDescription);
theModelMap.put("String_Node_Str",resultDescription.toString());
theModelMap.put("String_Node_Str",action);
theModelMap.put("String_Node_Str",bundle);
theModelMap.put("String_Node_Str",riBundle);
theModelMap.put("String_Node_Str",resultStatus);
theModelMap.put("String_Node_Str",requestUrl);
theModelMap.put("String_Node_Str",formatUrl(theClient.getUrlBase(),requestUrl));
String requestBodyText=format(requestBody,ctEnum);
theModelMap.put("String_Node_Str",requestBodyText);
String resultBodyText=format(resultBody,ctEnum);
theModelMap.put("String_Node_Str",resultBodyText);
theModelMap.put("String_Node_Str",resultBodyText.length() > 1000);
theModelMap.put("String_Node_Str",requestHeaders);
theModelMap.put("String_Node_Str",responseHeaders);
theModelMap.put("String_Node_Str",narrativeString);
theModelMap.put("String_Node_Str",theLatency);
}
 catch (Exception e) {
ourLog.error("String_Node_Str",e);
theModelMap.put("String_Node_Str","String_Node_Str" + e.getMessage());
}
}