Program: 18576
Project: 18576
Buggy source:
public void onSelection(SelectionEvent<TreeItem> event){
  TreeItem selection=event.getSelectedItem();
  selectionContext.unselect(ObjectType.ServiceName);
  selectionContext.unselect(ObjectType.OperationName);
  selectionContext.unselect(ObjectType.ErrorId);
  selectionContext.unselect(ObjectType.ErrorName);
  if (selection.getParentItem() != null) {
    selectionContext=new SelectionContext();
    if (selection.getChildCount() == 0) {
      selectionContext.select(ObjectType.OperationName,selection.getText());
      selectionContext.select(ObjectType.ServiceName,selection.getParentItem().getText());
    }
 else {
      selectionContext.select(ObjectType.ServiceName,selection.getText());
    }
  }
  view.setSelection(selectionContext.getSelections());
  eventBus.fireEvent(new ObjectSelectionEvent(selectionContext.getSelections()));
  selectedDate1=view.getFilter().getDate1().getValue().getTime();
  selectedDate2=view.getFilter().getDate2().getValue().getTime();
  int hour1=view.getFilter().getHour1();
  int hour2=view.getFilter().getHour2();
  selectedDate1+=(Util.HRS_1_MS * hour1);
  selectedDate2+=(Util.HRS_1_MS * hour2);
  selectedDurationHrs=view.getFilter().getDuration();
  List<String> metrics=((Filterable.ErrorFilterable)view.getFilter()).getSelectedCategoryViewNames();
  if (metrics.isEmpty())   metrics=((Filterable.ErrorFilterable)view.getFilter()).getSelectedSeverityViewNames();
  selectedMetrics=Util.convertToEnumFromCamelCase(metrics,ErrorMetric.class);
  view.reset();
  fetchMetrics(selectedMetrics,selectionContext,selectedDate1,selectedDate2,selectedDurationHrs);
  insertHistory(selectionContext,selectedDate1,selectedDate2,selectedDurationHrs,selectedMetrics,false);
}

Fixed version (ground truth):
public void onSelection(SelectionEvent<TreeItem> event){
  TreeItem selection=event.getSelectedItem();
  selectionContext.unselect(ObjectType.ServiceName);
  selectionContext.unselect(ObjectType.OperationName);
  selectionContext.unselect(ObjectType.ErrorId);
  selectionContext.unselect(ObjectType.ErrorName);
  if (selection.getParentItem() != null) {
    selectionContext=new SelectionContext();
    if (selection.getChildCount() == 0) {
      selectionContext.select(ObjectType.OperationName,selection.getText());
      selectionContext.select(ObjectType.ServiceName,selection.getParentItem().getText());
    }
 else {
      selectionContext.select(ObjectType.ServiceName,selection.getText());
    }
  }
  view.setSelection(selectionContext.getSelections());
  eventBus.fireEvent(new ObjectSelectionEvent(selectionContext.getSelections()));
  selectedDate1=view.getFilter().getDate1().getValue().getTime();
  selectedDate2=view.getFilter().getDate2().getValue().getTime();
  int hour1=view.getFilter().getHour1();
  int hour2=view.getFilter().getHour1();
  selectedDate1+=(Util.HRS_1_MS * hour1);
  selectedDate2+=(Util.HRS_1_MS * hour2);
  selectedDurationHrs=view.getFilter().getDuration();
  List<String> metrics=((Filterable.ErrorFilterable)view.getFilter()).getSelectedCategoryViewNames();
  if (metrics.isEmpty())   metrics=((Filterable.ErrorFilterable)view.getFilter()).getSelectedSeverityViewNames();
  selectedMetrics=Util.convertToEnumFromCamelCase(metrics,ErrorMetric.class);
  view.reset();
  fetchMetrics(selectedMetrics,selectionContext,selectedDate1,selectedDate2,selectedDurationHrs);
  insertHistory(selectionContext,selectedDate1,selectedDate2,selectedDurationHrs,selectedMetrics,false);
}