harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r495875 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/text/Segment.java test/api/java/common/javax/swing/text/SegmentTest.java
Date Sat, 13 Jan 2007 11:55:18 GMT
Author: hindessm
Date: Sat Jan 13 03:55:17 2007
New Revision: 495875

URL: http://svn.apache.org/viewvc?view=rev&rev=495875
Log:
Applied patches from "[#HARMONY-2514] [classlib][swing]
javax.swing.text.Segment.toString() throws unspecified NPE".

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

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/Segment.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/Segment.java?view=diff&rev=495875&r1=495874&r2=495875
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/Segment.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/Segment.java
Sat Jan 13 03:55:17 2007
@@ -14,10 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Alexey A. Ivanov
- * @version $Revision$
- */
 package javax.swing.text;
 
 import java.text.CharacterIterator;
@@ -47,6 +43,7 @@
         this.isPartial = false;
     }
 
+    @Override
     public Object clone() {
         Object clone;
 
@@ -141,8 +138,9 @@
         return;
     }
 
+    @Override
     public String toString() {
-        return new String(array, offset, count);
+        return array != null ? new String(array, offset, count) : "";
     }
 
     private boolean isEmpty() {

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/SegmentTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/SegmentTest.java?view=diff&rev=495875&r1=495874&r2=495875
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/SegmentTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/SegmentTest.java
Sat Jan 13 03:55:17 2007
@@ -14,10 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Alexey A. Ivanov
- * @version $Revision$
- */
 package javax.swing.text;
 
 import java.text.CharacterIterator;
@@ -46,6 +42,12 @@
 
     public void testToString() {
         assertEquals("cdefgh", s.toString());
+    }
+
+    public void testToStringEmpty() {
+        s = new Segment();
+        assertNull(s.array);
+        assertEquals("", s.toString());
     }
 
     public void testCurrent() {



Mime
View raw message