Program: 18581
Project: 18581
Buggy source:
/** 
 * Bind.
 */
public void bind(){
  this.eventBus.addHandler(ObjectSelectionEvent.TYPE,new ObjectSelectionEventHandler(){
    public void onSelection(    ObjectSelectionEvent event){
      selectionContext=new SelectionContext();
      if (event.getSelection(ObjectType.ServiceName) != null)       selectionContext.select(ObjectType.ServiceName,event.getSelection(ObjectType.ServiceName));
      if (event.getSelection(ObjectType.OperationName) != null)       selectionContext.select(ObjectType.OperationName,event.getSelection(ObjectType.OperationName));
    }
  }
);
  this.view.getFilter().getDate1().addValueChangeHandler(new ValueChangeHandler<Date>(){
    public void onValueChange(    ValueChangeEvent<Date> event){
      Date date=event.getValue();
      int[] hrs=Util.getAvailableHours(date);
      ServicePresenter.this.view.getFilter().setHours1(hrs);
    }
  }
);
  this.view.getFilter().getDate2().addValueChangeHandler(new ValueChangeHandler<Date>(){
    public void onValueChange(    ValueChangeEvent<Date> event){
      Date date=event.getValue();
      int[] hrs=Util.getAvailableHours(date);
      ServicePresenter.this.view.getFilter().setHours2(hrs);
    }
  }
);
  this.view.getFilter().getApplyButton().addClickHandler(new ClickHandler(){
    public void onClick(    ClickEvent event){
      if (selectionContext.getSelection(ObjectType.ServiceName) == null) {
        view.error(ConsoleUtil.messages.selectServer());
      }
 else {
        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();
        view.setFilterLabel(makeFilterLabel(selectedDate1,selectedDate2,selectedDurationHrs));
        eventBus.fireEvent(new DateFilterSelectionEvent(selectedDate1,selectedDate2,selectedDurationHrs));
        selectedMetrics=Util.convertToEnumFromCamelCase(ServicePresenter.this.view.getFilter().getSelectedMetricNames(),ServiceMetric.class);
        view.reset();
        fetchMetrics(selectedMetrics,selectionContext,selectedDate1,selectedDate2,selectedDurationHrs);
        insertHistory(selectionContext,selectedDate1,selectedDate2,selectedDurationHrs,selectedMetrics,false);
      }
    }
  }
);
  this.view.getSelector().addSelectionHandler(new SelectionHandler<TreeItem>(){
    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):
/** 
 * Bind.
 */
public void bind(){
  this.eventBus.addHandler(ObjectSelectionEvent.TYPE,new ObjectSelectionEventHandler(){
    public void onSelection(    ObjectSelectionEvent event){
      selectionContext=new SelectionContext();
      if (event.getSelection(ObjectType.ServiceName) != null)       selectionContext.select(ObjectType.ServiceName,event.getSelection(ObjectType.ServiceName));
      if (event.getSelection(ObjectType.OperationName) != null)       selectionContext.select(ObjectType.OperationName,event.getSelection(ObjectType.OperationName));
    }
  }
);
  this.view.getFilter().getDate1().addValueChangeHandler(new ValueChangeHandler<Date>(){
    public void onValueChange(    ValueChangeEvent<Date> event){
      Date date=event.getValue();
      int[] hrs=Util.getAvailableHours(date);
      ServicePresenter.this.view.getFilter().setHours1(hrs);
    }
  }
);
  this.view.getFilter().getApplyButton().addClickHandler(new ClickHandler(){
    public void onClick(    ClickEvent event){
      if (selectionContext.getSelection(ObjectType.ServiceName) == null) {
        view.error(ConsoleUtil.messages.selectServer());
      }
 else {
        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();
        view.setFilterLabel(makeFilterLabel(selectedDate1,selectedDate2,selectedDurationHrs));
        eventBus.fireEvent(new DateFilterSelectionEvent(selectedDate1,selectedDate2,selectedDurationHrs));
        selectedMetrics=Util.convertToEnumFromCamelCase(ServicePresenter.this.view.getFilter().getSelectedMetricNames(),ServiceMetric.class);
        view.reset();
        fetchMetrics(selectedMetrics,selectionContext,selectedDate1,selectedDate2,selectedDurationHrs);
        insertHistory(selectionContext,selectedDate1,selectedDate2,selectedDurationHrs,selectedMetrics,false);
      }
    }
  }
);
  this.view.getSelector().addSelectionHandler(new SelectionHandler<TreeItem>(){
    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);
    }
  }
);
}