1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/BarChartFormatter.java Sun Sep 06 21:46:03 2015 +0200
1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/BarChartFormatter.java Sun Sep 06 21:48:54 2015 +0200
1.3 @@ -61,9 +61,10 @@
1.4 BigDecimal minimum = BigDecimal.ZERO;
1.5 int lastIndex = currentHeader.getColumnCount() - 1;
1.6
1.7 + Object valueObject = null;
1.8 try {
1.9 for (Object[] row : currentResultSet) {
1.10 - Object valueObject = row[lastIndex];
1.11 + valueObject = row[lastIndex];
1.12 if (valueObject != null) {
1.13 BigDecimal value = new BigDecimal(valueObject.toString());
1.14 maximum = maximum.max(value);
1.15 @@ -74,8 +75,10 @@
1.16 BigDecimal range = maximum.subtract(minimum);
1.17
1.18 for (Object[] row : currentResultSet) {
1.19 - Object valueObject = row[lastIndex];
1.20 - if (valueObject != null) {
1.21 + valueObject = row[lastIndex];
1.22 + if (valueObject == null) {
1.23 + row[lastIndex] = "";
1.24 + } else {
1.25 BigDecimal value = new BigDecimal(valueObject.toString());
1.26 BigDecimal valueFromMinimum = value.subtract(minimum);
1.27
1.28 @@ -87,7 +90,7 @@
1.29
1.30 } catch (NumberFormatException e) {
1.31 // https://en.wiktionary.org/wiki/parsable
1.32 - log.log(Level.SEVERE, "Last column must be number or an object with toString() value parsable to a number.");
1.33 + log.log(Level.SEVERE, "Last column must be number or an object with toString() value parsable to a number. But was „{0}“", valueObject);
1.34 // FIXME: throw FormatterException
1.35 throw e;
1.36 }