[
https://issues.apache.org/jira/browse/LOG4J2-2850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17230716#comment-17230716
]
ASF subversion and git services commented on LOG4J2-2850:
---------------------------------------------------------
Commit a42def93e8052094e6586ca57bb2ce274ab98df4 in logging-log4j2's branch
refs/heads/master from Volkan Yazıcı
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=a42def9 ]
LOG4J2-2850 Fix indentation in LocalizedMessageFactoryTest.
> LocalizedMessageFactory creates new message with baseName as messagePattern
> ---------------------------------------------------------------------------
>
> Key: LOG4J2-2850
> URL: https://issues.apache.org/jira/browse/LOG4J2-2850
> Project: Log4j 2
> Issue Type: Bug
> Components: API
> Affects Versions: 2.13.3
> Reporter: Diego Villablanca
> Priority: Trivial
> Labels: easyfix
> Original Estimate: 10m
> Remaining Estimate: 10m
>
> 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.
> {code:java}
> /**
> * @since 2.8
> */
> @Override
> public Message newMessage(final String key) {
> if (resourceBundle == null) {
> return new LocalizedMessage(baseName, key);
> }
> return new LocalizedMessage(resourceBundle, key);
> }{code}
> The constructor of LocalizedMessage used is:
> {code:java}
> public LocalizedMessage(final String messagePattern, final Object arg) {
> this((ResourceBundle) null, (Locale) null, messagePattern, new Object[]
> {arg});
> }
> {code}
> The Factory should use this constructor:
> {code:java}
> public LocalizedMessage(final String baseName, final String key, final Object
> arg) {
> this(baseName, (Locale) null, key, new Object[] {arg});
> }{code}
> The fix should be:
> {code:java}
> /**
> * @since 2.8
> */
> @Override
> public Message newMessage(final String key) {
> if (resourceBundle == null) {
> return new LocalizedMessage(baseName, key, null);
> }
> return new LocalizedMessage(resourceBundle, key);
> }
> {code}
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)