Classload of sun.nio.ch.Net fails - regression in jdk7u25

Martin Buchholz martinrb at google.com
Thu Sep 19 17:17:27 UTC 2013


Hi, this is a bug report.

Here is a tiny program that does class loading:

public class LoadClass {
    public static void main(String[] args) throws Throwable {
        for (String className : args)
            Class.forName(className, true, null);
    }
}

If I run this against 1.7.0_21, it succeeds, but if I run it against
1.7.0_25 I get

java LoadClass sun.nio.ch.Net
Exception in thread "main" java.lang.UnsatisfiedLinkError:
sun.nio.ch.Net.isExclusiveBindAvailable()I
at sun.nio.ch.Net.isExclusiveBindAvailable(Native Method)
at sun.nio.ch.Net.<clinit>(Net.java:58)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)

sun.nio.ch.Net clearly tries to prevent this from happening by calling
Util.load(), but the problem is that the static block is called too late.
 Those static blocks calling Util.load() need to be at the top of each
source file instead of the bottom, to prevent such failures.

Regression was introduced with this changeset:

changeset:   6272:8dd8266a2f4b
user:        khazra
date:        Thu Mar 14 13:54:32 2013 -0700
summary:     7170730: Improve Windows network stack support.

I think Oracle testing folks should regularly run the above little program
against every single class in the JDK (although it might be too expensive
to run in a jtreg test).

The fix is obvious, but I can provide a webrev if desired.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20130919/6abe6824/attachment.html 


More information about the nio-dev mailing list