Change the function ‘getValue’ in the ‘CreateLogObject.java’ to:
private static String getValue(IMendixObjectMember<?> member, boolean fromCache, IContext context) {
Object value = null;
// Values from cache
if (fromCache == true)
value = member.getValue(context);
// Values form DB
else
value = member.getOriginalValue(context);
if (value != null) {
if (value instanceof Date)
return parseDate((Date) value, context);
else if (value instanceof String)
return parseString((String) value);
// 20160825 - Ivo Sturm: added for proper Decimal handling.
// In database it is stored with 8 trailing zeros after the comma, in cache it doesn't have,
// which incorrectly was creating LogLines...
else if (value instanceof BigDecimal){
_logNode.trace("BigDecimal member: " + member.getName() + ", value: " + value);
String s = String.valueOf(value);
s = s.indexOf(".") < 0 ? s : s.replaceAll("0*$", "").replaceAll("\\.$", "");
_logNode.trace("BigDecimal member deleted trailing zeros to: " + member.getName() + ", value: " + s);
return s;
}
return String.valueOf( value ).trim();
} else
return "";
}
This will:
private static String getValue(IMendixObjectMember<?> member, boolean fromCache, IContext context) {
Object value = null;
// Values from cache
if (fromCache == true)
value = member.getValue(context);
// Values form DB
else
value = member.getOriginalValue(context);
if (value != null) {
if (value instanceof Date)
return parseDate((Date) value, context);
else if (value instanceof String)
return parseString((String) value);
// 20160825 - Ivo Sturm: added for proper Decimal handling.
// In database it is stored with 8 trailing zeros after the comma, in cache it doesn't have,
// which incorrectly was creating LogLines...
else if (value instanceof BigDecimal){
_logNode.trace("BigDecimal member: " + member.getName() + ", value: " + value);
value = ((BigDecimal) value).setScale(2, RoundingMode.CEILING);
String s = String.valueOf(value);
_logNode.trace("BigDecimal member deleted trailing zeros to: " + member.getName() + ", value: " + s);
return s;
}
return String.valueOf( value ).trim();
} else
return "";
}
If you insist you need RoundingMode.CEILING, I would suggest making this an explicit configuration setting. Ceiling is not a sensible default.