<Swing Dev> Review request for JDK-4769772 JInternalFrame.setIcon(true) before JDesktopPane.add(JIF) causes wrong state

Alexey Ivanov alexey.ivanov at oracle.com
Wed Dec 23 13:46:13 UTC 2015


Hi Rajeev,

There's a potential NullPointerException in this line of 
BasicInternalFrameUI.java:
     if(value.equals(Boolean.FALSE))

I suggest eliminating it using this construct:
     if (Boolean.FALSE.equals(value))

This way the code is safer.


Can the test be simplified? Is it really required to create menu and use 
robot to invoke commands?
Wouldn't it be enough to programmatically add minimized internal frame 
and then check its properties?

JFrame in test should also be instantiated on EDT, in createUI() method.


And a general recommendation to follow Java Coding Style [1] and in 
particular to add a space [2] after 'if',  after comma in argument 
lists, and after cast operator.

Regards,
Alexey

[1] http://www.oracle.com/technetwork/java/codeconvtoc-136057.html
[2] 
http://www.oracle.com/technetwork/java/javase/documentation/codeconventions-141388.html#682

On 18.12.2015 11:44, Rajeev Chamyal wrote:
> Hello All,
>
> Please review the following fix for Jdk9:
> Bug: https://bugs.openjdk.java.net/browse/JDK-4769772
>
> Webrev:http://cr.openjdk.java.net/~rchamyal/4769772/webrev.00/ 
> <http://cr.openjdk.java.net/%7Erchamyal/4769772/webrev.00/>
>
> Issue: Iconifying a frame before adding it to desktop pane is not working.
>
> Cause: Setting setIcon property of a JInternalFrame before addition to 
> desktop pane fails to find the desktop as a result its always in 
> maximized state.
> Fix: Added method to check if frame is already iconified before addition.
> Verified the fix on windows,Ubuntu and Mac with all layouts.
> Also, removed unused imports from JDesktopPane.java as part of fix.
> Regards,
> Rajeev Chamyal
>




More information about the swing-dev mailing list