Program: 143318
Project: 143318
Buggy source:
public void calculate(final WorkPlace defaultWorkPlace,final WorkPlace mainOffice){
  clearCalculate();
  if (paidLeave) {
    setBeginTime(mainOffice.getBaseBeginTime());
    setFinishTime(mainOffice.getBaseFinishTime());
    this.actualWorkingMinute=mainOffice.getBaseWorkTimeMinute();
    return;
  }
  WorkPlace actualWorkPlace=workPlace;
  if (actualWorkPlace == null) {
    actualWorkPlace=defaultWorkPlace;
  }
  DateTime beginDateTime=null;
  if (beginTime != null) {
    beginDateTime=BASE_DATE.toDateTime(beginTime);
  }
  DateTime finishDateTime=null;
  if (finishTime != null) {
    finishDateTime=BASE_DATE.toDateTime(finishTime);
  }
  if (beginDateTime != null && finishDateTime != null) {
    if (!beginDateTime.isBefore(finishDateTime)) {
      finishDateTime=finishDateTime.plusDays(1);
    }
    final Interval workTimeInterval=new Interval(beginDateTime,finishDateTime);
    this.actualWorkingMinute=actualWorkPlace.calculateWorkingMinute(workTimeInterval);
    if (actualWorkingMinute < mainOffice.getBaseWorkTimeMinute() && isWorkDay()) {
      this.compensationMinute=mainOffice.getBaseWorkTimeMinute() - actualWorkingMinute;
    }
    this.midnightWorkingMinute=MidnightTime.INSTANCE.calculateContainsMinute(workTimeInterval,actualWorkPlace);
  }
 else {
    if (finishDateTime != null) {
      finishDateTime=null;
      setFinishTime(null);
    }
  }
  if (isWorkDay()) {
    this.tardyOrEarlyLeaving=actualWorkPlace.isTardyOrEarlyLeaving(beginDateTime,finishDateTime);
    if (tardyOrEarlyLeaving) {
      this.compensationMinute=0;
    }
 else     if (beginDateTime == null && !StringUtils.hasLength(specialWorkCode)) {
      this.absence=true;
    }
  }
}

Fixed version (ground truth):
public void calculate(final WorkPlace defaultWorkPlace,final WorkPlace mainOffice){
  clearCalculate();
  if (paidLeave) {
    setBeginTime(mainOffice.getBaseBeginTime());
    setFinishTime(mainOffice.getBaseFinishTime());
    this.actualWorkingMinute=mainOffice.getBaseWorkTimeMinute();
    return;
  }
  WorkPlace actualWorkPlace=workPlace;
  if (actualWorkPlace == null) {
    actualWorkPlace=defaultWorkPlace;
  }
  DateTime beginDateTime=null;
  if (beginTime != null) {
    beginDateTime=BASE_DATE.toDateTime(beginTime);
  }
  DateTime finishDateTime=null;
  if (finishTime != null) {
    finishDateTime=BASE_DATE.toDateTime(finishTime);
  }
  if (beginDateTime != null && finishDateTime != null) {
    if (!beginDateTime.isBefore(finishDateTime)) {
      finishDateTime=finishDateTime.plusDays(1);
    }
    final Interval workTimeInterval=new Interval(beginDateTime,finishDateTime);
    this.actualWorkingMinute=actualWorkPlace.calculateWorkingMinute(workTimeInterval,mainOffice);
    if (actualWorkingMinute < mainOffice.getBaseWorkTimeMinute() && isWorkDay()) {
      this.compensationMinute=mainOffice.getBaseWorkTimeMinute() - actualWorkingMinute;
    }
    this.midnightWorkingMinute=MidnightTime.INSTANCE.calculateContainsMinute(workTimeInterval,actualWorkPlace);
  }
 else {
    if (finishDateTime != null) {
      finishDateTime=null;
      setFinishTime(null);
    }
  }
  if (isWorkDay()) {
    this.tardyOrEarlyLeaving=actualWorkPlace.isTardyOrEarlyLeaving(beginDateTime,finishDateTime);
    if (tardyOrEarlyLeaving) {
      this.compensationMinute=0;
    }
 else     if (beginDateTime == null && !StringUtils.hasLength(specialWorkCode)) {
      this.absence=true;
    }
  }
}