String[] keys = metricDisplaySummary.getMetricKeys();
if (keys.length != formattedValues.length) {
throw new IllegalStateException("Formatting metrics failed.");
}
for (int i = 0; i < keys.length; i++) {
MeasurementValueAndUnits valueAndUnits = formattedValues[i];
String formatted = MeasurementConverter.format(((Double) valueAndUnits.getValue()), valueAndUnits
.getUnits(), true);
metricDisplaySummary.getMetric(keys[i]).setValueFmt(formatted);
}
}
} catch (IllegalArgumentException e) { // catch and rethrow for debug/logging only