From: Markus Scherer Date: Thu, 30 Jun 2011 18:33:32 +0000 (+0000) Subject: ICU-8637 fix MessagePattern Part iteration when a plural style contains other followe... X-Git-Tag: milestone-59-0-1~4699 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ea2123175f186b0d8a16eca3442b34381ea62184;p=icu ICU-8637 fix MessagePattern Part iteration when a plural style contains other followed by a different keyword, and the PluralRules return other X-SVN-Rev: 30259 --- diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/PluralFormat.java b/icu4j/main/classes/core/src/com/ibm/icu/text/PluralFormat.java index e9f86c74736..5efd38f5a41 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/PluralFormat.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/PluralFormat.java @@ -393,8 +393,7 @@ public class PluralFormat extends UFormat { if(type==MessagePattern.Part.Type.ARG_LIMIT) { break; } - //TODO: Fix the assertion error - see ticket#8637 - //assert type==MessagePattern.Part.Type.ARG_SELECTOR; + assert type==MessagePattern.Part.Type.ARG_SELECTOR; // part is an ARG_SELECTOR followed by an optional explicit value, and then a message if(pattern.getPartType(partIndex).hasNumericValue()) { // explicit value like "=2" @@ -423,10 +422,10 @@ public class PluralFormat extends UFormat { // We have already seen an "other" sub-message. // Do not match "other" again. haveKeywordMatch=true; - continue; + // Skip keyword matching but do getLimitPartIndex(). } } - if(pattern.partSubstringMatches(part, keyword)) { + if(!haveKeywordMatch && pattern.partSubstringMatches(part, keyword)) { // keyword matches msgStart=partIndex; // Do not match this keyword again.