Program: 18578
Project: 18578
Buggy source:
public void go(HasWidgets container,HistoryToken token){
  selectionContext=SelectionContext.fromHistoryToken(token);
  view.setSelection(selectionContext.getSelections());
  if (servicesList == null)   fetchServices();
  FilterContext historyFilter=FilterContext.fromHistoryToken(token);
  Date now=new Date();
  long fullTimeLastHour=Util.getLastHour(now);
  long sameTimeYesterday=Util.get24HrsPrevious(fullTimeLastHour);
  selectedDate1=(historyFilter.getDate1() == 0 ? new Date(sameTimeYesterday).getTime() : historyFilter.getDate1());
  selectedDate2=(historyFilter.getDate2() == 0 ? new Date(fullTimeLastHour).getTime() : historyFilter.getDate2());
  view.getFilter().setHours1(Util.getAvailableHours(selectedDate1));
  view.getFilter().setHour1(new Date(selectedDate1).getHours());
  view.getFilter().setDate1(new Date(selectedDate1));
  view.getFilter().setHours2(Util.getAvailableHours(selectedDate2));
  view.getFilter().setHour2(new Date(selectedDate2).getHours());
  view.getFilter().setDate2(new Date(selectedDate2));
  selectedDurationHrs=(historyFilter.getDurationHrs() == 0 ? MetricsQueryService.DEFAULT_DURATION_HRS : historyFilter.getDurationHrs());
  int[] intervals=new int[24];
  for (int i=0; i < 24; i++)   intervals[i]=i + 1;
  view.getFilter().setDurations(intervals);
  view.getFilter().setDuration(selectedDurationHrs);
  view.setFilterLabel(makeFilterLabel(selectedDate1,selectedDate2,selectedDurationHrs));
  Filterable.ErrorFilterable errFilter=(Filterable.ErrorFilterable)view.getFilter();
  errFilter.setCategoryViewNames(Util.convertFromEnumToCamelCase(CATEGORY_METRICS));
  errFilter.setSeverityViewNames(Util.convertFromEnumToCamelCase(SEVERITY_METRICS));
  List<String> metricNamesFromHistory=historyFilter.getMetricNames();
  List<ErrorMetric> errorMetricsFromHistory=Util.convertToEnumFromCamelCase(metricNamesFromHistory,ErrorMetric.class);
  if (errorMetricsFromHistory.isEmpty()) {
    selectedMetrics=CATEGORY_METRICS;
    errFilter.setSelectedCategoryViewNames(Util.convertFromEnumToCamelCase(selectedMetrics));
  }
 else {
    selectedMetrics=errorMetricsFromHistory;
    boolean isCategory=false;
    for (    ErrorMetric m : selectedMetrics) {
      if (CATEGORY_METRICS.contains(m)) {
        isCategory=true;
        break;
      }
    }
    if (isCategory) {
      errFilter.setSelectedCategoryViewNames(Util.convertFromEnumToCamelCase(selectedMetrics));
    }
 else {
      errFilter.setSelectedSeverityViewNames(Util.convertFromEnumToCamelCase(selectedMetrics));
    }
  }
  view.reset();
  if (selectionContext.getSelection(ObjectType.ErrorId) != null || selectionContext.getSelection(ObjectType.ErrorName) != null) {
    selectedMetrics=Arrays.asList(new ErrorMetric[]{ErrorMetric.ConsumerError});
    fetchErrorDetail(selectionContext);
  }
  fetchMetrics(selectedMetrics,selectionContext,selectedDate1,selectedDate2,selectedDurationHrs);
  ((Dashboard)container).activate(this.view);
}

Fixed version (ground truth):
public void go(HasWidgets container,HistoryToken token){
  selectionContext=SelectionContext.fromHistoryToken(token);
  view.setSelection(selectionContext.getSelections());
  if (servicesList == null)   fetchServices();
  FilterContext historyFilter=FilterContext.fromHistoryToken(token);
  Date now=new Date();
  long fullTimeLastHour=Util.getLastHour(now);
  long sameTimeYesterday=Util.get24HrsPrevious(fullTimeLastHour);
  selectedDate1=(historyFilter.getDate1() == 0 ? new Date(sameTimeYesterday).getTime() : historyFilter.getDate1());
  selectedDate2=(historyFilter.getDate2() == 0 ? new Date(fullTimeLastHour).getTime() : historyFilter.getDate2());
  view.getFilter().setHours1(Util.getAvailableHours(selectedDate1));
  view.getFilter().setHour1(new Date(selectedDate1).getHours());
  view.getFilter().setDate1(new Date(selectedDate1));
  view.getFilter().setDate2(new Date(selectedDate2));
  selectedDurationHrs=(historyFilter.getDurationHrs() == 0 ? MetricsQueryService.DEFAULT_DURATION_HRS : historyFilter.getDurationHrs());
  int[] intervals=new int[24];
  for (int i=0; i < 24; i++)   intervals[i]=i + 1;
  view.getFilter().setDurations(intervals);
  view.getFilter().setDuration(selectedDurationHrs);
  view.setFilterLabel(makeFilterLabel(selectedDate1,selectedDate2,selectedDurationHrs));
  Filterable.ErrorFilterable errFilter=(Filterable.ErrorFilterable)view.getFilter();
  errFilter.setCategoryViewNames(Util.convertFromEnumToCamelCase(CATEGORY_METRICS));
  errFilter.setSeverityViewNames(Util.convertFromEnumToCamelCase(SEVERITY_METRICS));
  List<String> metricNamesFromHistory=historyFilter.getMetricNames();
  List<ErrorMetric> errorMetricsFromHistory=Util.convertToEnumFromCamelCase(metricNamesFromHistory,ErrorMetric.class);
  if (errorMetricsFromHistory.isEmpty()) {
    selectedMetrics=CATEGORY_METRICS;
    errFilter.setSelectedCategoryViewNames(Util.convertFromEnumToCamelCase(selectedMetrics));
  }
 else {
    selectedMetrics=errorMetricsFromHistory;
    boolean isCategory=false;
    for (    ErrorMetric m : selectedMetrics) {
      if (CATEGORY_METRICS.contains(m)) {
        isCategory=true;
        break;
      }
    }
    if (isCategory) {
      errFilter.setSelectedCategoryViewNames(Util.convertFromEnumToCamelCase(selectedMetrics));
    }
 else {
      errFilter.setSelectedSeverityViewNames(Util.convertFromEnumToCamelCase(selectedMetrics));
    }
  }
  view.reset();
  if (selectionContext.getSelection(ObjectType.ErrorId) != null || selectionContext.getSelection(ObjectType.ErrorName) != null) {
    selectedMetrics=Arrays.asList(new ErrorMetric[]{ErrorMetric.ConsumerError});
    fetchErrorDetail(selectionContext);
  }
  fetchMetrics(selectedMetrics,selectionContext,selectedDate1,selectedDate2,selectedDurationHrs);
  ((Dashboard)container).activate(this.view);
}