harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r495949 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/text/ElementIterator.java test/api/java/common/javax/swing/text/ElementIteratorTest.java
Date Sat, 13 Jan 2007 19:14:33 GMT
Author: apetrenko
Date: Sat Jan 13 11:14:32 2007
New Revision: 495949

URL: http://svn.apache.org/viewvc?view=rev&rev=495949
Log:
Patch for HARMONY-1811 "[classlib][swing]javax.swing.tex.ElementIterator((Document)null) does
not throw unspesified NPE"

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/ElementIterator.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/ElementIteratorTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/ElementIterator.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/ElementIterator.java?view=diff&rev=495949&r1=495948&r2=495949
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/ElementIterator.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/ElementIterator.java
Sat Jan 13 11:14:32 2007
@@ -31,7 +31,7 @@
     }
 
     public ElementIterator(final Document doc) {
-        this((doc != null) ? doc.getRootElements()[0] : null);
+        this(doc.getRootElements()[0]);
     }
 
     public Element first() {

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/ElementIteratorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/ElementIteratorTest.java?view=diff&rev=495949&r1=495948&r2=495949
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/ElementIteratorTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/ElementIteratorTest.java
Sat Jan 13 11:14:32 2007
@@ -84,6 +84,13 @@
         assertSame(root, iterator.first());
         assertNull(iterator.previous());
         assertSame(root, iterator.current());
+
+        try { // Regression test for HARMONY-1811
+            new ElementIterator((Document) null);
+            fail("NullPointerException should have been thrown");
+        } catch (NullPointerException e) {
+            // Expected
+        }
     }
 
     /*



Mime
View raw message