-
Bug
-
Resolution: Fixed
-
P3
-
1.1.6, 1.2.0
-
1.2beta4
-
sparc
-
solaris_2.5
-
Verified
Name: dfC67450 Date: 02/24/98
java.text.MessageFormat.applyPattern(String newPattern) does not throw any
exceptions for illegal patterns.
Javadoc says:
* If a pattern is used, then unquoted braces in the pattern, if any, must match:
* that is, "ab {0} de" and "ab '}' de" are ok, but "ab {0'}' de" and "ab } de" are
* not.
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("initial pattern");
String illegalPattern = "ab { '}' de";
mf.applyPattern(illegalPattern);
System.out.println("illegal pattern: \"" + illegalPattern + "\"");
System.out.println("toPattern returns: \"" + mf.toPattern() + "\"");
}
}
---------Output from the test---------------------
illegal pattern: "ab { '}' de"
toPattern returns: "ab "
--------------------------------------------------
======================================================================