diff --git a/src/java.desktop/share/classes/javax/swing/JInternalFrame.java b/src/java.desktop/share/classes/javax/swing/JInternalFrame.java
index fd4182814f7..17b0fecde08 100644
--- a/src/java.desktop/share/classes/javax/swing/JInternalFrame.java
+++ b/src/java.desktop/share/classes/javax/swing/JInternalFrame.java
@@ -188,6 +188,8 @@ public class JInternalFrame extends JComponent implements
protected String title;
/**
* 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
*/
protected JDesktopIcon desktopIcon;
@@ -1307,11 +1309,15 @@ public class JInternalFrame extends JComponent implements
* JInternalFrame
.
*
* @param d the JDesktopIcon
to display on the desktop
+ * @throws NullPointerException if the {@code d} is {@code null}
* @see #getDesktopIcon
*/
@BeanProperty(description
= "The icon shown when this internal frame is minimized.")
public void setDesktopIcon(JDesktopIcon d) {
+ if (d == null) {
+ throw new NullPointerException("JDesktopIcon is null");
+ }
JDesktopIcon oldValue = getDesktopIcon();
desktopIcon = d;
firePropertyChange("desktopIcon", oldValue, d);