Hi Brian,

Totally understand and agree.

All good from my POV :-)

Have a good evening

Best
Lance
> On Jan 10, 2019, at 5:21 PM, Brian Burkhalter <brian.burkhal...@oracle.com> 
> wrote:
> 
> Hi Lance,
> 
> I was originally going to do that but there are other null checks in the same 
> class and I did not know it would be worthwhile. I would think do none or do 
> all.
> 
> Thanks,
> 
> Brian
> 
>> On Jan 10, 2019, at 2:20 PM, Lance Andersen <lance.ander...@oracle.com 
>> <mailto:lance.ander...@oracle.com>> wrote:
>> 
>> Looks fine Brian.
>> 
>> One question would it be worth using Objects.requireNonNull(dest)?  I have 
>> no strong preference, just wondering your thoughts.
>> 
>> 
>> 
>>> On Jan 10, 2019, at 5:16 PM, Brian Burkhalter <brian.burkhal...@oracle.com 
>>> <mailto:brian.burkhal...@oracle.com>> wrote:
>>> 
>>> https://bugs.openjdk.java.net/browse/JDK-8216172 
>>> <https://bugs.openjdk.java.net/browse/JDK-8216172> 
>>> <https://bugs.openjdk.java.net/browse/JDK-8216172 
>>> <https://bugs.openjdk.java.net/browse/JDK-8216172>>
>>> 
>>> Proposed simple change included below as diff. All pertinent java/io 
>>> regression tests pass.
>>> 
>>> Thanks,
>>> 
>>> Brian
>>> 
>>> --- a/src/java.base/share/classes/java/io/File.java
>>> +++ b/src/java.base/share/classes/java/io/File.java
>>> @@ -1,5 +1,5 @@
>>> /*
>>> - * Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights 
>>> reserved.
>>> + * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights 
>>> reserved.
>>>  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>>>  *
>>>  * This code is free software; you can redistribute it and/or modify it
>>> @@ -29,11 +29,11 @@
>>> import java.net.URL;
>>> import java.net.MalformedURLException;
>>> import java.net.URISyntaxException;
>>> +import java.nio.file.FileSystems;
>>> +import java.nio.file.Path;
>>> +import java.security.SecureRandom;
>>> +import java.util.ArrayList;
>>> import java.util.List;
>>> -import java.util.ArrayList;
>>> -import java.security.SecureRandom;
>>> -import java.nio.file.Path;
>>> -import java.nio.file.FileSystems;
>>> import sun.security.action.GetPropertyAction;
>>> 
>>> /**
>>> @@ -1395,14 +1395,14 @@
>>>      *          If parameter <code>dest</code> is <code>null</code>
>>>      */
>>>     public boolean renameTo(File dest) {
>>> +        if (dest == null) {
>>> +            throw new NullPointerException();
>>> +        }
>>>         SecurityManager security = System.getSecurityManager();
>>>         if (security != null) {
>>>             security.checkWrite(path);
>>>             security.checkWrite(dest.path);
>>>         }
>>> -        if (dest == null) {
>>> -            throw new NullPointerException();
>>> -        }
>>>         if (this.isInvalid() || dest.isInvalid()) {
>>>             return false;
>>>         }
>>> 
>> 
>> 
> 

 <http://oracle.com/us/design/oracle-email-sig-198324.gif>
 <http://oracle.com/us/design/oracle-email-sig-198324.gif> 
<http://oracle.com/us/design/oracle-email-sig-198324.gif>
 <http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance Andersen| 
Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering 
1 Network Drive 
Burlington, MA 01803
lance.ander...@oracle.com <mailto:lance.ander...@oracle.com>



Reply via email to