harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r447280 - in /incubator/harmony/enhanced/classlib/trunk/modules/text/src: main/java/java/text/MessageFormat.java test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java
Date Mon, 18 Sep 2006 06:28:21 GMT
Author: pyang
Date: Sun Sep 17 23:28:21 2006
New Revision: 447280

URL: http://svn.apache.org/viewvc?view=rev&rev=447280
Log:
Patch applied for HARMONY-922 ([classlib][text] unexpected NPE for MessageFormat(rr, null).hashCode())

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/MessageFormat.java
    incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/MessageFormat.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/MessageFormat.java?view=diff&rev=447280&r1=447279&r2=447280
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/MessageFormat.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/MessageFormat.java
Sun Sep 17 23:28:21 2006
@@ -506,9 +506,12 @@
             }
 		}
 		if (maxOffset + 1 < strings.length) {
-            hashCode += strings[maxOffset + 1].hashCode();
+			hashCode += strings[maxOffset + 1].hashCode();
         }
-		return hashCode + locale.hashCode();
+		if (locale != null) {
+            return hashCode + locale.hashCode();
+		}
+		return hashCode;
 	}
 
 	/**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java?view=diff&rev=447280&r1=447279&r2=447280
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java
Sun Sep 17 23:28:21 2006
@@ -346,6 +346,15 @@
     }
 
     /**
+     * @tests java.text.MessageFormat#hashCode()
+     */
+    public void test_hashCode() {
+        // Test for method
+        // int java.text.MessageFormat.hashCode()
+        assertEquals("Should be equal", 3648, new MessageFormat("rr", null).hashCode());
+    }
+
+    /**
      * @tests java.text.MessageFormat#formatToCharacterIterator(java.lang.Object)
      */
     //FIXME This test fails on Harmony ClassLibrary



Mime
View raw message