RFR 8057113: (fs) Path should have a method to test the filename extension

Brian Burkhalter brian.burkhalter at oracle.com
Fri Feb 16 18:06:37 UTC 2018


On Feb 16, 2018, at 8:48 AM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:

> On Feb 16, 2018, at 6:26 AM, David Lloyd <david.lloyd at redhat.com> wrote:
> 
>> If lastDot is 0 or all the characters preceding lastDot are '.' then
>> "" should be returned as well; this for example will not only return
>> wrong results for ".." but also e.g. ".vimrc".
> 
> You are correct about “.vimrc” but the other cases appear to pass (expected result in the test is “” for these four cases):

This seems to be getting too complicated with all the special cases. Perhaps this should just be re-specified simply always to return

getFileName().substring(getFileName().lastIndexOf(‘.”) + 1)

unless getFileName() returns null or lastIndexOf(‘.’) returns -1 in which cases “” would be returned?

Thanks,

Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20180216/958c5be0/attachment.html>


More information about the nio-dev mailing list