Fix bug: Cannot render GlobalProgress Chart

String.format caused a syntax error in Javascript. Depending on
the locale settings a double could be formatted as "X,YY" instead
of "X.YY", as expected.

Use Local.ROOT to force doubles to be formatted as "X.YY"

FEA: ItEr76S15OrganizingPerProjectDashboard
This commit is contained in:
Diego Pino 2012-06-07 19:16:49 +02:00
parent 33f39407bf
commit 1021a8770f

View file

@ -26,6 +26,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
@ -82,7 +83,7 @@ public class GlobalProgressChart {
int i = 1;
for (BigDecimal each : array) {
result.add(String.format("[%.2f, %d]", each.doubleValue(), i++));
result.add(String.format(Locale.ROOT, "[%.2f, %d]", each.doubleValue(), i++));
}
return String.format("[%s]", StringUtils.join(result, ","));
}