<Swing Dev> RFR: 5015261: JInternalFrame causes NPE [v4]

Sergey Bylokhov serb at openjdk.java.net
Tue Aug 17 05:12:25 UTC 2021


On Tue, 17 Aug 2021 04:47:43 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> JInternalFrame.getDesktopIcon() can be null as setDesktopIcon() can be called with null value. There are many places in JInternalFrame where getDesktopIcon() is accessed without null check which might cause NPE. 
>> Added null check for those cases.
>
> Prasanta Sadhukhan has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Prevent null being set
>  - Prevent null being set

src/java.desktop/share/classes/javax/swing/JInternalFrame.java line 1321:

> 1319:             desktopIcon = d;
> 1320:             firePropertyChange("desktopIcon", oldValue, d);
> 1321:         }

Probably NPE is better in this case? Either way the specification should say something about the new behaviour.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4989


More information about the swing-dev mailing list