]> granicus.if.org Git - icu/commitdiff
ICU-8637 fix MessagePattern Part iteration when a plural style contains other followe...
authorMarkus Scherer <markus.icu@gmail.com>
Thu, 30 Jun 2011 18:33:32 +0000 (18:33 +0000)
committerMarkus Scherer <markus.icu@gmail.com>
Thu, 30 Jun 2011 18:33:32 +0000 (18:33 +0000)
X-SVN-Rev: 30259

icu4j/main/classes/core/src/com/ibm/icu/text/PluralFormat.java

index e9f86c747368a8ccf1da6a23927ff09514efa85e..5efd38f5a41c289ccab012497d1c0b780d7e4979 100644 (file)
@@ -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.