Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8084821 | emb-9 | Brian Burkhalter | P4 | Resolved | Fixed | team |
This is about java.nio.file.AtomicMoveNotSupportedException class and what is the correct behave when the reason is null in the constructor AtomicMoveNotSupportedException(String source, String target,String reason).
Here is the spec from both the SE7 and SE 8:
=================================================================
public AtomicMoveNotSupportedException(String source, String target,String reason)
Constructs an instance of this class.
Parameters:
source - a string identifying the source file or null if not known
target - a string identifying the target file or null if not known
reason - a reason message with additional information
====================================================
And in the java.nio.file package description, we have the following:
"General Exceptions
Unless otherwise noted, passing a null argument to a constructor or method of any class or interface in this package will cause a NullPointerException to be thrown"
So based on the above spec, NPE should be expected when the reason is null used in the above constructor.
However, on both the jdk7 and jdk8 implementation, NPE is not thrown in this case. Worth to mention that the JCK already enforces incorrect behavior since SE7, which means we have jck test which checks that no NPE is thrown when the null reason is used, and this is exactly what the current behave is for both the jdk7 and jdk8.
So, is it possible to fix the spec issue for SE 8 to allow null reason value ?
the super class FileSystemException does allow null reason though.
Here is the spec from both the SE7 and SE 8:
=================================================================
public AtomicMoveNotSupportedException(String source, String target,String reason)
Constructs an instance of this class.
Parameters:
source - a string identifying the source file or null if not known
target - a string identifying the target file or null if not known
reason - a reason message with additional information
====================================================
And in the java.nio.file package description, we have the following:
"General Exceptions
Unless otherwise noted, passing a null argument to a constructor or method of any class or interface in this package will cause a NullPointerException to be thrown"
So based on the above spec, NPE should be expected when the reason is null used in the above constructor.
However, on both the jdk7 and jdk8 implementation, NPE is not thrown in this case. Worth to mention that the JCK already enforces incorrect behavior since SE7, which means we have jck test which checks that no NPE is thrown when the null reason is used, and this is exactly what the current behave is for both the jdk7 and jdk8.
So, is it possible to fix the spec issue for SE 8 to allow null reason value ?
the super class FileSystemException does allow null reason though.
- backported by
-
JDK-8084821 (fs) AtomicMoveNotSupportedException allows reason to be null
-
- Resolved
-