Code Review Request: 7160242: (prefs) Preferences.remove(null) does not throw NPE [macosx]

Kurchi Hazra kurchi.subhra.hazra at oracle.com
Tue Apr 24 21:49:43 UTC 2012


Hi,

Updated webrev:
http://cr.openjdk.java.net/~khazra/7160242/webrev.01/

Thanks,
Kurchi

On 4/21/2012 4:23 AM, Rémi Forax wrote:
> On 04/21/2012 09:52 AM, Alan Bateman wrote:
>> On 20/04/2012 20:09, Kurchi Subhra Hazra wrote:
>>> Hi,
>>>
>>> This change inserts a null check for the key being passed to 
>>> Preferences.remove() on Mac, so that
>>> the method throws a NullPointerException when key is null (according 
>>> to its specification).
>>>
>>> Bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7160242
>>> Webrev: http://cr.openjdk.java.net/~khazra/7160242/webrev.00/ 
>>> Thanks, Kurchi
>> Kurchi - would you be able to add a test to test/java/util/prefs so 
>> that we have coverage for this case?
>>
>> -Alan.
>
> Also you can use Objects.requireNonNull()
> http://docs.oracle.com/javase/7/docs/api/java/util/Objects.html#requireNonNull%28T,%20java.lang.String%29 
>
>
> Rémi
>

-- 
-Kurchi




More information about the core-libs-dev mailing list