breakiterator bug terminated

X-SVN-Rev: 9316
This commit is contained in:
Syn Wee Quek 2002-07-24 19:13:31 +00:00
parent 0bc2ccb78a
commit 65cd4eb2d3
2 changed files with 18 additions and 6 deletions

View file

@ -63,6 +63,7 @@ public class SearchTest extends TestFmwk {
new SearchData("a\u0300\u0325", "\u0300", null, Collator.TERTIARY, null, new int[]{-1}, new int[]{0}),
new SearchData("a\u0300\u0325", "\u0300\u0325", null, Collator.TERTIARY, null, new int[]{1, -1}, new int[]{2}),
new SearchData("a\u0300b", "\u0300", null, Collator.TERTIARY, null, new int[]{1, -1}, new int[]{1}),
new SearchData("É", "e", null, Collator.PRIMARY, null, new int[]{0, -1}, new int[]{1}),
new SearchData(null, null, null, Collator.TERTIARY, null, new int[]{-1}, new int[]{0})
};
@ -78,6 +79,7 @@ public class SearchTest extends TestFmwk {
"characterbreaker", new int[] {1, 17, 30, -1}, new int[] {1, 1, 1}),
new SearchData("testing that string ab\u00e9cd does not match e", "e", null, Collator.TERTIARY,
"characterbreaker", new int[] {1, 28, 41, -1}, new int[] {1, 1, 1}),
new SearchData("É", "e", "fr", Collator.PRIMARY, "characterbreaker", new int[]{0, -1}, new int[]{1}),
new SearchData(null, null, null, Collator.TERTIARY, null, new int[] {-1}, new int[] {0})
};
@ -93,6 +95,7 @@ public class SearchTest extends TestFmwk {
"characterbreaker", new int[] {1, 17, 30, -1}, new int[] {1, 1, 1}),
new SearchData("testing that string ab\u00e9cd does not match e", "e", null,
Collator.TERTIARY, "characterbreaker", new int[] {1, 28, 41, -1}, new int[] {1, 1, 1}),
new SearchData("É", "e", "fr", Collator.PRIMARY, "characterbreaker", new int[]{0, -1}, new int[]{1}),
new SearchData(null, null, null, Collator.TERTIARY, null, new int[] {-1}, new int[] {0})
};
@ -686,7 +689,7 @@ public class SearchTest extends TestFmwk {
}
count = 0;
while (BREAKITERATOREXACT[count].text != null) {
if (!assertEqual(BREAKITERATOREXACT[count])) {
if (!assertEqual(BREAKITERATOREXACT[count])) {
errln("Error at test number " + count);
}
count++;
@ -1040,9 +1043,12 @@ public class SearchTest extends TestFmwk {
pattern = search.pattern;
strsrch.setTarget(new StringCharacterIterator(text));
strsrch.setPattern(pattern);
strsrch.getCollator().setStrength(search.strength);
strsrch.reset();
int count = 0;
int matchindex = search.offset[count];
while (matchindex >= 0) {
int matchlength = search.size[count];
strsrch.next();
@ -1073,6 +1079,7 @@ public class SearchTest extends TestFmwk {
return;
}
}
strsrch.getCollator().setStrength(Collator.TERTIARY);
}
public void TestGetSetOffsetCanonical() {
@ -1141,6 +1148,7 @@ public class SearchTest extends TestFmwk {
return;
}
}
strsrch.getCollator().setStrength(Collator.TERTIARY);
}
public void TestIgnorable() {

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/StringSearch.java,v $
* $Date: 2002/07/12 21:59:22 $
* $Revision: 1.9 $
* $Date: 2002/07/24 19:13:30 $
* $Revision: 1.10 $
*
*****************************************************************************************
*/
@ -1077,8 +1077,12 @@ public final class StringSearch extends SearchIterator
return false;
}
}
if (m_utilColEIter_.next()
!= CollationElementIterator.NULLORDER
int nextce = m_utilColEIter_.next();
while (m_utilColEIter_.getOffset() == end
&& getCE(nextce) == CollationElementIterator.IGNORABLE) {
nextce = m_utilColEIter_.next();
}
if (nextce != CollationElementIterator.NULLORDER
&& m_utilColEIter_.getOffset() == end) {
// extra collation elements at the end of the match
return false;