outputStr = outputStr + taskUtils.getQuantity(aTask, ar); } catch (RuntimeException re) { if (re.getMessage().indexOf("Assertion botch:") > -1) { String errorString = "Assertion Botch: start time: " + startTime; errorString += (" end time: " + endTime); errorString += (" UID: " + aTask.getUID()); double d = taskUtils.getQuantity(aTask,ar); long dbits = Double.doubleToLongBits(d); long rbits = Double.doubleToRawLongBits(d); errorString += ("quantity_d: " + Long.toHexString(dbits)); errorString += ("quantity_r: " + Long.toHexString(rbits)); logger.error(errorString); } throw re; }
double dQuantity=taskUtils.getQuantity(aTask,ar); if(!expandTimestamp) { long dbits = Double.doubleToLongBits(dQuantity); outputStr = outputStr + Long.toHexString(dbits); } else { String testStr = outputStr + dQuantity; outputStr = testStr; } } catch (RuntimeException re) { if (re.getMessage().indexOf("Assertion botch:") > -1) { outputStr = outputStr + "Assertion botch!"; String itemId = taskUtils.getTaskItemName(aTask); TypeIdentificationPG typeIdPG = logInvPG.getResource().getTypeIdentificationPG(); String nomenclature= null; String orgId = logInvPG.getOrg().getItemIdentificationPG().getItemIdentification(); if (typeIdPG == null) { logger.warn("No typeIdentificationPG for asset"); } else { nomenclature = typeIdPG.getNomenclature(); } if (nomenclature == null) { nomenclature = itemId; } String errorString = "Assertion Botch on non-phased AllocationResult: start time: " + getDateString(startTime,true); errorString += (" end time: " + getDateString(endTime,true)); errorString += (" UID: " + aTask.getUID()); errorString += (" NSN: " + itemId + ":" + nomenclature); errorString += (" at Org " + orgId + " "); double dQuantity=taskUtils.getQuantity(aTask,ar); long dbits = Double.doubleToLongBits(dQuantity); long rbits = Double.doubleToRawLongBits(dQuantity); errorString += (" quantity_d: " + Long.toHexString(dbits)); errorString += (" quantity_r: " + Long.toHexString(rbits)); logger.error(errorString,re); } else { throw re; } }
  protected void logAllocationResult(Task aTask, boolean expandTimestamp, boolean isCountedAR) {    if (aTask == null) {      return;    }    PlanElement pe = aTask.getPlanElement();    if (pe == null) {      return;    }    String resultType = AR_REPORTED_STR;    AllocationResult ar = pe.getReportedResult();    if (ar == null) {      resultType = AR_ESTIMATED_STR;      ar = pe.getEstimatedResult();    }    if (ar != null) {      String taskStr = buildTaskPrefixString(aTask);      taskStr = taskStr + resultType + ",";      if (ar.isSuccess()) {        taskStr = taskStr + AR_SUCCESS_STR + ",";      } else {        taskStr = taskStr + AR_FAILURE_STR + ",";      }      if (!ar.isPhased()) {        long startTime = (long) TaskUtils.getStartTime(ar);        long endTime = (long) TaskUtils.getEndTime(ar);        if (isCountedAR &&            (TaskUtils.isProjection(aTask))) {          startTime = logInvPG.getEffectiveProjectionStart(aTask, startTime);          if (startTime >= endTime) {            return;          }        }        String outputStr = taskStr + getDateString(startTime, expandTimestamp) + ",";        outputStr = outputStr + getDateString(endTime, expandTimestamp) + ",";	try {        outputStr = outputStr + taskUtils.getQuantity(aTask, ar);   } catch (RuntimeException re) {      if (re.getMessage().indexOf("Assertion botch:") > -1) {        String errorString = "Assertion Botch: start time: " + startTime;        errorString += (" end time: " + endTime);	errorString += (" UID: " + aTask.getUID());        double d = taskUtils.getQuantity(aTask,ar); // don't print me!!!        long dbits = Double.doubleToLongBits(d);        long rbits = Double.doubleToRawLongBits(d);        errorString += ("quantity_d: " + Long.toHexString(dbits));        errorString += ("quantity_r: " + Long.toHexString(rbits));        logger.error(errorString);      }      throw re;  // re-throw for now    }        writeln(outputStr);      } else {        int[] ats = ar.getAspectTypes();        int qtyInd = -1;        if (taskUtils.isProjection(aTask)) {          qtyInd = getIndexForType(ats, AlpineAspectType.DEMANDRATE);        } else {          qtyInd = getIndexForType(ats, AspectType.QUANTITY);        }        int startInd = getIndexForType(ats, AspectType.START_TIME);        int endInd = getIndexForType(ats, AspectType.END_TIME);        Enumeration phasedResults = ar.getPhasedResults();        while (phasedResults.hasMoreElements()) {          double[] results = (double[]) phasedResults.nextElement();          String outputStr = taskStr;          long startTime = 0;          long endTime;          if (startInd == -1) {            outputStr += ",";          } else {            startTime = (long) results[startInd];            if (isCountedAR &&                (TaskUtils.isProjection(aTask))) {              startTime = logInvPG.getEffectiveProjectionStart(aTask, startTime);            }            outputStr += getDateString(startTime, expandTimestamp) + ",";          }          if (endInd == -1) {            /** MWD The following line of code which replaces the             *  allocation result end time with the task end time             *  is only due to a current error in the             *  UniversalAllocator.   The UA is only setting             *  the start time in the allocation result. There             *  is a bug in and when the UA is fixed this line             *  of code should be removed. If there is no end time             *  in the allocation result, none should be appended.             *  GUI needs the end             *  times for the rates.             */            endTime = TaskUtils.getEndTime(aTask);            outputStr += getDateString(endTime, expandTimestamp);            outputStr += ",";          } else {            endTime = (long) results[endInd];            outputStr += getDateString(endTime, expandTimestamp) + ",";          }          if ((qtyInd >= results.length) ||              (qtyInd < 0)) {            logger.error("qtyInd is " + qtyInd + " - No Qty in this phase of allocation results: " + outputStr);          } else {            outputStr += taskUtils.convertResultsToDailyRate(aTask, results[qtyInd]);            if (startTime <= endTime) {              writeln(outputStr);            } else if (!isCountedAR) {              logger.warn("logAllocationResult: not going to log an allocation result where endTime is less than start time.  CSV line is is:" + outputStr);            }          }        }      }    }  }