RFR: 8275319 java.net.NetworkInterface throws java.lang.Error instead of SocketException

Daniel Fuchs dfuchs at openjdk.java.net
Fri Oct 15 11:25:50 UTC 2021


On Fri, 15 Oct 2021 10:01:19 GMT, Daniel Jeliński <duke at openjdk.java.net> wrote:

> It happens occasionally, as evidenced by JDK-8217298, JDK-8046500 (fixed), JDK-8165665, JDK-8066931, JDK-8057900, JDK-8065559(closed), JDK-8040229, JDK-8065078(fixed), JDK-8068597(fixed), numerous reports on Google (search for "error IP Helper Library"), and an ancient note found in my company's codebase, possibly no longer relevant.

So these Errors do actually happen - thanks for the confirmation, and double thanks for the archeology research. This is very useful to this discussion.

I see that some of the issue you mentioned are suggesting some fixes - like - for instance JDK-8165665. 
It may be that we need to examine each of these on a case-by-case basis. It seems that `GetAdaptersAddresses`, for instance, has more error codes than those we specifically handle - and maybe we need more specific error handling for some of these. 
Maybe throwing `SocketException`, as you suggest, is appropriate for some of these cases. 
Maybe just skipping the interface would be the right choice for others?

If some conditions are not supposed to happen - then I still think that throwing `InternalError` is more appropriate.
I would be afraid that blindly changing all `Error` into `SocketException` would be hiding issues under the carpet, as they would appear as a regular failure...

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

PR: https://git.openjdk.java.net/jdk/pull/5956


More information about the net-dev mailing list