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

Yuri Nesterenko yuri.nesterenko at oracle.com
Thu Jan 26 15:16:47 UTC 2017


Tested it: it works well (pass consistently with patched build
failing consistently with b151).

So, +1

-yan

On 01/24/2017 05:16 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
>
> 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.
> 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




More information about the swing-dev mailing list