JDK-8279256 : Focus/ActualFocusedWindowTest: The owner's component [Frame_Button] couldn't be focused as the most recent focus owner
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 11,17,18
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux_ubuntu
  • Submitted: 2021-12-24
  • Updated: 2024-04-23
  • Resolved: 2024-04-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 23
23Resolved
Related Reports
Duplicate :  
Description
The test java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowBlockingTest.java fails with the following diagnostic:

-----------------------------8<-----------------------------
#section:main
----------messages:(5/224)----------
command: main ActualFocusedWindowBlockingTest
reason: User specified action: run main ActualFocusedWindowBlockingTest 
Mode: othervm
Additional options from @modules: --add-modules java.desktop
elapsed time (seconds): 2.405
----------configuration:(3/40)----------
Boot Layer
  add modules: java.desktop

----------System.out:(53/7396)----------
--> java.awt.event.WindowEvent[WINDOW_GAINED_FOCUS,opposite=null,oldState=0,newState=0] on OWNER_FRAME
--> java.awt.event.FocusEvent[FOCUS_GAINED,permanent,opposite=null,cause=ACTIVATION] on button0
--> java.awt.event.FocusEvent[FOCUS_LOST,temporary,opposite=Window_Button,cause=ACTIVATION] on button0
--> java.awt.event.WindowEvent[WINDOW_LOST_FOCUS,opposite=java.awt.Window[OWNED_WINDOW,100,200,400x150,layout=java.awt.FlowLayout],oldState=0,newState=0] on OWNER_FRAME
--> java.awt.event.WindowEvent[WINDOW_GAINED_FOCUS,opposite=java.awt.Frame[OWNER_FRAME,100,27,400x150,invalid,layout=java.awt.FlowLayout,title=Owner Frame,resizable,normal],oldState=0,newState=0] on OWNED_WINDOW
--> java.awt.event.FocusEvent[FOCUS_GAINED,permanent,opposite=Frame_Button,cause=ACTIVATION] on button1
--> java.awt.event.FocusEvent[FOCUS_LOST,temporary,opposite=Auxiliary_Button,cause=ACTIVATION] on button1
--> java.awt.event.WindowEvent[WINDOW_LOST_FOCUS,opposite=java.awt.Frame[AUX_FRAME,100,400,400x150,layout=java.awt.FlowLayout,title=Auxiliary Frame,resizable,normal],oldState=0,newState=0] on OWNED_WINDOW
--> java.awt.event.WindowEvent[WINDOW_GAINED_FOCUS,opposite=java.awt.Window[OWNED_WINDOW,100,200,400x150,layout=java.awt.FlowLayout],oldState=0,newState=0] on AUX_FRAME
--> java.awt.event.FocusEvent[FOCUS_GAINED,permanent,opposite=Window_Button,cause=ACTIVATION] on button2

Test started:

