ICU-5370 readResolve doesn't work because equals() method only returns true for exactly the same object. Change it to compare the names.

X-SVN-Rev: 20268
This commit is contained in:
Eric Mader 2006-09-08 03:57:30 +00:00
parent 340cafcff2
commit daba19ab1f

View file

@ -1551,7 +1551,9 @@ public abstract class NumberFormat extends UFormat {
* @stable ICU 3.6
*/
public static class Field extends Format.Field {
// generated by serialver from JDK 1.4.1_01
static final long serialVersionUID = -4516273749929385842L;
/**
* @stable ICU 3.6
*/
@ -1621,27 +1623,27 @@ public abstract class NumberFormat extends UFormat {
* @stable ICU 3.6
*/
protected Object readResolve() throws InvalidObjectException {
if (this.equals(INTEGER))
if (this.getName().equals(INTEGER.getName()))
return INTEGER;
if (this.equals(FRACTION))
if (this.getName().equals(FRACTION.getName()))
return FRACTION;
if (this.equals(EXPONENT))
if (this.getName().equals(EXPONENT.getName()))
return EXPONENT;
if (this.equals(EXPONENT_SIGN))
if (this.getName().equals(EXPONENT_SIGN.getName()))
return EXPONENT_SIGN;
if (this.equals(EXPONENT_SYMBOL))
if (this.getName().equals(EXPONENT_SYMBOL.getName()))
return EXPONENT_SYMBOL;
if (this.equals(CURRENCY))
if (this.getName().equals(CURRENCY.getName()))
return CURRENCY;
if (this.equals(DECIMAL_SEPARATOR))
if (this.getName().equals(DECIMAL_SEPARATOR.getName()))
return DECIMAL_SEPARATOR;
if (this.equals(GROUPING_SEPARATOR))
if (this.getName().equals(GROUPING_SEPARATOR.getName()))
return GROUPING_SEPARATOR;
if (this.equals(PERCENT))
if (this.getName().equals(PERCENT.getName()))
return PERCENT;
if (this.equals(PERMILLE))
if (this.getName().equals(PERMILLE.getName()))
return PERMILLE;
if (this.equals(SIGN))
if (this.getName().equals(SIGN.getName()))
return SIGN;
throw new InvalidObjectException("An invalid object.");