-
Bug
-
Resolution: Fixed
-
Major
-
9.6.4
-
None
-
Security Level: Jimmy
-
None
Steps to Reproduce
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?> <zk> <label value="${c:formatNumber(null, '$ ###,###,###.00')}" /> </zk>
Current Result
java.lang.IllegalArgumentException: Cannot format given Object as a Number
java.base/java.text.DecimalFormat.format(DecimalFormat.java:518)
java.base/java.text.Format.format(Format.java:158)
org.zkoss.xel.fn.CommonFns.formatNumber(CommonFns.java:491)
org.zkoss.xel.fn.CommonFns.formatNumber(CommonFns.java:429)
Expected Result
empty string.
Debug Information
- its javadoc mentioned:
... If null, an empty string is returned.
- Since it's called on a zul, it's better to return an empty string instead of throwing a runtime exception. An EL expression also evaluate a null as an empty string, no exception.
Workaround
null check