RFR: 8256461: AbstractFileSystemProvider.getSunPathForSocketCall for empty Path returns '.'

Michael McMahon michael.x.mcmahon at oracle.com
Tue Nov 17 14:05:41 UTC 2020


On 17/11/2020 14:00, Alan Bateman wrote:
>
>
> On 17/11/2020 13:47, Michael McMahon wrote:
>> Could I get the following change reviewed please?
>>
>> The problem results from 
>> AbstractFileSystemProvider.getSunPathForSocketCall  returning a path 
>> of '.' when given an empty path argument. The socket API needs an 
>> empty path byte[] in this situation. It causes a BindException which 
>> is actually correct, but the error message is confusing because "." 
>> always exists and the error message is saying 'path already exists' 
>> when the actual error is that server socket channels cannot be bound 
>> to the empty path.
> Can method description of getSunPathForSocketPath be updated to align 
> with the new behavior? Also can you fix the exception in 
> UnixDomainSocekts so that the casing is consistent with the other 
> exceptions.
>

Okay.


> I don't think test/sun/nio/fs is the right place for the test. Would 
> it be better to create a test in test/jdk/java/nio/channels/unixdomain 
> to check that bind throws an exception?
>

The problem is that bind already throws a BindException, but for a 
different (confusing and incorrect)
reason. I didn't really want to put a test in checking the exception 
text, and thought a white box test
of the lower level method might be better.


Thanks,

Michael

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20201117/f8325a26/attachment-0001.htm>


More information about the nio-dev mailing list