-
Bug
-
Resolution: Fixed
-
P3
-
1.1.6, 1.2.0
-
1.2beta4
-
sparc
-
solaris_2.5
-
Verified
Name: dfC67450 Date: 03/11/98
Object[] java.text.MessageFormat.parse(String text, ParsePosition pp)
works incorrectly with patterns containing multiple occurences of the
same argument like "{0}, {0}, {0}". With this pattern the string
"x, y, z" is incorrect but method doesn't reject it.
Here is the test demonstrating the bug:
-----------------Test.java------------------------
import java.text.*;
public class Test {
public static void main (String args[]){
MessageFormat mf = new MessageFormat("{0}, {0}, {0}");
String forParsing = "x, y, z";
Object[] objs = mf.parse(forParsing, new ParsePosition(0));
System.out.println("pattern: \"" + mf.toPattern() + "\"");
System.out.println("text for parsing: \"" + forParsing + "\"");
System.out.println("argument0: \"" + objs[0] + "\"");
}
}
---------Output from the test ---------------------
pattern: "{0}, {0}, {0}"
text for parsing: "x, y, z"
argument0: "z"
--------------------------------------------------
======================================================================