JDK-6979568 : Test failure: test\closed\java\awt\Component\VisibleHwInLwContTest\VisibleHwInLwContTest.html
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: generic
  • Submitted: 2010-08-24
  • Updated: 2011-03-07
  • Resolved: 2011-03-07
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 7
7 b116Fixed
Related Reports
Relates :  
Relates :  
Description
Test fails with JDK7b104 under XP when jtreg started test\closed\java\awt\Component\VisibleHwInLwContTest\VisibleHwInLwContTest.html 

#Test Results (version 2)
#Tue Aug 24 21:59:27 MSD 2010
#checksum:37d934a8c771a9fc
#-----testdescription-----
$file=Z:\\net\\bigbean\\export3\\awt\\users\\ad153231\\jdk-loggers\\jdk\\test\\closed\\java\\awt\\Component\\VisibleHwInLwContTest\\VisibleHwInLwContTest.html
$root=Z:\\net\\bigbean\\export3\\awt\\users\\ad153231\\jdk-loggers\\jdk\\test
author=###@###.###: area=awt.Component
keywords=bug4818916
run=USER_SPECIFIED applet VisibleHwInLwContTest.html\r\n
source=VisibleHwInLwContTest.html
title=CardLayout heavyweight makes lightweight visible

#-----environment-----

#-----testresult-----
description=file:///Z:/net/bigbean/export3/awt/users/ad153231/jdk-loggers/jdk/test/closed/java/awt/Component/VisibleHwInLwContTest/VisibleHwInLwContTest.html
end=Tue Aug 24 21:59:27 MSD 2010
environment=regtest
execStatus=Failed. Execution failed: Applet thread threw exception: java.lang.RuntimeException: Test failed.  Action performed on invisible button.
javatestOS=Windows XP 5.1 (x86)
javatestVersion=2.1.5
script=com.sun.javatest.regtest.RegressionScript 
sections=script_messages build applet
start=Tue Aug 24 21:59:24 MSD 2010
status=Failed. Execution failed: Applet thread threw exception: java.lang.RuntimeException: Test failed.  Action performed on invisible button.
test=closed/java/awt/Component/VisibleHwInLwContTest/VisibleHwInLwContTest.html
work=Z:\\net\\bigbean\\export3\\awt\\users\\ad153231\\jdk-loggers\\jdk\\test\\closed\\java\\awt\\Component\\VisibleHwInLwContTest\\JTwork\\closed\\java\\awt\\Component\\VisibleHwInLwContTest

#section:script_messages
----------messages:(1/39)----------
JDK under test: D:/BOOTJDK/JDK7.0b104

#section:build
----------messages:(3/110)----------
command: build VisibleHwInLwContTest 
reason: Named class compiled on demand
elapsed time (seconds): 0.016
result: Passed. No need to compile: VisibleHwInLwContTest.java

#section:applet
----------messages:(3/146)----------
command: applet VisibleHwInLwContTest.html
reason: User specified action: run applet VisibleHwInLwContTest.html 
elapsed time (seconds): 2.125
----------System.out:(1/48)----------
Any messages for the tester will display here.
----------System.err:(6/416)----------
actionPerformed
java.lang.RuntimeException: Test failed.  Action performed on invisible button.
	at VisibleHwInLwContTest.start(VisibleHwInLwContTest.java:96)
	at com.sun.javatest.regtest.AppletWrapper$AppletThread.run(AppletWrapper.java:145)
	at java.lang.Thread.run(Thread.java:717)
STATUS:Failed.Applet thread threw exception: java.lang.RuntimeException: Test failed.  Action performed on invisible button.
result: Failed. Execution failed: Applet thread threw exception: java.lang.RuntimeException: Test failed.  Action performed on invisible button.


test result: Failed. Execution failed: Applet thread threw exception: java.lang.RuntimeException: Test failed.  Action performed on invisible button.

Comments
EVALUATION More info: this is actually a regression of 6885735. With the fix we rewrote the Container.isRecursivelyVisibleUpToHeavyweightContainer() to use a loop instead of recursion, and as part of this a call to the isVisible() method on the initial container itself has been lost. A better fix would be to start the loop from 'this' isntead of 'getContainer()'.
06-10-2010

EVALUATION The Component.addNotify() verifies if the parent of the component is recursively visible up to its heavyweight container, and hides the peer if it isn't. The test creates the following hierarchy: Window (hw) -> Container (lw) -> Button (hw) and makes the container initially invisible. However, since the Container.isRecursivelyVisibleUpToHeavyweightContainer() checks the visiblility of its parent containers only (the Window, which is actually visible), the peer doesn't get hidden - there's no check on the visibility of the nearest parent itself.
05-10-2010

SUGGESTED FIX --- old/src/share/classes/java/awt/Container.java 2010-10-06 18:56:55.000000000 +0400 +++ new/src/share/classes/java/awt/Container.java 2010-10-06 18:56:54.000000000 +0400 @@ -4187,7 +4187,7 @@ return true; } - for (Container cont = getContainer(); + for (Container cont = this; cont != null && cont.isLightweight(); cont = cont.getContainer()) {
05-10-2010