5015261: NPE may be thrown if JDesktopIcon is set to null on a JInternalFrame
Reviewed-by: serb, prr, aivanov
This commit is contained in:
parent
9bc023220f
commit
22ef4f0653
@ -188,6 +188,8 @@ public class JInternalFrame extends JComponent implements
|
|||||||
protected String title;
|
protected String title;
|
||||||
/**
|
/**
|
||||||
* The icon that is displayed when this internal frame is iconified.
|
* The icon that is displayed when this internal frame is iconified.
|
||||||
|
* Subclassers must ensure this is set to a non-null value
|
||||||
|
* during construction and not subsequently set this to null.
|
||||||
* @see #iconable
|
* @see #iconable
|
||||||
*/
|
*/
|
||||||
protected JDesktopIcon desktopIcon;
|
protected JDesktopIcon desktopIcon;
|
||||||
@ -1307,11 +1309,15 @@ public class JInternalFrame extends JComponent implements
|
|||||||
* <code>JInternalFrame</code>.
|
* <code>JInternalFrame</code>.
|
||||||
*
|
*
|
||||||
* @param d the <code>JDesktopIcon</code> to display on the desktop
|
* @param d the <code>JDesktopIcon</code> to display on the desktop
|
||||||
|
* @throws NullPointerException if the {@code d} is {@code null}
|
||||||
* @see #getDesktopIcon
|
* @see #getDesktopIcon
|
||||||
*/
|
*/
|
||||||
@BeanProperty(description
|
@BeanProperty(description
|
||||||
= "The icon shown when this internal frame is minimized.")
|
= "The icon shown when this internal frame is minimized.")
|
||||||
public void setDesktopIcon(JDesktopIcon d) {
|
public void setDesktopIcon(JDesktopIcon d) {
|
||||||
|
if (d == null) {
|
||||||
|
throw new NullPointerException("JDesktopIcon is null");
|
||||||
|
}
|
||||||
JDesktopIcon oldValue = getDesktopIcon();
|
JDesktopIcon oldValue = getDesktopIcon();
|
||||||
desktopIcon = d;
|
desktopIcon = d;
|
||||||
firePropertyChange("desktopIcon", oldValue, d);
|
firePropertyChange("desktopIcon", oldValue, d);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user