RFR: CODETOOLS-7902793: Fix IllegalMonitorStateException in JInternalFrameOperatorCloseTest [v2]

Alexandre Iline shurailine at openjdk.java.net
Tue Dec 8 02:12:20 UTC 2020

On Tue, 8 Dec 2020 01:07:59 GMT, Alexandre Iline <shurailine at openjdk.org> wrote:

>> Not able to run the test due to NPE.
>> When close event is triggered by calling internalFrameOper.close(); JInternalFrame.doDefaultCloseAction() is called(). This method fires close property change event. Because we are closing the internal frame so this frame is removed from the desktop pane and when it is removed then its parent also set to null in Container.remove() method call.
>> I tested JInternalFrame add/remove workflow with Oracle's InternalFrameDemo class and It seems me valid. NPE is not a part of Product Bug.
>> java.lang.NullPointerException
>> 	at org.netbeans.jemmy.ClassReference.<init>(ClassReference.java:51)
>> 	at org.netbeans.jemmy.EventDispatcher.<init>(EventDispatcher.java:87)
>> 	at org.netbeans.jemmy.operators.ComponentOperator.<init>(ComponentOperator.java:195)
>> 	at org.netbeans.jemmy.operators.ContainerOperator.<init>(ContainerOperator.java:71)
>> 	at org.netbeans.jemmy.operators.WindowOperator.<init>(WindowOperator.java:70)
>> 	at org.netbeans.jemmy.util.DefaultVisualizer.makeVisible(DefaultVisualizer.java:211)
>> 	at org.netbeans.jemmy.operators.ComponentOperator.makeComponentVisible(ComponentOperator.java:887)
>> 	at org.netbeans.jemmy.operators.AbstractButtonOperator.push(AbstractButtonOperator.java:350)
>> 	at org.netbeans.jemmy.drivers.windows.DefaultInternalFrameDriver.requestClose(DefaultInternalFrameDriver.java:59)
>> 	at org.netbeans.jemmy.operators.JInternalFrameOperator.close(JInternalFrameOperator.java:581)
>> 	at org.netbeans.jemmy.operators.JInternalFrameOperatorCloseTest.testClose(JInternalFrameOperatorCloseTest.java:99)
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> 	at java.lang.reflect.Method.invoke(Method.java:498)
>> 	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
>> 	at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:599)
>> 	at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174)
>> 	at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
>> 	at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
>> 	at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
>> 	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
>> 	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
> Thank you, @amresh-sahu, for the analysis. Like we discussed, I can not reproduce this problem locally. But I think I have enough to work on this.

The exception was actually coming from the finally block where the test attempts to close an internal frame which  acts absolutely normally (with field done been set to true). That, probably, means that there is something wrong in InternalFrameOperator.close(). Which is not related to this test, as this test is only supposed to test that waiting happens if the internal windows is not closing.
I have therefore removed internal frame closing at the end. It was unnecessary in the first place, as the test disposes the container window anyway.
The problem of the NPE coming from internal frame closing happening because the internal frame does not have a parent, should still be resolved. @amresh-sahu, can you be so kind file a separate bug on that with all the details you can provide? If you can create a standalone scenario for that, it would be great.


PR: https://git.openjdk.java.net/jemmy-v2/pull/4

More information about the jemmy-dev mailing list