RFR: 8216363: NullPointerException in java.util.logging.Handler#isLoggable

Mandy Chung mandy.chung at oracle.com
Wed Feb 20 18:27:34 UTC 2019


Hi Daniel,

I return today from vacation.

On 2/15/19 10:46 AM, Daniel Fuchs wrote:
> Hi Mandy,
> 
> Here is the new webrev:
> 
> http://cr.openjdk.java.net/~dfuchs/webrev_8216363/webrev.01/

Looks good.

I suggest to make the javadoc clear that isLoggable accepts null
   @param record  a {@code LogRecord} or {@code null}

> It is much nicer than the previous version [1], but unfortunately
> it makes the following JCK tests fail:
> 
> api/java_util/logging/MemoryHandler/IsLoggable.html
> api/java_util/logging/MemoryHandler/Publish.html


JDK-4769466 modified the spec to allow null LogRecord and so
this is JCK test bug that should have been updated in JDK 5.
We should file a bug for these tests.

> These test expect the NPE even though the spec says that false
> should be returned. I believe there was some disconnect between
> the spec and the implementation at some point (see my
> archeological finds [2] and [3] below).

Thanks for finding the history.

> So what should we do?
> 
> Keep webrev.0.1, write CSR and release notes, and fix the
> JCK in 13?

I think fixing the implementation to match the spec per JDK-4769466
is reasonable and no compatibility risk as existing code would not
call MemoryHandler::isLoggable and publish methods with null;
otherwise, it fails with NPE.  There is no spec change for this fix
and no CSR is needed in my opinion.

The JCK test failure is an existing test bug that should be fixed.

Mandy


More information about the core-libs-dev mailing list