RFR JDK-8039390: Unexpected behaviour of String.format with null arguments

Xueming Shen xueming.shen at oracle.com
Fri Aug 7 20:24:22 UTC 2015


Please help review fix for

issue: https://bugs.openjdk.java.net/browse/JDK-8039390
webrev: http://cr.openjdk.java.net/~sherman/8039390

The j.u.Formatter implementation outputs "null/Null" for all conversions
if the argument is null (except 'b'/'B', in which the result is "false/FALSE").
However the API doc only explicitly specifies this behavior for 'b', 'h' and
's'. With the "Unless otherwise specified, passing a null argument to any
method or constructor in this class will cause a  NullPointerException to
be thrown" at the bottom of the spec, it is confusing which one should be
the expected behavior.

The proposed change here is to add explicit wording to cover all conversions.
(Will go through CCC is approved here).


More information about the core-libs-dev mailing list