ICU-6134 Old Java compatibility support. NumberFormat.Field is not available on Java 1.3 environment.

X-SVN-Rev: 25263
This commit is contained in:
Yoshito Umaoka 2009-01-16 05:18:40 +00:00
parent 5808634616
commit 7855175c22
2 changed files with 21 additions and 17 deletions
icu4j
preprocessor.txt
src/com/ibm/icu/dev/test/format

View file

@ -41,6 +41,7 @@ src/com/ibm/icu/dev/test/collator/RandomCollator.java
src/com/ibm/icu/dev/test/duration/ICUDurationTest.java
src/com/ibm/icu/dev/test/format/BigNumberFormatTest.java
src/com/ibm/icu/dev/test/format/DateFormatTest.java
src/com/ibm/icu/dev/test/format/IntlTestDecimalFormatAPI.java
src/com/ibm/icu/dev/test/format/IntlTestDecimalFormatAPIC.java
src/com/ibm/icu/dev/test/format/IntlTestNumberFormatAPI.java
src/com/ibm/icu/dev/test/format/NumberFormatRegressionTest.java

View file

@ -1,6 +1,7 @@
//##header J2SE15
/*****************************************************************************************
*
* Copyright (C) 1996-2008, International Business Machines
* Copyright (C) 1996-2009, International Business Machines
* Corporation and others. All Rights Reserved.
**/
@ -265,25 +266,27 @@ public class IntlTestDecimalFormatAPI extends com.ibm.icu.dev.test.TestFmwk
}
}
public void testJB6134()
{
DecimalFormat decfmt = new DecimalFormat();
StringBuffer buf = new StringBuffer();
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
public void testJB6134()
{
DecimalFormat decfmt = new DecimalFormat();
StringBuffer buf = new StringBuffer();
FieldPosition fposByInt = new FieldPosition(NumberFormat.INTEGER_FIELD);
decfmt.format(123, buf, fposByInt);
FieldPosition fposByInt = new FieldPosition(NumberFormat.INTEGER_FIELD);
decfmt.format(123, buf, fposByInt);
buf.setLength(0);
FieldPosition fposByField = new FieldPosition(NumberFormat.Field.INTEGER);
decfmt.format(123, buf, fposByField);
if (fposByInt.getEndIndex() != fposByField.getEndIndex())
{
errln("ERROR: End index for integer field - fposByInt:" + fposByInt.getEndIndex() +
" / fposByField: " + fposByField.getEndIndex());
}
}
buf.setLength(0);
FieldPosition fposByField = new FieldPosition(NumberFormat.Field.INTEGER);
decfmt.format(123, buf, fposByField);
if (fposByInt.getEndIndex() != fposByField.getEndIndex())
{
errln("ERROR: End index for integer field - fposByInt:" + fposByInt.getEndIndex() +
" / fposByField: " + fposByField.getEndIndex());
}
}
//#endif
}