RFR: 8297814: (fs) Re-visit Path.getExtension return value

Daniel Fuchs dfuchs at openjdk.org
Tue Dec 6 19:19:00 UTC 2022


On Tue, 6 Dec 2022 18:15:15 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Revise `java.nio.file.Path::getExtension` never to return `null` and to simplify implementing other path manipulations such as removing and replacing the file name extension.

test/jdk/java/nio/file/Path/Extensions.java line 76:

> 74:             {"compress.gzip",  ".gzip"},
> 75:             {"waitwhat.&$!#%", ".&$!#%"},
> 76:             {"6.283185307",    ".283185307"}

For completeness you might also want to include:

a..b
a..b.c
a.b..c
a..b.
.a..b
.a..b.c
.a.b..c
.a..b.
..a..b
..a..b.c
..a.b..c
..a..b.

These tests are cheap :-)

-------------

PR: https://git.openjdk.org/jdk/pull/11545


More information about the nio-dev mailing list