harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r496167 - 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 Sun, 14 Jan 2007 22:17:07 GMT
Author: hindessm
Date: Sun Jan 14 14:17:07 2007
New Revision: 496167

URL: http://svn.apache.org/viewvc?view=rev&rev=496167
Log:
Applying patches from "[#HARMONY-2780] [classlib][swing]
j.s.text.DefaultCaret.adjustVisibility throws NPE whereas RI doesn't".

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=496167&r1=496166&r2=496167
==============================================================================
--- 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
Sun Jan 14 14:17:07 2007
@@ -136,11 +136,11 @@
 
     //used by mouseClicked method
     private static final transient AWTTextAction SELECT_WORD_ACTION =
-        (AWTTextAction)ActionSet.actionMap.get(ActionNames.selectWordAction);
+        ActionSet.actionMap.get(ActionNames.selectWordAction);
 
     //used by mouseClicked method
     private static final transient AWTTextAction SELECT_LINE_ACTION =
-        (AWTTextAction)ActionSet.actionMap.get(ActionNames.selectLineAction);
+        ActionSet.actionMap.get(ActionNames.selectLineAction);
 
     Point magicCaretPosition;
 
@@ -361,14 +361,17 @@
             caret = dc;
         }
 
+        @Override
         public Caret getCaret() {
             return caret;
         }
 
+        @Override
         public void setDot(final int i, final Bias b) {
             caret.internalSetDot(i, b);
         }
 
+        @Override
         public void moveDot(final int i, final Bias b) {
             caret.internalMoveDot(i, b);
         }
@@ -412,9 +415,9 @@
     }
 
     protected void adjustVisibility(final Rectangle r) {
-        textKit.scrollRectToVisible(new Rectangle(r.x, r.y,
-                                                    r.width + 1,
-                                                    r.height));
+        if (r != null) {
+            textKit.scrollRectToVisible(new Rectangle(r.x, r.y, r.width + 1, r.height));
+        }
     }
 
     /**
@@ -517,6 +520,7 @@
         textKit = null;
     }
 
+    @Override
     public boolean equals(final Object obj) {
         return this == obj;
     }
@@ -580,8 +584,7 @@
     }
 
     public ChangeListener[] getChangeListeners() {
-        return (ChangeListener[])listenerList
-                .getListeners(ChangeListener.class);
+        return listenerList.getListeners(ChangeListener.class);
 
     }
 
@@ -936,8 +939,8 @@
             }
         }
 
-        blinkTimer = (Timer)createTimer(false, 0);
-        magicTimer = (Timer)createTimer(true, 0);
+        blinkTimer = createTimer(false, 0);
+        magicTimer = createTimer(true, 0);
 
         triangleX = new int[APEX_NUMBER];
         triangleY = new int[APEX_NUMBER];
@@ -1072,6 +1075,7 @@
      *     System.out.println(textArea.getCaret());
      *     System.out.println(textArea.getCaret().getClass().getName());
      */
+    @Override
     public String toString() {
         return "Dot=(" + dot + ", " + dotBias.toString() + ") " + "Mark=("
                + mark + ", " + markBias.toString() + ")";

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=496167&r1=496166&r2=496167
==============================================================================
--- 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
Sun Jan 14 14:17:07 2007
@@ -459,6 +459,12 @@
         assertEquals(1, ((ExtJTextArea) jta).flag);
     }
 
+    // Regression for HARMONY-2780
+    public void testAdjustVisibilityNull() {
+        new DefaultCaret().adjustVisibility(null);
+        // No exception is expected
+    }
+
     public void testFireStateChanged() {
         SimpleChangeListenerForFire CHL1 = new SimpleChangeListenerForFire("L1");
         SimpleChangeListenerForFire CHL2 = new SimpleChangeListenerForFire("L2");



Mime
View raw message