--> java.awt.event.FocusEvent[FOCUS_LOST,temporary,opposite=Window_Button,cause=ACTIVATION] on button2
--> java.awt.event.WindowEvent[WINDOW_LOST_FOCUS,opposite=java.awt.Window[OWNED_WINDOW,100,200,400x150,layout=java.awt.FlowLayout],oldState=0,newState=0] on AUX_FRAME
--> java.awt.event.WindowEvent[WINDOW_GAINED_FOCUS,opposite=java.awt.Frame[AUX_FRAME,100,400,400x150,layout=java.awt.FlowLayout,title=Auxiliary Frame,resizable,normal],oldState=0,newState=0] on OWNED_WINDOW
--> java.awt.event.FocusEvent[FOCUS_GAINED,permanent,opposite=Auxiliary_Button,cause=ACTIVATION] on button1
--> java.awt.event.FocusEvent[FOCUS_LOST,temporary,opposite=Auxiliary_Button,cause=ACTIVATION] on button1
--> java.awt.event.WindowEvent[WINDOW_LOST_FOCUS,opposite=java.awt.Frame[AUX_FRAME,100,400,400x150,layout=java.awt.FlowLayout,title=Auxiliary Frame,resizable,normal],oldState=0,newState=0] on OWNED_WINDOW
--> java.awt.event.WindowEvent[WINDOW_GAINED_FOCUS,opposite=java.awt.Window[OWNED_WINDOW,100,200,400x150,layout=java.awt.FlowLayout],oldState=0,newState=0] on AUX_FRAME
--> java.awt.event.FocusEvent[FOCUS_GAINED,permanent,opposite=Window_Button,cause=ACTIVATION] on button2
--> java.awt.event.FocusEvent[FOCUS_LOST,temporary,opposite=Frame_Button,cause=ACTIVATION] on button2
--> java.awt.event.WindowEvent[WINDOW_LOST_FOCUS,opposite=java.awt.Frame[OWNER_FRAME,100,27,400x150,invalid,layout=java.awt.FlowLayout,title=Owner Frame,resizable,normal],oldState=0,newState=0] on AUX_FRAME
--> java.awt.event.WindowEvent[WINDOW_GAINED_FOCUS,opposite=java.awt.Frame[AUX_FRAME,100,400,400x150,layout=java.awt.FlowLayout,title=Auxiliary Frame,resizable,normal],oldState=0,newState=0] on OWNER_FRAME
--> java.awt.event.FocusEvent[FOCUS_GAINED,permanent,opposite=Auxiliary_Button,cause=ACTIVATION] on button0
--> java.awt.event.FocusEvent[FOCUS_LOST,temporary,opposite=Window_Button,cause=ACTIVATION] on button0
--> java.awt.event.WindowEvent[WINDOW_LOST_FOCUS,opposite=java.awt.Window[OWNED_WINDOW,100,200,400x150,layout=java.awt.FlowLayout],oldState=0,newState=0] on OWNER_FRAME
--> java.awt.event.WindowEvent[WINDOW_GAINED_FOCUS,opposite=java.awt.Frame[OWNER_FRAME,100,27,400x150,invalid,layout=java.awt.FlowLayout,title=Owner Frame,resizable,normal],oldState=0,newState=0] on OWNED_WINDOW
--> java.awt.event.FocusEvent[FOCUS_GAINED,permanent,opposite=Frame_Button,cause=ACTIVATION] on button1
--> java.awt.event.FocusEvent[FOCUS_LOST,temporary,opposite=Auxiliary_Button,cause=ACTIVATION] on button1
--> java.awt.event.WindowEvent[WINDOW_LOST_FOCUS,opposite=java.awt.Frame[AUX_FRAME,100,400,400x150,layout=java.awt.FlowLayout,title=Auxiliary Frame,resizable,normal],oldState=0,newState=0] on OWNED_WINDOW
--> java.awt.event.WindowEvent[WINDOW_GAINED_FOCUS,opposite=java.awt.Window[OWNED_WINDOW,100,200,400x150,layout=java.awt.FlowLayout],oldState=0,newState=0] on AUX_FRAME
--> java.awt.event.FocusEvent[FOCUS_GAINED,permanent,opposite=Window_Button,cause=ACTIVATION] on button2
--> java.awt.event.FocusEvent[FOCUS_LOST,temporary,opposite=Frame_Button,cause=ACTIVATION] on button2
--> java.awt.event.WindowEvent[WINDOW_LOST_FOCUS,opposite=java.awt.Frame[OWNER_FRAME,100,27,400x150,invalid,layout=java.awt.FlowLayout,title=Owner Frame,resizable,normal],oldState=0,newState=0] on AUX_FRAME
--> java.awt.event.WindowEvent[WINDOW_GAINED_FOCUS,opposite=java.awt.Frame[AUX_FRAME,100,400,400x150,layout=java.awt.FlowLayout,title=Auxiliary Frame,resizable,normal],oldState=0,newState=0] on OWNER_FRAME
--> java.awt.event.FocusEvent[FOCUS_GAINED,permanent,opposite=Auxiliary_Button,cause=ACTIVATION] on button0
--> java.awt.event.FocusEvent[FOCUS_LOST,temporary,opposite=Window_Button,cause=ACTIVATION] on button0
--> java.awt.event.WindowEvent[WINDOW_LOST_FOCUS,opposite=java.awt.Window[OWNED_WINDOW,100,200,400x150,layout=java.awt.FlowLayout],oldState=0,newState=0] on OWNER_FRAME
--> java.awt.event.WindowEvent[WINDOW_GAINED_FOCUS,opposite=java.awt.Frame[OWNER_FRAME,100,27,400x150,invalid,layout=java.awt.FlowLayout,title=Owner Frame,resizable,normal],oldState=0,newState=0] on OWNED_WINDOW
--> java.awt.event.FocusEvent[FOCUS_GAINED,permanent,opposite=Frame_Button,cause=ACTIVATION] on button1
--> java.awt.event.FocusEvent[FOCUS_LOST,temporary,opposite=Auxiliary_Button,cause=ACTIVATION] on button1
--> java.awt.event.WindowEvent[WINDOW_LOST_FOCUS,opposite=java.awt.Frame[AUX_FRAME,100,400,400x150,layout=java.awt.FlowLayout,title=Auxiliary Frame,resizable,normal],oldState=0,newState=0] on OWNED_WINDOW
--> java.awt.event.WindowEvent[WINDOW_GAINED_FOCUS,opposite=java.awt.Window[OWNED_WINDOW,100,200,400x150,layout=java.awt.FlowLayout],oldState=0,newState=0] on AUX_FRAME
--> java.awt.event.FocusEvent[FOCUS_GAINED,permanent,opposite=Window_Button,cause=ACTIVATION] on button2
--> java.awt.event.FocusEvent[FOCUS_LOST,temporary,opposite=Frame_Button,cause=ACTIVATION] on button2
--> java.awt.event.WindowEvent[WINDOW_LOST_FOCUS,opposite=java.awt.Frame[OWNER_FRAME,100,27,400x150,invalid,layout=java.awt.FlowLayout,title=Owner Frame,resizable,normal],oldState=0,newState=0] on AUX_FRAME
--> java.awt.event.WindowEvent[WINDOW_GAINED_FOCUS,opposite=java.awt.Frame[AUX_FRAME,100,400,400x150,layout=java.awt.FlowLayout,title=Auxiliary Frame,resizable,normal],oldState=0,newState=0] on OWNER_FRAME
--> java.awt.event.FocusEvent[FOCUS_GAINED,permanent,opposite=Auxiliary_Button,cause=ACTIVATION] on button0
--> java.awt.event.FocusEvent[FOCUS_LOST,temporary,opposite=Auxiliary_Button,cause=ACTIVATION] on button0
--> java.awt.event.WindowEvent[WINDOW_LOST_FOCUS,opposite=java.awt.Frame[AUX_FRAME,100,400,400x150,layout=java.awt.FlowLayout,title=Auxiliary Frame,resizable,normal],oldState=0,newState=0] on OWNER_FRAME
--> java.awt.event.WindowEvent[WINDOW_GAINED_FOCUS,opposite=java.awt.Frame[OWNER_FRAME,100,27,400x150,invalid,layout=java.awt.FlowLayout,title=Owner Frame,resizable,normal],oldState=0,newState=0] on AUX_FRAME
--> java.awt.event.FocusEvent[FOCUS_GAINED,permanent,opposite=Frame_Button,cause=ACTIVATION] on button2
----------System.err:(12/1050)----------
ActualFocusedWindowBlockingTest$TestFailedException: Test failed: The owner's component [Frame_Button] couldn't be focused as the most recent focus owner
	at ActualFocusedWindowBlockingTest.start(ActualFocusedWindowBlockingTest.java:109)
	at ActualFocusedWindowBlockingTest.main(ActualFocusedWindowBlockingTest.java:50)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:577)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
	at java.base/java.lang.Thread.run(Thread.java:833)

JavaTest Message: Test threw exception: ActualFocusedWindowBlockingTest$TestFailedException: Test failed: The owner's component [Frame_Button] couldn't be focused as the most recent focus owner
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: ActualFocusedWindowBlockingTest$TestFailedException: Test failed: The owner's component [Frame_Button] couldn't be focused as the most recent focus owner
-----------------------------8<-----------------------------


The failure was observed on Ubuntu 21.04. It was not observed on Ubuntu 18.04. The test passed successfully on Windows and macOS.

It is not a regression since similar failure was observed on 11.0.2+9

Probabaly it imay be a Wayland specific failure.
Comments
Will be fixed as part of JDK-8280988
23-04-2024

It is known Wayland limitation for Java. There are several tests which are trying to get window focuses by clicking on its window title. Window's decorations are made on Wayland side, they are not reachable by XTest emulation code(which is purely X11). One of possible workarounds is to press somewhere inside of the window.
10-01-2022