harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r495947 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/text/DefaultCaret.java test/api/java/common/javax/swing/text/DefaultCaretTest.java
Date Sat, 13 Jan 2007 19:10:06 GMT
Author: apetrenko
Date: Sat Jan 13 11:10:05 2007
New Revision: 495947

URL: http://svn.apache.org/viewvc?view=rev&rev=495947
Log:
Patch for HARMONY-1750 "[classlib][swing]javax.swing.text.DefaultCaret.install(null) does
not throw unspecified NPE"

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

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/DefaultCaret.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/DefaultCaret.java?view=diff&rev=495947&r1=495946&r2=495947
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/DefaultCaret.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/DefaultCaret.java
Sat Jan 13 11:10:05 2007
@@ -674,6 +674,9 @@
      * selectionColor.
      */
     public void install(final JTextComponent c) {
+        if (c == null) { // Fix for HARMONY-1750, for compatiblity with RI
+            throw new NullPointerException("component is null");
+        }
         if (!setComponent(c)) {
             return;
         }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/DefaultCaretTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/DefaultCaretTest.java?view=diff&rev=495947&r1=495946&r2=495947
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/DefaultCaretTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/DefaultCaretTest.java
Sat Jan 13 11:10:05 2007
@@ -226,6 +226,13 @@
                 + jta.getListeners(FocusListener.class).length
                 + jta.getPropertyChangeListeners().length;
         assertEquals(tCompListenersCount, tCompListenersCountCurrent - 4);
+
+        try { // Regression test for HARMONY-1750
+            new DefaultCaret().install(null);
+            fail("NullPointerException should have been thrown");
+        } catch (NullPointerException e) {
+            // Expected
+        }
     }
 
     /*



Mime
View raw message