RFR: 8057113: (fs) Path should have a method to obtain the filename extension [v2]
Brian Burkhalter
bpb at openjdk.java.net
Mon Feb 1 17:59:00 UTC 2021
On Sun, 31 Jan 2021 12:39:54 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8057113: Changes pursuant to PR conversation
>
> src/java.base/share/classes/java/nio/file/Path.java line 259:
>
>> 257: * characters, does not contain a dot, only the first character is a dot,
>> 258: * or the last character is a dot.
>> 259: *
>
> Thanks for bringing this one back. The survey and the current proposal seems reasonable.
>
> The spec will need cover the case that the Path doesn't have a file name (getFileName can return null so I assume the prototype implementation will NPE in that case). Are you planning to return null or the empty String for this case?
>
> "file name string" needs to be replaced with "the String representation of the file name". This is significant aspect of the proposal in that it aligns the method with toString rather than other operations that preserve the platform representation of the path.
The `getFileName() == null` case was an oversight. I think the empty string should be returned in this case.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2319
More information about the nio-dev
mailing list