A DESCRIPTION OF THE PROBLEM :
MessageFormat.format("Test {0,number,invalid_style}", new Object[] { 42 }); doesn't throw IAE.
The class-level documentation defines what constitutes a valid pattern, specifying that only certain combinations of FormatType and FormatStyle are legal:
MessageFormat Class Doc : "The FormatType and FormatStyle values are used to create a Format instance for the format element. The following table shows how the values map to Format instances. Combinations not shown in the table are illegal."
And obviously invalid_style is not a valid style for number. So I think this should be an invalid combination.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
throw IAE
ACTUAL -
Test invalid_style42
---------- BEGIN SOURCE ----------
var str = MessageFormat.format("Test {0,number,invalid_style}", new Object[] { 42 });
System.out.println(str);
---------- END SOURCE ----------
MessageFormat.format("Test {0,number,invalid_style}", new Object[] { 42 }); doesn't throw IAE.
The class-level documentation defines what constitutes a valid pattern, specifying that only certain combinations of FormatType and FormatStyle are legal:
MessageFormat Class Doc : "The FormatType and FormatStyle values are used to create a Format instance for the format element. The following table shows how the values map to Format instances. Combinations not shown in the table are illegal."
And obviously invalid_style is not a valid style for number. So I think this should be an invalid combination.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
throw IAE
ACTUAL -
Test invalid_style42
---------- BEGIN SOURCE ----------
var str = MessageFormat.format("Test {0,number,invalid_style}", new Object[] { 42 });
System.out.println(str);
---------- END SOURCE ----------