Description
When I instantiate LocalizedMessageFactory with the String baseName constructor and then I create a new LocalizedMessage by the method public Message newMessage(final String key), it instantiates the message with the constructor that use String messagePattern and String key, using the resource bundle baseName as messagePattern, and the key as an argument of the pattern.
/** * @since 2.8 */ @Override public Message newMessage(final String key) { if (resourceBundle == null) { return new LocalizedMessage(baseName, key); } return new LocalizedMessage(resourceBundle, key); }
The constructor of LocalizedMessage used is:
public LocalizedMessage(final String messagePattern, final Object arg) { this((ResourceBundle) null, (Locale) null, messagePattern, new Object[] {arg}); }
The Factory should use this constructor:
public LocalizedMessage(final String baseName, final String key, final Object arg) { this(baseName, (Locale) null, key, new Object[] {arg}); }
The fix should be:
/** * @since 2.8 */ @Override public Message newMessage(final String key) { if (resourceBundle == null) { return new LocalizedMessage(baseName, key, null); } return new LocalizedMessage(resourceBundle, key); }
Attachments
Issue Links
- links to