adwsingh commented on code in PR #1278:
URL: https://github.com/apache/logging-log4j2/pull/1278#discussion_r1108356964


##########
log4j-api/src/main/java/org/apache/logging/log4j/message/FormattedMessage.java:
##########
@@ -184,20 +182,20 @@ protected Message getMessage(final String msgPattern, 
final Object[] args, final
         try {
             final MessageFormat format = new MessageFormat(msgPattern);
             final Format[] formats = format.getFormats();
-            if (formats != null && formats.length > 0) {
+            if (formats.length > 0) {
                 return new MessageFormatMessage(locale, msgPattern, args);
             }
         } catch (final Exception ignored) {
             // Obviously, the message is not a proper pattern for 
MessageFormat.
         }
         try {
-            if (MSG_PATTERN.matcher(msgPattern).find()) {
-                return new StringFormattedMessage(locale, msgPattern, args);
+            if (ParameterizedMessage.countArgumentPlaceholders(msgPattern) > 
0) {
+                return new ParameterizedMessage(msgPattern, args, aThrowable);
             }
         } catch (final Exception ignored) {
-            // Also not properly formatted.
+            // Not a valid parameterized message.
         }

Review Comment:
   I felt so but erred on the side of caution. Removed now.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to