ICU-1999 use toString() on StringBuffer.append(StringBuffer) only if the version is less than JDK1.4

X-SVN-Rev: 9357
This commit is contained in:
Ram Viswanadha 2002-07-25 22:49:07 +00:00
parent f29831ae18
commit 75c4d9c174
2 changed files with 20 additions and 5 deletions

View file

@ -13,6 +13,7 @@ import java.text.CharacterIterator;
import com.ibm.icu.impl.NormalizerImpl;
import com.ibm.icu.impl.UCharacterProperty;
import com.ibm.icu.lang.UCharacter;
import com.ibm.icu.impl.ICUDebug;
/**
* <p><code>CollationElementIterator</code> is an iterator created by
@ -862,7 +863,11 @@ public final class CollationElementIterator
backup.m_bufferOffset_ = m_bufferOffset_;
if (m_bufferOffset_ >= 0) {
// jdk 1.3.1 does not have append(StringBuffer) yet
backup.m_buffer_.append(m_buffer_.toString());
if(ICUDebug.isJDK14OrHigher){
backup.m_buffer_.append(m_buffer_);
}else{
backup.m_buffer_.append(m_buffer_.toString());
}
}
}

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/StringSearch.java,v $
* $Date: 2002/07/24 19:58:30 $
* $Revision: 1.11 $
* $Date: 2002/07/25 22:49:06 $
* $Revision: 1.12 $
*
*****************************************************************************************
*/
@ -1671,7 +1671,12 @@ public final class StringSearch extends SearchIterator
{
StringBuffer result = new StringBuffer();
if (source1 != null && source1.length() != 0) {
result.append(source1);
// jdk 1.3.1 does not have append(StringBuffer) yet
if(com.ibm.icu.impl.ICUDebug.isJDK14OrHigher){
result.append(source1);
}else{
result.append(source1.toString());
}
}
source2.setIndex(start2);
while (source2.getIndex() < end2) {
@ -1679,7 +1684,12 @@ public final class StringSearch extends SearchIterator
source2.next();
}
if (source3 != null && source3.length() != 0) {
result.append(source3);
// jdk 1.3.1 does not have append(StringBuffer) yet
if(com.ibm.icu.impl.ICUDebug.isJDK14OrHigher){
result.append(source3);
}else{
result.append(source3.toString());
}
}
return result;
}