Program: 18583
Project: 18583
Buggy source:
/** 
 * Call the remote server to obtain metrics measurements.
 * @param criteria the criteria
 * @param resourceCriteria the resource criteria
 * @param callback the callback
 * @return the metric data
 * @see org.ebayopensource.turmeric.monitoring.client.model.MetricsQueryService#getMetricData(org.ebayopensource.turmeric.monitoring.client.model.MetricCriteria,org.ebayopensource.turmeric.monitoring.client.model.MetricResourceCriteria,com.google.gwt.user.client.rpc.AsyncCallback)
 */
public void getMetricData(final MetricCriteria criteria,final MetricResourceCriteria resourceCriteria,final AsyncCallback<MetricData> callback){
  final String url=URL.encode(MetricsDataRequest.getRestURL(criteria,resourceCriteria));
  GWT.log("String_Node_Str" + url);
  RequestBuilder builder=new RequestBuilder(RequestBuilder.GET,url);
  final MetricData data=new MetricData();
  data.setRestUrl(url);
  data.setMetricCriteria(criteria);
  data.setMetricResourceCriteria(resourceCriteria);
  try {
    builder.sendRequest(null,new RequestCallback(){
      public void onError(      Request request,      Throwable err){
        callback.onFailure(err);
      }
      public void onResponseReceived(      Request request,      Response response){
        if (response.getStatusCode() != Response.SC_OK) {
          callback.onFailure(getErrorAsThrowable(response));
        }
 else         if (response.getHeader(ERROR_HEADER) != null) {
          callback.onFailure(getErrorAsThrowable(response));
        }
 else {
          String responseText=response.getText();
          GWT.log("String_Node_Str" + responseText);
          MetricsDataResponse metricsResponse=MetricsDataResponse.fromJSON(response.getText());
          if (metricsResponse == null) {
            GWT.log("String_Node_Str" + response.getText());
            callback.onFailure(new Throwable(ConsoleUtil.messages.badOrMissingResponseData()));
          }
 else {
            JsArray<MetricGroupDataJS> rows=metricsResponse.getReturnData();
            List<MetricGroupData> results=new ArrayList<MetricGroupData>();
            if (rows != null) {
              for (int i=0; i < rows.length(); i++) {
                MetricGroupDataJS js=rows.get(i);
                results.add(js);
              }
            }
            data.setReturnData(results);
            callback.onSuccess(data);
          }
        }
      }
    }
);
  }
 catch (  RequestException x) {
    callback.onFailure(x);
  }
}

Fixed version (ground truth):
/** 
 * Call the remote server to obtain metrics measurements.
 * @param criteria the criteria
 * @param resourceCriteria the resource criteria
 * @param callback the callback
 * @return the metric data
 * @see org.ebayopensource.turmeric.monitoring.client.model.MetricsQueryService#getMetricData(org.ebayopensource.turmeric.monitoring.client.model.MetricCriteria,org.ebayopensource.turmeric.monitoring.client.model.MetricResourceCriteria,com.google.gwt.user.client.rpc.AsyncCallback)
 */
public void getMetricData(final MetricCriteria criteria,final MetricResourceCriteria resourceCriteria,final AsyncCallback<MetricData> callback){
  final String url=URL.encode(MetricsDataRequest.getRestURL(criteria,resourceCriteria));
  GWT.log("String_Node_Str" + url);
  RequestBuilder builder=new RequestBuilder(RequestBuilder.GET,url);
  final MetricData data=new MetricData();
  data.setRestUrl(url);
  data.setMetricCriteria(criteria);
  data.setMetricResourceCriteria(resourceCriteria);
  try {
    builder.sendRequest(null,new RequestCallback(){
      public void onError(      Request request,      Throwable err){
        callback.onFailure(err);
      }
      public void onResponseReceived(      Request request,      Response response){
        if (response.getStatusCode() != Response.SC_OK) {
          callback.onFailure(getErrorAsThrowable(response));
        }
 else         if (response.getHeader(ERROR_HEADER) != null && response.getHeader(ERROR_HEADER).length() > 0) {
          callback.onFailure(getErrorAsThrowable(response));
        }
 else {
          String responseText=response.getText();
          GWT.log("String_Node_Str" + responseText);
          MetricsDataResponse metricsResponse=MetricsDataResponse.fromJSON(response.getText());
          if (metricsResponse == null) {
            GWT.log("String_Node_Str" + response.getText());
            callback.onFailure(new Throwable(ConsoleUtil.messages.badOrMissingResponseData()));
          }
 else {
            JsArray<MetricGroupDataJS> rows=metricsResponse.getReturnData();
            List<MetricGroupData> results=new ArrayList<MetricGroupData>();
            if (rows != null) {
              for (int i=0; i < rows.length(); i++) {
                MetricGroupDataJS js=rows.get(i);
                results.add(js);
              }
            }
            data.setReturnData(results);
            callback.onSuccess(data);
          }
        }
      }
    }
);
  }
 catch (  RequestException x) {
    callback.onFailure(x);
  }
}