printError("Refuse to adjust task End Date to before Start Date: "+ beginDate);
printError(".updateFailedTaskPreferences - Found failed task " + t.getUID() + "\nTried to move the end date preference back and reissue, but couldn't " + "\nSince refusing to adjust task End Date to before Start Date: "+ beginDate +"\nCurrent end date preferences :\n" + "Early " + oldEndEarliestDate + "Best  " + oldEndEarliestDate + "Late  " + oldEndLatestDate + "\nAttempted (adjusting back " + adjustDurationDays + " days) end dates :\n" + "Early " + newEndEarliestDate + "Best  " + newEndEarliestDate + "Late  " + newEndLatestDate);
  protected boolean updateFailedTaskPreferences(      NewTask t, int adjustDurationDays, Date earliestDate) {    if (DEBUG) {      printDebug("Adjust task begin/end dates");    }    AspectValue beginAspect;    Date beginDate;    try {      // get begin date      Preference beginPref = t.getPreference(AspectType.START_TIME);      beginAspect =        beginPref.getScoringFunction().getBest().getAspectValue();      beginDate = new Date(beginAspect.longValue());      if (DEBUG) {        printDebug("  Start: "+ beginDate);      }    } catch (Exception e) {      printError("Unable to get failed task begin date: "+e.getMessage());      return false;    }    AspectValue endEarliestAspect;    AspectValue endBestAspect;    AspectValue endLatestAspect;    Date oldEndEarliestDate;    Date oldEndBestDate;    Date oldEndLatestDate;    try {      // get end dates (earliest, best, and latest)      Preference endPref = t.getPreference(AspectType.END_TIME);      ScoringFunction endSF = endPref.getScoringFunction();      Enumeration endVRs = endSF.getValidRanges(null,null);      AspectScoreRange endASR = (AspectScoreRange)endVRs.nextElement();      endEarliestAspect =         endASR.getRangeStartPoint().getAspectValue();      endBestAspect =        endSF.getBest().getAspectValue();      endLatestAspect =        endASR.getRangeEndPoint().getAspectValue();      oldEndEarliestDate = new Date(endEarliestAspect.longValue());      oldEndBestDate = new Date(endBestAspect.longValue());      oldEndLatestDate = new Date(endLatestAspect.longValue());      if (DEBUG) {        printDebug("  Old End:\n    "+oldEndEarliestDate+" <= "+                   oldEndBestDate+" <= "+oldEndLatestDate);      }    } catch (Exception e) {      printError("Unable to get failed task end dates: "+e.getMessage());      return false;    }    try {      // slide end dates      Date newEndEarliestDate =        ShortDateFormat.adjustDate(oldEndEarliestDate, 0, adjustDurationDays);      Date newEndBestDate =         ShortDateFormat.adjustDate(oldEndBestDate, 0, adjustDurationDays);      Date newEndLatestDate =         ShortDateFormat.adjustDate(oldEndLatestDate, 0, adjustDurationDays);      if (DEBUG) {        printDebug("  New End:\n    "+newEndEarliestDate+" <= "+                   newEndBestDate+" <= "+newEndLatestDate);      }      // check dates      if (!beginDate.before(newEndEarliestDate)) {        printError("Refuse to adjust task End Date to before Start Date: "+                   beginDate);        return false;      }      if ((earliestDate != null) &&          !earliestDate.before(newEndEarliestDate)) {        printError("Refuse to adjust task Dates to before: "+earliestDate);        return false;      }      // set the new end dates      endEarliestAspect.setValue(newEndEarliestDate.getTime());      endBestAspect.setValue(newEndBestDate.getTime());      endLatestAspect.setValue(newEndLatestDate.getTime());      publishChange((Task) t);    } catch (Exception e) {      printError("Unable to adjust failed task end dates: "+e.getMessage());      return false;    }    return true;  }