diff -ru CVS/classpath/java/text/ChoiceFormat.java updated/classpath/java/text/ChoiceFormat.java
--- CVS/classpath/java/text/ChoiceFormat.java	2010-06-03 23:13:09.000000000 +0400
+++ updated/classpath/java/text/ChoiceFormat.java	2010-10-29 00:20:09.501955500 +0400
@@ -397,18 +397,35 @@
   /**
    * I'm not sure what this method is really supposed to do, as it is
    * not documented.
+   * We try to find the longest match.
    */
   public Number parse (String sourceStr, ParsePosition pos)
   {
     int index = pos.getIndex();
+    int maxEndPos = -1; // initially must be less than pos index.
+    int bestItemIdx = -1; // index of the best matching choice.
+
     for (int i = 0; i < choiceLimits.length; ++i)
       {
-        if (sourceStr.startsWith(choiceFormats[i], index))
+        String choiceFormat = choiceFormats[i];
+        if (sourceStr.startsWith(choiceFormat, index))
           {
-            pos.setIndex(index + choiceFormats[i].length());
-            return Double.valueOf (choiceLimits[i]);
+            int endPos = index + choiceFormat.length();
+            if (maxEndPos < endPos)
+              {
+                bestItemIdx = i;
+                maxEndPos = endPos;
+                if (endPos == sourceStr.length())
+                  break; // maxEndPos limit is reached
+              }
           }
       }
+
+    if (bestItemIdx != -1)
+      {
+        pos.setIndex(maxEndPos);
+        return Double.valueOf(choiceLimits[bestItemIdx]);
+      }
     pos.setErrorIndex(index);
     return Double.valueOf (Double.NaN);
   }
@@ -444,7 +461,7 @@
     this.choiceLimits = (double[]) choiceLimits.clone();
   }
 
-  private void quoteString (CPStringBuilder dest, String text)
+  private static void quoteString (CPStringBuilder dest, String text)
   {
     int max = text.length();
     for (int i = 0; i < max; ++i)
diff -ru CVS/classpath/java/text/MessageFormat.java updated/classpath/java/text/MessageFormat.java
--- CVS/classpath/java/text/MessageFormat.java	2010-06-03 23:13:10.000000000 +0400
+++ updated/classpath/java/text/MessageFormat.java	2010-11-03 09:17:37.408771500 +0300
@@ -650,10 +650,10 @@
           }
         else if (formatter != null)
           {
-            pos.setIndex(index);
-            value = formatter.parseObject(sourceStr, pos);
-            if (value != null)
-              index = pos.getIndex();
+            ParsePosition subpos = new ParsePosition(index);
+            value = formatter.parseObject(sourceStr, subpos);
+            index = value != null ? subpos.getIndex() :
+				    subpos.getErrorIndex();
           }
         else
           {
@@ -692,6 +692,7 @@
         index += elements[i].trailer.length();
       }
 
+    pos.setIndex(index); // update pos
     return results.toArray(new Object[results.size()]);
   }
 
