-
Bug
-
Resolution: Fixed
-
P2
-
7.0_b04
-
b48
-
generic
-
generic
-
Verified
In headless mode listeners that were added using method
java.awt.Toolkit.addAWTEventListener(AWTEventListener listener, long eventMask)
are not returned by method
java.awt.Toolkit.getAWTEventListeners(long eventMask)
Please see the following code sample (should be executed with VM arg "-Djava.awt.headless=true" )
----------------
import java.awt.event.AWTEventListener;
import java.awt.*;
public class Temp {
public static void main(String[] args) {
Toolkit toolkit = Toolkit.getDefaultToolkit();
toolkit.addAWTEventListener(new AWTEventListener() {
public void eventDispatched(AWTEvent event) { }
}, AWTEvent.CONTAINER_EVENT_MASK);
if ( toolkit.getAWTEventListeners(AWTEvent.CONTAINER_EVENT_MASK).length == 0 ) {
throw new RuntimeException("An empty array returned unexpectedly");
}
}
}
----------------
The problem was cought by JCK QA on JDK7 b32
Due to this problem the following JCK test fails in Headless mode, but passes with display.
api/java_awt/Toolkit/index.html#GetAWTEventListeners[GetAWTEventListeners_4]: Failed. An empty array returned unexpectedly
java.awt.Toolkit.addAWTEventListener(AWTEventListener listener, long eventMask)
are not returned by method
java.awt.Toolkit.getAWTEventListeners(long eventMask)
Please see the following code sample (should be executed with VM arg "-Djava.awt.headless=true" )
----------------
import java.awt.event.AWTEventListener;
import java.awt.*;
public class Temp {
public static void main(String[] args) {
Toolkit toolkit = Toolkit.getDefaultToolkit();
toolkit.addAWTEventListener(new AWTEventListener() {
public void eventDispatched(AWTEvent event) { }
}, AWTEvent.CONTAINER_EVENT_MASK);
if ( toolkit.getAWTEventListeners(AWTEvent.CONTAINER_EVENT_MASK).length == 0 ) {
throw new RuntimeException("An empty array returned unexpectedly");
}
}
}
----------------
The problem was cought by JCK QA on JDK7 b32
Due to this problem the following JCK test fails in Headless mode, but passes with display.
api/java_awt/Toolkit/index.html#GetAWTEventListeners[GetAWTEventListeners_4]: Failed. An empty array returned unexpectedly