harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r495934 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/JInternalFrame.java test/api/java/common/javax/swing/JInternalFrameTest.java
Date Sat, 13 Jan 2007 17:41:11 GMT
Author: hindessm
Date: Sat Jan 13 09:41:10 2007
New Revision: 495934

URL: http://svn.apache.org/viewvc?view=rev&rev=495934
Log:
Applying patch from "[#HARMONY-2599] [classlib][swing]
javax.swing.JInternalFrame.JDesktopIcon.getDesktopPane() throws NPE".  I
modified the test slightly to let junit handle the exceptions.

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JInternalFrame.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JInternalFrameTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JInternalFrame.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JInternalFrame.java?view=diff&rev=495934&r1=495933&r2=495934
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JInternalFrame.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JInternalFrame.java
Sat Jan 13 09:41:10 2007
@@ -170,9 +170,13 @@
             // so, we cannot write here just
             // return getInternalFrame().getDesktopPane();
             Container result = SwingUtilities.getAncestorOfClass(JDesktopPane.class, this);
+
             if (result == null) {
-                return getInternalFrame().getDesktopPane();
+                if(getInternalFrame() != null) {
+                    result = getInternalFrame().getDesktopPane();
+                }
             }
+
             return (JDesktopPane) result;
         }
 

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JInternalFrameTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JInternalFrameTest.java?view=diff&rev=495934&r1=495933&r2=495934
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JInternalFrameTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JInternalFrameTest.java
Sat Jan 13 09:41:10 2007
@@ -1129,7 +1129,7 @@
     /*
      * Class under test for JDesktopPane getDesktopPane()
      */
-    public void testGetDesktopPane() {
+    public void testGetDesktopPane() throws NullPointerException {
         // no desktopPane
         assertNull("desktopPane is null by default", frame.getDesktopPane());
         //JInternalFrame.JDesktopIcon icon = new JInternalFrame.JDesktopIcon(frame);
@@ -1149,6 +1149,11 @@
         //desktop.remove(frame.getDesktopIcon());
         //frame.setDesktopIcon(null);
         //assertNull("desktopPane is null", frame.getDesktopPane());
+
+        JInternalFrame jf = new JInternalFrame();
+        JInternalFrame.JDesktopIcon fc = new JInternalFrame.JDesktopIcon(jf);
+        fc.setInternalFrame(null);
+        assertNull(fc.getDesktopPane());              
     }
 
     /*



Mime
View raw message