RFR: 8299827: Add resolved IP address in connection exception for sockets [v2]
Jaikiran Pai
jpai at openjdk.org
Wed Jan 18 14:39:39 UTC 2023
On Wed, 18 Jan 2023 14:23:55 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> Cool, that's really short. I've updated the PR.
>
>> Hello @schmelter-sap, The javadoc of `String.join` states that it can throw a `NullPointerException` if any of the elements in `null`. As far as I can see, the `IOException` that may get thrown, probably isn't guaranteed to have a exception message, in which case this will run into a `NullPointerException`. Perhaps we should guard this code against that possibility?
>
> On JDK 19:
>
>
> jshell> String.join(": ", null, "bar")
> $3 ==> "null: bar"
>
>
>
> As long as the delimiter is not null and the vararg array itself is not null then NPE will not be thrown...
>
> https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/lang/String.html#join(java.lang.CharSequence,java.lang.CharSequence...)
@dfuch, you are right - it looks like the implementation of that API contradicts the javadoc. So I think it might end up being a CSR to update the javadoc to match the current implementation of `String.join()`. Given this, plus what Alan stated about the exception message being non-null in the context of this code, I think what Ralf currently has in this PR, is OK.
-------------
PR: https://git.openjdk.org/jdk/pull/11961
More information about the net-dev
mailing list