<Swing Dev> [9] RFR JDK-7190595: Nimbus: Test6657026 fails

Prasanta Sadhukhan prasanta.sadhukhan at oracle.com
Tue Jan 24 14:21:24 UTC 2017



On 1/24/2017 7:46 PM, Prasanta Sadhukhan wrote:
>
> Hi All,
>
> Please review a fix for an issue where it is seen 
> javax/swing/plaf/basic/BasicSplitPaneUI/Test6657026.java fails 
> reporting "Shared traversal keys" for Nimbus LaF.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-7190595
> webrev: http://cr.openjdk.java.net/~psadhukhan/7190595/webrev.00/
>
> Issue was "managingFocusForwardTraversalKeys" and 
> "managingFocusBackwardTraversalKeys" is a static field in
> http://hg.openjdk.java.net/jdk9/client/jdk/file/8270102790e5/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java#l51
> so when JSplitPane is instantiated several times as in this particular 
> testcase,
> managingFocusForwardTraversalKeys and 
> managingFocusBackwardTraversalKeys is NOT null from 2nd time so no 
> keyStroke is added to this Set
>
http://hg.openjdk.java.net/jdk9/client/jdk/file/8270102790e5/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java#l102
> so Set is not null but empty.
>
> Now, since keyStrokes is cleared in the testcase between  2 JSplitPane 
> instantiation, next time getFocusTraversalKeys(0) is called, it 
> returns an empty Set so the test fails.
>
> Proposed fix is to remove the "static" keyword from this 2 Sets so 
> that they gets instantiated each time JSplitPane is invoked.
Other LaF (Metal, Motif, Windows etc ) passed with this fix.
> This problem is not present for other LaF like Metal because for those 
> LaF, BasicSplitPaneUI is used instead of SynthSplitPaneUI (used only 
> for Nimbus) where these fields are not static
> [http://hg.openjdk.java.net/jdk9/client/jdk/file/8270102790e5/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java#l109]
> which are removed as per JDK-6657026 [Numerous static security flaws 
> in Swing(findbugs)]
>
> Regards
> Prasanta

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20170124/b198963f/attachment.html>


More information about the swing-dev mailing list