ppkarwasz commented on code in PR #3338:
URL: https://github.com/apache/logging-log4j2/pull/3338#discussion_r1898976205


##########
log4j-core/src/main/java/org/apache/logging/log4j/core/util/internal/instant/InstantPatternDynamicFormatter.java:
##########
@@ -256,131 +270,36 @@ else if (c == '\'') {
                 }
                 final String sequenceLiteral =
                         (startIndex + 1) == endIndex ? "'" : 
pattern.substring(startIndex + 1, endIndex);
-                final PatternSequence sequence = new 
StaticPatternSequence(sequenceLiteral);
+                final PatternFormatterFactory sequence = new 
StaticPatternFormatterFactory(sequenceLiteral);
                 sequences.add(sequence);
                 startIndex = endIndex + 1;
             }
 
             // Handle unknown literal
             else {
-                final PatternSequence sequence = new StaticPatternSequence("" 
+ c);
+                final PatternFormatterFactory sequence = new 
StaticPatternFormatterFactory("" + c);
                 sequences.add(sequence);
                 startIndex++;
             }
         }
-        return mergeConsequentStaticPatternSequences(sequences);
+        return sequences;
     }
 
     private static boolean isDynamicPatternLetter(final char c) {
         return "GuyDMLdgQqYwWEecFaBhKkHmsSAnNVvzOXxZ".indexOf(c) >= 0;
     }
 
     /**
-     * Merges consequent static sequences.
+     * Merges sequences of formatter factories using {@link 
PatternFormatterFactory#tryMerge}.
      *
      * <p>
-     * For example, the sequencing of the {@code [MM-dd] HH:mm} pattern will 
create two static sequences for {@code ]} (right brace) and {@code } 
(whitespace) characters.
-     * This method will combine such consequent static sequences into one.
+     * For example, given the {@code yyyy-MM-dd'T'HH:mm:ss.SSS} pattern and a 
precision threshold of {@link ChronoUnit#MINUTES},
+     * this method will combine sequences associated with {@code 
yyyy-MM-dd'T'HH:mm:} into a single sequence,
+     * since these are consequent and effectively constant sequences.

Review Comment:
   By "sequence" I mean a sequence of pattern formatter factories.
   Anyway I reverted the old terminology.



-- 
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: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to