FULL PRODUCT VERSION :
A DESCRIPTION OF THE PROBLEM :
Path.getParent() (https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html#getParent--) describes it's behavior as equivalent to `subpath(0, getNameCount()-1)` "if this path has one or more elements, and no root component".
However if the Path has exactly one element, the behavior of these two methods differs; .getParent() returns null, whereas .subpath() raises an IllegalArgumentException "if endIndex is less than or equal to beginIndex".
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Path demo = Paths.get("file");
assert demo.getParent() == null;
demo.subpath(0, demo.getNameCount()-1); // raises an IllegalArgumentException
REPRODUCIBILITY :
This bug can be reproduced always.
A DESCRIPTION OF THE PROBLEM :
Path.getParent() (https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html#getParent--) describes it's behavior as equivalent to `subpath(0, getNameCount()-1)` "if this path has one or more elements, and no root component".
However if the Path has exactly one element, the behavior of these two methods differs; .getParent() returns null, whereas .subpath() raises an IllegalArgumentException "if endIndex is less than or equal to beginIndex".
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Path demo = Paths.get("file");
assert demo.getParent() == null;
demo.subpath(0, demo.getNameCount()-1); // raises an IllegalArgumentException
REPRODUCIBILITY :
This bug can be reproduced always.