harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r953280 - in /harmony/enhanced/java/trunk/classlib/modules/text/src: main/java/java/text/DecimalFormat.java test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java
Date Thu, 10 Jun 2010 11:14:51 GMT
Author: hindessm
Date: Thu Jun 10 11:14:51 2010
New Revision: 953280

URL: http://svn.apache.org/viewvc?rev=953280&view=rev
Log:
Apply java5 patch from "#HARMONY-6485] [classlib][text] DecimalFormat
applyPattern error".

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

Modified: harmony/enhanced/java/trunk/classlib/modules/text/src/main/java/java/text/DecimalFormat.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/text/src/main/java/java/text/DecimalFormat.java?rev=953280&r1=953279&r2=953280&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/text/src/main/java/java/text/DecimalFormat.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/text/src/main/java/java/text/DecimalFormat.java
Thu Jun 10 11:14:51 2010
@@ -636,6 +636,10 @@ public class DecimalFormat extends Numbe
      */
     public void applyLocalizedPattern(String pattern) {
         dform.applyLocalizedPattern(pattern);
+        super.setMaximumFractionDigits(dform.getMaximumFractionDigits());
+        super.setMaximumIntegerDigits(dform.getMaximumIntegerDigits());
+        super.setMinimumFractionDigits(dform.getMinimumFractionDigits());
+        super.setMinimumIntegerDigits(dform.getMinimumIntegerDigits());
     }
 
     /**
@@ -650,6 +654,10 @@ public class DecimalFormat extends Numbe
     public void applyPattern(String pattern) {
 
         dform.applyPattern(pattern);
+        super.setMaximumFractionDigits(dform.getMaximumFractionDigits());
+        super.setMaximumIntegerDigits(dform.getMaximumIntegerDigits());
+        super.setMinimumFractionDigits(dform.getMinimumFractionDigits());
+        super.setMinimumIntegerDigits(dform.getMinimumIntegerDigits());
     }
 
     /**

Modified: harmony/enhanced/java/trunk/classlib/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java?rev=953280&r1=953279&r2=953280&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java
Thu Jun 10 11:14:51 2010
@@ -751,6 +751,15 @@ public class DecimalFormatTest extends T
         assertEquals("Wrong pattern 3", "#", format.toPattern());
         format = new DecimalFormat(".#");
         assertEquals("Wrong pattern 4", "#.0", format.toPattern());
+        // Regression for HARMONY-6485
+        format = new DecimalFormat();
+        format.setMinimumIntegerDigits(0);
+        format.setMinimumFractionDigits(0);
+        format.setMaximumFractionDigits(0);
+        format.applyPattern("00.0#");
+        assertEquals("Minimum integer digits not set", 2, format.getMinimumIntegerDigits());
+        assertEquals("Minimum fraction digits not set", 1, format.getMinimumFractionDigits());
+        assertEquals("Maximum fraction digits not set", 2, format.getMaximumFractionDigits());
     }
 
     /**



Mime
View raw message