From: <dcr...@hy...> - 2010-01-22 01:03:47
|
Author: dcrutchf Date: 2010-01-21 16:38:18 -0800 (Thu, 21 Jan 2010) New Revision: 14216 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14216 Modified: branches/HQ_4_2_0_PATCH/src/org/hyperic/hq/ui/action/resource/common/monitor/visibility/IndicatorChartsAction.java Log: Added checks for the zero case 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:55:40 UTC (rev 14215) +++ branches/HQ_4_2_0_PATCH/src/org/hyperic/hq/ui/action/resource/common/monitor/visibility/IndicatorChartsAction.java 2010-01-22 00:38:18 UTC (rev 14216) @@ -218,17 +218,23 @@ // ...if so, set low to zero if (low == Double.MAX_VALUE) { low = 0; - - // ..high should not have change either - assert(high == Double.MIN_VALUE); } + if (high == Double.MIN_VALUE) { + high = 0; + } + // ...low should never be greater than high... assert(low <= high); - double avg = (double)total/count; + double avg = 0.0d; - /* TODO Ensure this is true, have seen some odd cases where the data makes these assertion false + // calculate average if count is more than 0... + if (count > 0 && !(low == 0 && high == 0)) { + avg = (double)total/count; + } + + /* TODO Ensure this is true, have seen some odd cases where the data makes these assertion fail // ...low should never be greater than avg... assert(low <= avg); |