-
Bug
-
Resolution: Fixed
-
P3
-
1.1.6, 1.2.0
-
1.2beta4
-
sparc
-
solaris_2.5
-
Verified
Name: dfC67450 Date: 02/18/98
java.text.MessageFormat.applyPattern(String newPattern) changes old pattern
setting if newPattern is incorrect.
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 = "format: {0, xxxYYY}";
System.out.println("pattern before: \"" + mf.toPattern() + "\"");
System.out.println("illegal pattern: \"" + illegalPattern + "\"");
try {
mf.applyPattern(illegalPattern);
} catch (IllegalArgumentException e) {
}
System.out.println("pattern after: \"" + mf.toPattern() + "\"");
}
}
---------Output from the test---------------------
pattern before: "initial pattern"
illegal pattern: "format: {0, xxxYYY}"
pattern after: "initial {0}pattern"
--------------------------------------------------
======================================================================