From 9c42f290b9244bc201ebf30e4fc405d0352cb65e Mon Sep 17 00:00:00 2001 From: GCL Shanghai Date: Thu, 25 Oct 2001 06:25:23 +0000 Subject: [PATCH] ICU-92 Update some implementation of serialization according to Doug's mail X-SVN-Rev: 6425 --- icu4j/src/com/ibm/icu/text/DecimalFormat.java | 14 ++++++++++++-- icu4j/src/com/ibm/text/DecimalFormat.java | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/icu4j/src/com/ibm/icu/text/DecimalFormat.java b/icu4j/src/com/ibm/icu/text/DecimalFormat.java index fe4e52f2bc2..8f29f5827c1 100755 --- a/icu4j/src/com/ibm/icu/text/DecimalFormat.java +++ b/icu4j/src/com/ibm/icu/text/DecimalFormat.java @@ -5,8 +5,8 @@ ******************************************************************************* * * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/DecimalFormat.java,v $ - * $Date: 2001/10/23 13:22:19 $ - * $Revision: 1.10 $ + * $Date: 2001/10/25 06:25:23 $ + * $Revision: 1.11 $ * ***************************************************************************************** */ @@ -2784,9 +2784,19 @@ public class DecimalFormat extends NumberFormat { // We only need to check the maximum counts because NumberFormat // .readObject has already ensured that the maximum is greater than the // minimum count. + /*Commented for compatibility with previous version, and reserved for further use if (getMaximumIntegerDigits() > DOUBLE_INTEGER_DIGITS || getMaximumFractionDigits() > DOUBLE_FRACTION_DIGITS) { throw new InvalidObjectException("Digit count out of range"); + }*/ + /* Truncte the maximumIntegerDigits to DOUBLE_INTEGER_DIGITS and maximumFractionDigits + * to DOUBLE_FRACTION_DIGITS + */ + if (getMaximumIntegerDigits() > DOUBLE_INTEGER_DIGITS) { + setMaximumIntegerDigits(DOUBLE_INTEGER_DIGITS); + } + if (getMaximumFractionDigits() > DOUBLE_FRACTION_DIGITS) { + setMaximumFractionDigits(DOUBLE_FRACTION_DIGITS); } if (serialVersionOnStream < 2) { exponentSignAlwaysShown = false; diff --git a/icu4j/src/com/ibm/text/DecimalFormat.java b/icu4j/src/com/ibm/text/DecimalFormat.java index 2e3c5229ca1..103180630c8 100755 --- a/icu4j/src/com/ibm/text/DecimalFormat.java +++ b/icu4j/src/com/ibm/text/DecimalFormat.java @@ -5,8 +5,8 @@ ******************************************************************************* * * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/text/Attic/DecimalFormat.java,v $ - * $Date: 2001/10/23 13:22:19 $ - * $Revision: 1.10 $ + * $Date: 2001/10/25 06:25:23 $ + * $Revision: 1.11 $ * ***************************************************************************************** */ @@ -2784,9 +2784,19 @@ public class DecimalFormat extends NumberFormat { // We only need to check the maximum counts because NumberFormat // .readObject has already ensured that the maximum is greater than the // minimum count. + /*Commented for compatibility with previous version, and reserved for further use if (getMaximumIntegerDigits() > DOUBLE_INTEGER_DIGITS || getMaximumFractionDigits() > DOUBLE_FRACTION_DIGITS) { throw new InvalidObjectException("Digit count out of range"); + }*/ + /* Truncte the maximumIntegerDigits to DOUBLE_INTEGER_DIGITS and maximumFractionDigits + * to DOUBLE_FRACTION_DIGITS + */ + if (getMaximumIntegerDigits() > DOUBLE_INTEGER_DIGITS) { + setMaximumIntegerDigits(DOUBLE_INTEGER_DIGITS); + } + if (getMaximumFractionDigits() > DOUBLE_FRACTION_DIGITS) { + setMaximumFractionDigits(DOUBLE_FRACTION_DIGITS); } if (serialVersionOnStream < 2) { exponentSignAlwaysShown = false;