Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Use of the bug level variable -Dsun.nio.ch.bugLevel=1.4

843798Jan 14 2009
Hi,
I wanted to understand how java uses the variable sun.nio.ch.bugLevel .. and what is the value that it needs to be set. searching for this variable gave me a result where some one has set -Dsun.nio.ch.bugLevel=1.4 as the jvm option.

ISSUE: I am randomly encountering a NullPointerException while calling Selector.open

CAUSE:
Here is the stack trace:

"java.lang.NullPointerException
at sun.nio.ch.Util.atBugLevel(Util.java:326)
at sun.nio.ch.SelectorImpl.<init>(SelectorImpl.java:40)
at sun.nio.ch.WindowsSelectorImpl.<init>(WindowsSelectorImpl.java:104)
at sun.nio.ch.WindowsSelectorProvider.openSelector(WindowsSelectorProvider.java:26)
at java.nio.channels.Selector.open(Selector.java:209)

This is cause due to a bug in java 1.5 (which has been fixed in Java 7)
http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=9ea0db6110bd136e5288fa753945f?bug_id=6427854
This bug has not yet been fixed in Java 1.5

Here is the excerpt from the java 7 code:
https://openjdk.dev.java.net/source/browse/openjdk/jdk/trunk/jdk/src/share/classes/sun/nio/ch/Util.java?rev=257&view=markup

// -- Bug compatibility --

private static volatile String bugLevel = null;

static boolean atBugLevel(String bl) { // package-private
if (bugLevel == null) {
if (!sun.misc.VM.isBooted())
return false;
String value = AccessController.doPrivileged(
new GetPropertyAction("sun.nio.ch.bugLevel"));
bugLevel = (value != null) ? value : "";
}
return bugLevel.equals(bl);
}

java -version "1.5.0_15"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_15-b04)
Java HotSpot(TM) Client VM (build 1.5.0_15-b04, mixed mode, sharing)





Thanks in advance


Vijay

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Feb 11 2009
Added on Jan 14 2009
0 comments
960 views