harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r495904 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/undo/StateEdit.java test/api/java/common/javax/swing/undo/StateEditTest.java
Date Sat, 13 Jan 2007 14:52:10 GMT
Author: hindessm
Date: Sat Jan 13 06:52:09 2007
New Revision: 495904

URL: http://svn.apache.org/viewvc?view=rev&rev=495904
Log:
Applied patches from "[#HARMONY-2536] [classlib][swing]
javax.swing.undo.StateEdit(null) does not throw NPE while RI does".

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/StateEdit.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/undo/StateEditTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/StateEdit.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/StateEdit.java?view=diff&rev=495904&r1=495903&r2=495904
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/StateEdit.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/StateEdit.java
Sat Jan 13 06:52:09 2007
@@ -41,27 +41,22 @@
         init(anObject, name);
     }
 
-
     public StateEdit(final StateEditable anObject) {
         this(anObject, null);
     }
 
-
-
     public void end() {
         postState = initHashtable(postState);
         object.storeState(postState);
         removeRedundantState();
     }
 
-
     public String getPresentationName() {
         return undoRedoName;
     }
 
     private Hashtable<Object, Object>
                     initHashtable(final Hashtable<Object, Object> ht) {
-
         if (ht == null) {
             return new Hashtable<Object, Object>();
         }
@@ -73,19 +68,14 @@
         object = anObject;
         undoRedoName = name;
         preState = initHashtable(preState);
-        if (object != null) {
-            object.storeState(preState);
-        }
+        object.storeState(preState);
     }
 
-
     public void redo() {
         super.redo();
         object.restoreState(postState);
     }
 
-
-
     protected void removeRedundantState() {
         if (preState == null || postState == null) {
             return;
@@ -105,10 +95,8 @@
         }
     }
 
-
     public void undo() {
         super.undo();
         object.restoreState(preState);
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/undo/StateEditTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/undo/StateEditTest.java?view=diff&rev=495904&r1=495903&r2=495904
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/undo/StateEditTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/undo/StateEditTest.java
Sat Jan 13 06:52:09 2007
@@ -217,6 +217,19 @@
         assertNull(se1.postState);
         assertEquals(getState(newObj), se1.preState);
         assertEquals("name", se1.undoRedoName);
+
+        try { // Regression test for HARMONY-2536
+            new StateEdit(null);
+            fail("NullPointerException should have been thrown");
+        } catch (NullPointerException e) {
+            // Expected
+        }
+        try { // Regression test for HARMONY-2536
+            new StateEdit(null, "str");
+            fail("NullPointerException should have been thrown");
+        } catch (NullPointerException e) {
+            // Expected
+        }
     }
 
     public void testConstants() {
@@ -225,4 +238,4 @@
         assertEquals("$Id: StateEditable.java,v 1.2 1997/09" + "/08 19:39:08 marklin Exp
$",
                 StateEditable.RCSID);
     }
-}
\ No newline at end of file
+}



Mime
View raw message