harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r487300 - in /harmony/enhanced/classlib/trunk/modules/text/src: main/java/java/text/DecimalFormat.java test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java
Date Thu, 14 Dec 2006 18:47:02 GMT
Author: ayza
Date: Thu Dec 14 10:47:01 2006
New Revision: 487300

URL: http://svn.apache.org/viewvc?view=rev&rev=487300
Log:
Applying patch for HARMONY-1351 ([classlib][text] compatibility: NumberFormat.getCurrency()
returns string on RI and null on Harmony for incorrect locale). The "failing_" prefix was
also removed from the failing test names since we should not hide the problem on the source
code level. The test is in the exclude list anyway.

Modified:
    harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DecimalFormat.java
    harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java

Modified: harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DecimalFormat.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DecimalFormat.java?view=diff&rev=487300&r1=487299&r2=487300
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DecimalFormat.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DecimalFormat.java
Thu Dec 14 10:47:01 2006
@@ -281,10 +281,10 @@
      */
     @Override
     public Currency getCurrency() {
-        if (dform.getCurrency() == null) {
-            return null;
-        }
-        return Currency.getInstance(dform.getCurrency().getCurrencyCode());
+        final com.ibm.icu.util.Currency cur = dform.getCurrency();
+        final String code = (cur == null) ? "XXX" : cur.getCurrencyCode(); //$NON-NLS-1$
+
+        return Currency.getInstance(code);
     }
 
     /**

Modified: harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java?view=diff&rev=487300&r1=487299&r2=487300
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java
Thu Dec 14 10:47:01 2006
@@ -377,7 +377,7 @@
     }
 
     //FIXME This test fails on Harmony ClassLibrary
-    public void failing_test_getMaximumIntegerDigits() {
+    public void test_getMaximumIntegerDigits() {
         final int maxIntDigit = 309;
 
         // When use default locale, in this case zh_CN
@@ -792,7 +792,7 @@
      *        java.text.FieldPosition)
      */
     //FIXME This test fails on Harmony ClassLibrary
-    public void failing_test_formatDLjava_lang_StringBufferLjava_text_FieldPosition() {
+    public void test_formatDLjava_lang_StringBufferLjava_text_FieldPosition() {
         new Support_DecimalFormat(
                 "test_formatDLjava_lang_StringBufferLjava_text_FieldPosition")
                 .t_format_with_FieldPosition();
@@ -1025,7 +1025,7 @@
      *        java.text.FieldPosition)
      */
     //FIXME This test fails on Harmony ClassLibrary
-    public void failing_test_formatJLjava_lang_StringBufferLjava_text_FieldPosition() {
+    public void test_formatJLjava_lang_StringBufferLjava_text_FieldPosition() {
         int failCount = 0;
         Support_BitSet failures = new Support_BitSet();
 
@@ -1098,7 +1098,7 @@
      * @tests java.text.DecimalFormat#formatToCharacterIterator(java.lang.Object)
      */
     //FIXME This test fails on Harmony ClassLibrary
-    public void failing_test_formatToCharacterIteratorLjava_lang_Object() {
+    public void test_formatToCharacterIteratorLjava_lang_Object() {
 
         try {
             // Regression for HARMONY-466
@@ -1176,10 +1176,11 @@
      * @tests java.text.DecimalFormat#getCurrency()
      */
     //FIXME This test fails on Harmony ClassLibrary
-    public void failing_test_getCurrency() {
+    public void test_getCurrency() {
         Currency currK = Currency.getInstance("KRW");
         Currency currX = Currency.getInstance("XXX");
         Currency currE = Currency.getInstance("EUR");
+        Currency curr01;
 
         DecimalFormat df = (DecimalFormat) NumberFormat
                 .getCurrencyInstance(new Locale("ko", "KR"));
@@ -1201,6 +1202,11 @@
         assertTrue("Test4: Returned incorrect currency",
                 df.getCurrency() == currE);
 
+        // Regression for HARMONY-1351
+        df = (DecimalFormat) NumberFormat.getCurrencyInstance(new Locale("QWERTY"));
+        assertTrue("Test5: Returned incorrect currency",
+                df.getCurrency() == currX);
+        
         // JDK fails these tests since it doesn't have the PREEURO variant
         // df = (DecimalFormat)NumberFormat.getCurrencyInstance(new Locale("fr",
         // "FR","PREEURO"));
@@ -1254,7 +1260,7 @@
      *        java.text.ParsePosition)
      */
     //FIXME This test fails on Harmony ClassLibrary
-    public void failing_test_parseLjava_lang_StringLjava_text_ParsePosition() {
+    public void test_parseLjava_lang_StringLjava_text_ParsePosition() {
         DecimalFormat format = (DecimalFormat) NumberFormat
                 .getNumberInstance(Locale.ENGLISH);
         ParsePosition pos = new ParsePosition(0);
@@ -1475,7 +1481,7 @@
      * @tests java.text.DecimalFormat#setMultiplier(int)
      */
     //FIXME This test fails on Harmony ClassLibrary
-    public void failing_test_setMultiplierI() {
+    public void test_setMultiplierI() {
         DecimalFormat df = new DecimalFormat("###0.##");
         df.setMultiplier(10);
         assertEquals("Wrong multiplier", 10, df.getMultiplier());



Mime
View raw message