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


##########
log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/DatePatternConverter.java:
##########
@@ -52,6 +52,10 @@ private abstract static class Formatter {
         public String toPattern() {
             return null;
         }
+
+        public TimeZone getTimeZone() {
+            return null;
+        }

Review Comment:
   I would return `TimeZone.getDefault()` here to remove all null checks.



##########
log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/PatternProcessor.java:
##########
@@ -343,6 +347,15 @@ private RolloverFrequency calculateFrequency(final String 
pattern) {
         return null;
     }
 
+    private static TimeZone calculateTimeZone(DatePatternConverter 
dateConverter) {
+        TimeZone timeZone = dateConverter.getTimeZone();
+        if (timeZone != null) {
+            return timeZone;
+        } else {
+            return Calendar.getInstance().getTimeZone();
+        }
+    }

Review Comment:
   If `getTimeZone()` didn't return `null`, this would be unnecessary.



-- 
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