Program: 18580
Project: 18580
Buggy source:
public void onSelection(SelectionEvent<TreeItem> event){
  TreeItem selection=event.getSelectedItem();
  selectionContext=new SelectionContext();
  if (selection.getParentItem() == null) {
    selectionContext.unselect(ObjectType.ServiceName);
    selectionContext.unselect(ObjectType.OperationName);
  }
 else {
    if (selection.getChildCount() == 0) {
      selectionContext.select(ObjectType.ServiceName,selection.getParentItem().getText());
      selectionContext.select(ObjectType.OperationName,selection.getText());
    }
 else {
      selectionContext.select(ObjectType.ServiceName,selection.getText());
    }
  }
  view.setSelection(selectionContext.getSelections());
  fireObjectSelectionEvent(selectionContext);
  selectedDate1=ServicePresenter.this.view.getFilter().getDate1().getValue().getTime();
  selectedDate2=ServicePresenter.this.view.getFilter().getDate2().getValue().getTime();
  int hour1=ServicePresenter.this.view.getFilter().getHour1();
  int hour2=ServicePresenter.this.view.getFilter().getHour2();
  selectedDate1+=(Util.HRS_1_MS * hour1);
  selectedDate2+=(Util.HRS_1_MS * hour2);
  selectedDurationHrs=ServicePresenter.this.view.getFilter().getDuration();
  eventBus.fireEvent(new DateFilterSelectionEvent(selectedDate1,selectedDate2,selectedDurationHrs));
  selectedMetrics=Util.convertToEnumFromCamelCase(ServicePresenter.this.view.getFilter().getSelectedMetricNames(),ServiceMetric.class);
  view.reset();
  if (selectionContext.isSelected(ObjectType.ServiceName))   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=new SelectionContext();
  if (selection.getParentItem() == null) {
    selectionContext.unselect(ObjectType.ServiceName);
    selectionContext.unselect(ObjectType.OperationName);
  }
 else {
    if (selection.getChildCount() == 0) {
      selectionContext.select(ObjectType.ServiceName,selection.getParentItem().getText());
      selectionContext.select(ObjectType.OperationName,selection.getText());
    }
 else {
      selectionContext.select(ObjectType.ServiceName,selection.getText());
    }
  }
  view.setSelection(selectionContext.getSelections());
  fireObjectSelectionEvent(selectionContext);
  selectedDate1=ServicePresenter.this.view.getFilter().getDate1().getValue().getTime();
  selectedDate2=ServicePresenter.this.view.getFilter().getDate2().getValue().getTime();
  int hour1=ServicePresenter.this.view.getFilter().getHour1();
  int hour2=ServicePresenter.this.view.getFilter().getHour1();
  selectedDate1+=(Util.HRS_1_MS * hour1);
  selectedDate2+=(Util.HRS_1_MS * hour2);
  selectedDurationHrs=ServicePresenter.this.view.getFilter().getDuration();
  eventBus.fireEvent(new DateFilterSelectionEvent(selectedDate1,selectedDate2,selectedDurationHrs));
  selectedMetrics=Util.convertToEnumFromCamelCase(ServicePresenter.this.view.getFilter().getSelectedMetricNames(),ServiceMetric.class);
  view.reset();
  if (selectionContext.isSelected(ObjectType.ServiceName))   fetchMetrics(selectedMetrics,selectionContext,selectedDate1,selectedDate2,selectedDurationHrs);
  insertHistory(selectionContext,selectedDate1,selectedDate2,selectedDurationHrs,selectedMetrics,false);
}