Program: 18567
Project: 18567
Buggy source:
public void onSuccess(ErrorMetricData data){
  view.setErrorMetricData(m,data);
switch (m) {
case TopApplicationErrors:
case TopRequestErrors:
case TopSystemErrors:
case TopCriticals:
case TopErrors:
case TopWarnings:
{
      List<HasClickHandlers> handlers=view.getTableColumn(m,0);
      for (      HasClickHandlers h : handlers) {
        h.addClickHandler(new ClickHandler(){
          public void onClick(          ClickEvent event){
            Object o=event.getSource();
            if (o instanceof HasText) {
              String errorId=((HasText)o).getText();
              SelectionContext ctx=new SelectionContext();
              ctx.selectAll(selectionContext);
              ctx.unselect(ObjectType.ErrorName);
              ctx.select(ObjectType.ErrorId,errorId);
              view.reset();
              fetchErrorDetail(ctx);
              fetchMetrics(Arrays.asList(new ErrorMetric[]{ErrorMetric.ConsumerError}),ctx,selectedDate1,selectedDate2,selectedDurationHrs);
              insertHistory(ERROR_ID,ctx,selectedDate1,selectedDate2,selectedDurationHrs,false);
            }
          }
        }
);
      }
      handlers=view.getTableColumn(m,1);
      for (      HasClickHandlers h : handlers) {
        h.addClickHandler(new ClickHandler(){
          public void onClick(          ClickEvent event){
            Object o=event.getSource();
            if (o instanceof HasText) {
              String errorName=((HasText)o).getText();
              SelectionContext ctx=new SelectionContext();
              ctx.selectAll(selectionContext);
              ctx.unselect(ObjectType.ErrorId);
              ctx.select(ObjectType.ErrorName,errorName);
              view.reset();
              fetchErrorDetail(ctx);
              fetchMetrics(Arrays.asList(new ErrorMetric[]{ErrorMetric.ConsumerError}),ctx,selectedDate1,selectedDate2,selectedDurationHrs);
              insertHistory(ERROR_ID,ctx,selectedDate1,selectedDate2,selectedDurationHrs,false);
            }
          }
        }
);
      }
      break;
    }
case ConsumerError:
{
    List<HasClickHandlers> handlers=view.getTableColumn(m,0);
    for (    HasClickHandlers h : handlers) {
      h.addClickHandler(new ClickHandler(){
        public void onClick(        ClickEvent event){
          Object o=event.getSource();
          if (o instanceof HasText) {
            String consumer=((HasText)o).getText();
            SelectionContext ctx=new SelectionContext();
            ctx.selectAll(selectionContext);
            ctx.select(ObjectType.ConsumerName,consumer);
            insertHistory(ConsumerPresenter.CONSUMER_ID,ctx,selectedDate1,selectedDate2,selectedDurationHrs,true);
          }
        }
      }
);
    }
    break;
  }
}
}

Fixed version (ground truth):
public void onSuccess(ErrorMetricData data){
  view.setErrorMetricData(m,data);
  String downloadUrl=queryService.getErrorDataDownloadUrl(ec,mc);
  view.setDownloadUrl(m,downloadUrl);
switch (m) {
case TopApplicationErrors:
case TopRequestErrors:
case TopSystemErrors:
case TopCriticals:
case TopErrors:
case TopWarnings:
{
      List<HasClickHandlers> handlers=view.getTableColumn(m,0);
      for (      HasClickHandlers h : handlers) {
        h.addClickHandler(new ClickHandler(){
          public void onClick(          ClickEvent event){
            Object o=event.getSource();
            if (o instanceof HasText) {
              String errorId=((HasText)o).getText();
              SelectionContext ctx=new SelectionContext();
              ctx.selectAll(selectionContext);
              ctx.unselect(ObjectType.ErrorName);
              ctx.select(ObjectType.ErrorId,errorId);
              view.reset();
              fetchErrorDetail(ctx);
              fetchMetrics(Arrays.asList(new ErrorMetric[]{ErrorMetric.ConsumerError}),ctx,selectedDate1,selectedDate2,selectedDurationHrs);
              insertHistory(ERROR_ID,ctx,selectedDate1,selectedDate2,selectedDurationHrs,false);
            }
          }
        }
);
      }
      handlers=view.getTableColumn(m,1);
      for (      HasClickHandlers h : handlers) {
        h.addClickHandler(new ClickHandler(){
          public void onClick(          ClickEvent event){
            Object o=event.getSource();
            if (o instanceof HasText) {
              String errorName=((HasText)o).getText();
              SelectionContext ctx=new SelectionContext();
              ctx.selectAll(selectionContext);
              ctx.unselect(ObjectType.ErrorId);
              ctx.select(ObjectType.ErrorName,errorName);
              view.reset();
              fetchErrorDetail(ctx);
              fetchMetrics(Arrays.asList(new ErrorMetric[]{ErrorMetric.ConsumerError}),ctx,selectedDate1,selectedDate2,selectedDurationHrs);
              insertHistory(ERROR_ID,ctx,selectedDate1,selectedDate2,selectedDurationHrs,false);
            }
          }
        }
);
      }
      break;
    }
case ConsumerError:
{
    List<HasClickHandlers> handlers=view.getTableColumn(m,0);
    for (    HasClickHandlers h : handlers) {
      h.addClickHandler(new ClickHandler(){
        public void onClick(        ClickEvent event){
          Object o=event.getSource();
          if (o instanceof HasText) {
            String consumer=((HasText)o).getText();
            SelectionContext ctx=new SelectionContext();
            ctx.selectAll(selectionContext);
            ctx.select(ObjectType.ConsumerName,consumer);
            insertHistory(ConsumerPresenter.CONSUMER_ID,ctx,selectedDate1,selectedDate2,selectedDurationHrs,true);
          }
        }
      }
);
    }
    break;
  }
}
}