harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r495956 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/undo/CompoundEdit.java test/api/java/common/javax/swing/undo/CompoundEditTest.java
Date Sat, 13 Jan 2007 19:46:40 GMT
Author: hindessm
Date: Sat Jan 13 11:46:39 2007
New Revision: 495956

URL: http://svn.apache.org/viewvc?view=rev&rev=495956
Log:
Applying patch from "[#HARMONY-2603] [classlib][swing]
j.s.undo.CompoundEdit.getPresentationName throws NPE".

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

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/CompoundEdit.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/CompoundEdit.java?view=diff&rev=495956&r1=495955&r2=495956
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/CompoundEdit.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/CompoundEdit.java
Sat Jan 13 11:46:39 2007
@@ -24,6 +24,8 @@
 import java.util.NoSuchElementException;
 import java.util.Vector;
 
+import org.apache.harmony.x.swing.Utilities;
+
 public class CompoundEdit extends AbstractUndoableEdit {
 
     protected Vector<UndoableEdit> edits = new Vector<UndoableEdit>();
@@ -108,7 +110,7 @@
 
         if (last != null) {
             String name = last.getPresentationName();
-            if (name.length() != 0) {
+            if (!Utilities.isEmptyString(name)) {
                 return name;
             }
         }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/undo/CompoundEditTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/undo/CompoundEditTest.java?view=diff&rev=495956&r1=495955&r2=495956
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/undo/CompoundEditTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/undo/CompoundEditTest.java
Sat Jan 13 11:46:39 2007
@@ -14,10 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Evgeniya G. Maenkova
- * @version $Revision$
- */
 package javax.swing.undo;
 
 import javax.swing.BasicSwingTestCase;
@@ -364,6 +360,24 @@
         ce.addEdit(new TestUndoableEdit(TestUndoableEdit.NAME));
         assertEquals(String.valueOf(1), ce.getPresentationName());
         ce.addEdit(new TestUndoableEdit());
+        assertEquals("", ce.getPresentationName());
+    }
+
+    /**
+     * Tests that if <code>getPresentationName</code> of the last edit returns
+     * <code>null</code>, the result is empty string.
+     * 
+     */
+    // Regression for HARMONY-2603
+    public void testGetPresentationName03() {
+        ce.addEdit(new TestUndoableEdit() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public String getPresentationName() {
+                return null;
+            }
+        });
         assertEquals("", ce.getPresentationName());
     }
 



Mime
View raw message