From: <dcr...@hy...> - 2010-01-21 23:50:55
|
Author: dcrutchf Date: 2010-01-21 15:50:47 -0800 (Thu, 21 Jan 2010) New Revision: 14213 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14213 Modified: branches/HQ_4_2_0_PATCH/src/org/hyperic/hq/ui/action/resource/common/monitor/visibility/IndicatorChartsAction.java Log: Added a check for the case when everything is NaN/Infinity Modified: branches/HQ_4_2_0_PATCH/src/org/hyperic/hq/ui/action/resource/common/monitor/visibility/IndicatorChartsAction.java =================================================================== --- branches/HQ_4_2_0_PATCH/src/org/hyperic/hq/ui/action/resource/common/monitor/visibility/IndicatorChartsAction.java 2010-01-21 23:18:09 UTC (rev 14212) +++ branches/HQ_4_2_0_PATCH/src/org/hyperic/hq/ui/action/resource/common/monitor/visibility/IndicatorChartsAction.java 2010-01-21 23:50:47 UTC (rev 14213) @@ -214,10 +214,32 @@ } } + // This should only happen if every value in the array is NaN/Infinity... + // ...if so, set low to zero + if (low == Double.MAX_VALUE) { + low = 0; + + // ..high should not have change either + assert(high == Double.MIN_VALUE); + } + + // ...low should never be greater than high... + assert(low <= high); + + double avg = (double)total/count; + + /* TODO Ensure this is true, have seen some odd cases where the data makes these assertion false + // ...low should never be greater than avg... + assert(low <= avg); + + // ...avg should never be greater than high... + assert(avg <= high); + */ + final double[] data = new double[MeasurementConstants.IND_LAST_TIME + 1]; data[MeasurementConstants.IND_MIN] = low; - data[MeasurementConstants.IND_AVG] = (double)total/count; + data[MeasurementConstants.IND_AVG] = avg; data[MeasurementConstants.IND_MAX] = high; data[MeasurementConstants.IND_CFG_COUNT] = count; |