Skip to content

Commit 9d330d4

Browse files
committed
Applied spotless:apply
Signed-off-by: Roy Ash <[email protected]>
1 parent b552557 commit 9d330d4

File tree

2 files changed

+32
-18
lines changed

2 files changed

+32
-18
lines changed

log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/DatePatternConverter.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@
1616
*/
1717
package org.apache.logging.log4j.core.pattern;
1818

19+
import static java.util.Objects.requireNonNull;
20+
21+
import java.time.format.DateTimeFormatter;
22+
import java.util.Arrays;
23+
import java.util.Date;
24+
import java.util.Locale;
25+
import java.util.TimeZone;
26+
import java.util.stream.Collectors;
1927
import org.apache.commons.lang3.time.FastDateFormat;
2028
import org.apache.logging.log4j.core.LogEvent;
2129
import org.apache.logging.log4j.core.config.plugins.Plugin;
@@ -29,15 +37,6 @@
2937
import org.jspecify.annotations.NullMarked;
3038
import org.jspecify.annotations.Nullable;
3139

32-
import java.time.format.DateTimeFormatter;
33-
import java.util.Arrays;
34-
import java.util.Date;
35-
import java.util.Locale;
36-
import java.util.TimeZone;
37-
import java.util.stream.Collectors;
38-
39-
import static java.util.Objects.requireNonNull;
40-
4140
/**
4241
* Converts and formats the event's date in a StringBuilder.
4342
*/
@@ -143,9 +142,9 @@ static String decodeNamedPattern(final String pattern) {
143142
// To avoid the `Z` output, one needs to use `x` with `DateTimeFormatter`.
144143
try {
145144
final NamedPattern namedPattern = NamedPattern.valueOf(pattern);
146-
return InstantPatternFormatter.LEGACY_FORMATTERS_ENABLED ?
147-
namedPattern.getLegacyPattern() :
148-
namedPattern.getNonLegacyPattern();
145+
return InstantPatternFormatter.LEGACY_FORMATTERS_ENABLED
146+
? namedPattern.getLegacyPattern()
147+
: namedPattern.getNonLegacyPattern();
149148
} catch (IllegalArgumentException ignored) { // for Java 22+ it can be changed to `IllegalArgumentException _`
150149
return pattern;
151150
}

log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/NamedPattern.java

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to you under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
117
package org.apache.logging.log4j.core.pattern;
218

319
@SuppressWarnings("SpellCheckingInspection")
@@ -17,16 +33,15 @@ public enum NamedPattern {
1733
ISO8601_BASIC_PERIOD("yyyyMMdd'T'HHmmss.SSS", "yyyyMMdd'T'HHmmss.SSS"),
1834
ISO8601("yyyy-MM-dd'T'HH:mm:ss,SSS", "yyyy-MM-dd'T'HH:mm:ss,SSS"),
1935
ISO8601_OFFSET_DATE_TIME_HH("yyyy-MM-dd'T'HH:mm:ss,SSSX", "yyyy-MM-dd'T'HH:mm:ss,SSSx"),
20-
ISO8601_OFFSET_DATE_TIME_HHMM("yyyy-MM-dd'T'HH:mm:ss,SSSyyyy-MM-dd'T'HH:mm:ss,SSSXX", "yyyy-MM-dd'T'HH:mm:ss,SSSxx"),
21-
ISO8601_OFFSET_DATE_TIME_HHCMM("yyyy-MM-dd'T'HH:mm:ss,SSSyyyy-MM-dd'T'HH:mm:ss,SSSXXX", "yyyy-MM-dd'T'HH:mm:ss,SSSxxx"),
36+
ISO8601_OFFSET_DATE_TIME_HHMM(
37+
"yyyy-MM-dd'T'HH:mm:ss,SSSyyyy-MM-dd'T'HH:mm:ss,SSSXX", "yyyy-MM-dd'T'HH:mm:ss,SSSxx"),
38+
ISO8601_OFFSET_DATE_TIME_HHCMM(
39+
"yyyy-MM-dd'T'HH:mm:ss,SSSyyyy-MM-dd'T'HH:mm:ss,SSSXXX", "yyyy-MM-dd'T'HH:mm:ss,SSSxxx"),
2240
ISO8601_PERIOD("yyyy-MM-dd'T'HH:mm:ss.SSS", "yyyy-MM-dd'T'HH:mm:ss.SSS"),
2341
ISO8601_PERIOD_MICROS("yyyy-MM-dd'T'HH:mm:ss.nnnnnn", "yyyy-MM-dd'T'HH:mm:ss.SSSSSS"),
2442
US_MONTH_DAY_YEAR2_TIME("dd/MM/yy HH:mm:ss.SSS", "dd/MM/yy HH:mm:ss.SSS"),
2543
US_MONTH_DAY_YEAR4_TIME("dd/MM/yyyy HH:mm:ss.SSS", "dd/MM/yyyy HH:mm:ss.SSS");
26-
27-
private final String
28-
legacyPattern,
29-
nonLegacyPattern;
44+
private final String legacyPattern, nonLegacyPattern;
3045

3146
NamedPattern(String legacyPattern, String nonLegacyPattern) {
3247
this.legacyPattern = legacyPattern;

0 commit comments

Comments
 (0)