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

Roger Riggs Roger.Riggs at Oracle.com
Tue Aug 11 15:12:12 UTC 2015

Hi Sherman,

The spec clarifications and the new test look fine.

Thanks, Roger

On 8/7/15 1:24 PM, Xueming Shen wrote:
> Hi,
> 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).
> Thanks,
> Sherman

More information about the core-libs-dev mailing list