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

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

prasanta sadhukhan

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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

prasanta sadhukhan



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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Yuri Nesterenko
In reply to this post by prasanta sadhukhan
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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Jayathirth D v
Hi Prasanta,

Looks good to me.
Just change the copyright year of SynthSplitPaneUI.java from 2015 to 2017 before pushing.

Thanks,
Jay

-----Original Message-----
From: Yuri Nesterenko
Sent: Thursday, January 26, 2017 8:47 PM
To: Prasanta Sadhukhan; Alexandr Scherbatiy; [hidden email]
Subject: Re: <Swing Dev> [9] RFR JDK-7190595: Nimbus: Test6657026 fails

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#l1
> 09] which are removed as per JDK-6657026 [Numerous static security
> flaws in Swing(findbugs)]
>
> Regards
> Prasanta

Loading...