diff --git a/icu4j/src/com/ibm/icu/dev/test/bidi/TestAll.java b/icu4j/src/com/ibm/icu/dev/test/bidi/TestAll.java index b2d302be24f..2c831f4af51 100644 --- a/icu4j/src/com/ibm/icu/dev/test/bidi/TestAll.java +++ b/icu4j/src/com/ibm/icu/dev/test/bidi/TestAll.java @@ -1,3 +1,4 @@ +//##header /* ******************************************************************************* * Copyright (C) 2001-2007, International Business Machines diff --git a/icu4j/src/com/ibm/icu/dev/test/duration/DataReadWriteTest.java b/icu4j/src/com/ibm/icu/dev/test/duration/DataReadWriteTest.java index 003944540de..e523e5a9ff3 100644 --- a/icu4j/src/com/ibm/icu/dev/test/duration/DataReadWriteTest.java +++ b/icu4j/src/com/ibm/icu/dev/test/duration/DataReadWriteTest.java @@ -30,7 +30,7 @@ public class DataReadWriteTest extends TestFmwk { // strip line ends and trailing spaces private String normalize(String str) { - StringBuilder sb = new StringBuilder(); + StringBuffer sb = new StringBuffer(); boolean inLine = true; for (int i = 0; i < str.length(); ++i) { char c = str.charAt(i); diff --git a/icu4j/src/com/ibm/icu/dev/test/duration/LanguageTestRoot.java b/icu4j/src/com/ibm/icu/dev/test/duration/LanguageTestRoot.java index 58b119fa33c..238f241177e 100644 --- a/icu4j/src/com/ibm/icu/dev/test/duration/LanguageTestRoot.java +++ b/icu4j/src/com/ibm/icu/dev/test/duration/LanguageTestRoot.java @@ -165,7 +165,7 @@ public class LanguageTestRoot extends TestFmwk implements TimeUnitConstants { } protected static String timestring(Period ts) { - StringBuilder buf = new StringBuilder(); + StringBuffer buf = new StringBuffer(); if (ts.isMoreThan()) { buf.append("mt"); } else if (ts.isLessThan()) { @@ -183,12 +183,12 @@ public class LanguageTestRoot extends TestFmwk implements TimeUnitConstants { } protected static String asciify(String s) { - StringBuilder sb = null; + StringBuffer sb = null; for (int i = 0, e = s.length(); i < e; ++i) { char c = s.charAt(i); if (c < 0x20 || c > 0x7e) { if (sb == null) { - sb = new StringBuilder(); + sb = new StringBuffer(); sb.append(s.substring(0, i)); } sb.append("\\u"); diff --git a/icu4j/src/com/ibm/icu/impl/duration/BasicPeriodFormatter.java b/icu4j/src/com/ibm/icu/impl/duration/BasicPeriodFormatter.java index cbd7de73cea..5551c03a9e6 100644 --- a/icu4j/src/com/ibm/icu/impl/duration/BasicPeriodFormatter.java +++ b/icu4j/src/com/ibm/icu/impl/duration/BasicPeriodFormatter.java @@ -124,7 +124,7 @@ class BasicPeriodFormatter implements PeriodFormatter { } } - StringBuilder sb = new StringBuilder(); + StringBuffer sb = new StringBuffer(); // if we've been requested to not display a limit, or there are // no non-zero units, do not display the limit. diff --git a/icu4j/src/com/ibm/icu/impl/duration/impl/PeriodFormatterData.java b/icu4j/src/com/ibm/icu/impl/duration/impl/PeriodFormatterData.java index d91ac933d59..7a26bc5de30 100644 --- a/icu4j/src/com/ibm/icu/impl/duration/impl/PeriodFormatterData.java +++ b/icu4j/src/com/ibm/icu/impl/duration/impl/PeriodFormatterData.java @@ -98,7 +98,7 @@ public class PeriodFormatterData { * @param sb the string builder to which to append the text * @return true if a following digit will require a digit prefix */ - public boolean appendPrefix(int tl, int td, StringBuilder sb) { + public boolean appendPrefix(int tl, int td, StringBuffer sb) { if (dr.scopeData != null) { int ix = tl * 3 + td; ScopeData sd = dr.scopeData[ix]; @@ -121,7 +121,7 @@ public class PeriodFormatterData { * @param td how and whether to display the time direction * @param sb the string builder to which to append the text */ - public void appendSuffix(int tl, int td, StringBuilder sb) { + public void appendSuffix(int tl, int td, StringBuffer sb) { if (dr.scopeData != null) { int ix = tl * 3 + td; ScopeData sd = dr.scopeData[ix]; @@ -156,7 +156,7 @@ public class PeriodFormatterData { int uv, boolean useCountSep, boolean useDigitPrefix, boolean multiple, boolean last, boolean wasSkipped, - StringBuilder sb) { + StringBuffer sb) { int px = unit.ordinal(); boolean willRequireSkipMarker = false; @@ -261,7 +261,7 @@ public class PeriodFormatterData { public int appendCount(TimeUnit unit, boolean omitCount, boolean useDigitPrefix, int count, int cv, boolean useSep, - String name, boolean last, StringBuilder sb) { + String name, boolean last, StringBuffer sb) { if (cv == ECountVariant.HALF_FRACTION && dr.halves == null) { cv = ECountVariant.INTEGER; } @@ -390,7 +390,7 @@ public class PeriodFormatterData { * @param sb the string builder to which to append the text */ public void appendCountValue(int count, int integralDigits, - int decimalDigits, StringBuilder sb) { + int decimalDigits, StringBuffer sb) { int ival = count / 1000; if (decimalDigits == 0) { appendInteger(ival, integralDigits, 10, sb); @@ -415,7 +415,7 @@ public class PeriodFormatterData { } public void appendInteger(int num, int mindigits, int maxdigits, - StringBuilder sb) { + StringBuffer sb) { if (dr.numberNames != null && num < dr.numberNames.length) { String name = dr.numberNames[num]; if (name != null) { @@ -450,7 +450,7 @@ public class PeriodFormatterData { * @param sb the string builder to which to append the text */ public void appendDigits(long num, int mindigits, int maxdigits, - StringBuilder sb) { + StringBuffer sb) { char[] buf = new char[maxdigits]; int ix = maxdigits; while (ix > 0 && num > 0) { @@ -467,7 +467,7 @@ public class PeriodFormatterData { * Append a marker for skipped units internal to a string. * @param sb the string builder to which to append the text */ - public void appendSkippedUnit(StringBuilder sb) { + public void appendSkippedUnit(StringBuffer sb) { if (dr.skippedUnitMarker != null) { sb.append(dr.skippedUnitMarker); } @@ -484,7 +484,7 @@ public class PeriodFormatterData { */ public boolean appendUnitSeparator(TimeUnit unit, boolean longSep, boolean afterFirst, boolean beforeLast, - StringBuilder sb) { + StringBuffer sb) { // long seps // false, false "...b', '...d" // false, true "...', and 'c" diff --git a/icu4j/src/com/ibm/icu/impl/duration/impl/XMLRecordReader.java b/icu4j/src/com/ibm/icu/impl/duration/impl/XMLRecordReader.java index a51bbda77dd..2b837cf70dc 100644 --- a/icu4j/src/com/ibm/icu/impl/duration/impl/XMLRecordReader.java +++ b/icu4j/src/com/ibm/icu/impl/duration/impl/XMLRecordReader.java @@ -12,6 +12,8 @@ import java.io.Reader; import java.util.ArrayList; import java.util.List; +import com.ibm.icu.lang.UCharacter; + public class XMLRecordReader implements RecordReader { private Reader r; private List nameStack; @@ -188,7 +190,7 @@ public class XMLRecordReader implements RecordReader { } private String readData() { - StringBuilder sb = new StringBuilder(); + StringBuffer sb = new StringBuffer(); boolean inWhitespace = false; boolean inAmp = false; while (true) { @@ -200,7 +202,7 @@ public class XMLRecordReader implements RecordReader { if (c == '&') { c = readChar(); if (c == '#') { - StringBuilder numBuf = new StringBuilder(); + StringBuffer numBuf = new StringBuffer(); int radix = 10; c = readChar(); if (c == 'x') { @@ -219,7 +221,7 @@ public class XMLRecordReader implements RecordReader { throw ex; } } else { - StringBuilder charBuf = new StringBuilder(); + StringBuffer charBuf = new StringBuffer(); while (c != ';' && c != -1) { charBuf.append((char)c); c = readChar(); @@ -243,7 +245,7 @@ public class XMLRecordReader implements RecordReader { } } - if (Character.isWhitespace(c)) { + if (UCharacter.isWhitespace(c)) { if (inWhitespace) { continue; } @@ -268,7 +270,7 @@ public class XMLRecordReader implements RecordReader { } break; } - if (!Character.isWhitespace(c)) { + if (!UCharacter.isWhitespace(c)) { System.err.println("Unexpected non-whitespace character " + Integer.toHexString(c)); break; @@ -277,7 +279,7 @@ public class XMLRecordReader implements RecordReader { if (atTag) { atTag = false; - StringBuilder sb = new StringBuilder(); + StringBuffer sb = new StringBuffer(); while (true) { c = readChar(); if (c == '>' || c == -1) { diff --git a/icu4j/src/com/ibm/icu/impl/duration/impl/XMLRecordWriter.java b/icu4j/src/com/ibm/icu/impl/duration/impl/XMLRecordWriter.java index 64f7818e286..02f38000f06 100644 --- a/icu4j/src/com/ibm/icu/impl/duration/impl/XMLRecordWriter.java +++ b/icu4j/src/com/ibm/icu/impl/duration/impl/XMLRecordWriter.java @@ -12,6 +12,8 @@ import java.io.Writer; import java.util.ArrayList; import java.util.List; +import com.ibm.icu.lang.UCharacter; + public class XMLRecordWriter implements RecordWriter { private Writer w; private List nameStack; @@ -117,15 +119,15 @@ public class XMLRecordWriter implements RecordWriter { if (str == null) { return null; } - StringBuilder sb = null; + StringBuffer sb = null; boolean inWhitespace = false; char c = '\0'; boolean special = false; for (int i = 0; i < str.length(); ++i) { c = str.charAt(i); - if (Character.isWhitespace(c)) { + if (UCharacter.isWhitespace(c)) { if (sb == null && (inWhitespace || c != ' ')) { - sb = new StringBuilder(str.substring(0, i)); + sb = new StringBuffer(str.substring(0, i)); } if (inWhitespace) { continue; @@ -137,7 +139,7 @@ public class XMLRecordWriter implements RecordWriter { inWhitespace = false; special = c == '<' || c == '&'; if (special && sb == null) { - sb = new StringBuilder(str.substring(0, i)); + sb = new StringBuffer(str.substring(0, i)); } } if (sb != null) {