From ad2534c05e25d6f519c654cabd263324c3b3bc5d Mon Sep 17 00:00:00 2001 From: Sascha Rothkopf Date: Tue, 15 Sep 2020 13:52:06 +0200 Subject: [PATCH 1/2] dont set GMT+0 timezone if no timezone is given and use default super contructor of GregorianCalendar to use system default timezone --- .../ch/qos/logback/core/rolling/helper/RollingCalendar.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/logback-android/src/main/java/ch/qos/logback/core/rolling/helper/RollingCalendar.java b/logback-android/src/main/java/ch/qos/logback/core/rolling/helper/RollingCalendar.java index 2d461e5357..d94336e94f 100644 --- a/logback-android/src/main/java/ch/qos/logback/core/rolling/helper/RollingCalendar.java +++ b/logback-android/src/main/java/ch/qos/logback/core/rolling/helper/RollingCalendar.java @@ -72,7 +72,9 @@ public class RollingCalendar extends GregorianCalendar { } public RollingCalendar(String datePattern) { - this(datePattern, GMT_TIMEZONE, Locale.US); + super(); + this.datePattern = datePattern; + this.periodicityType = computePeriodicityType(); } public RollingCalendar(String datePattern, TimeZone tz, Locale locale) { From e40e9fa4c1518038e066f4a246a4f6a539bfaed0 Mon Sep 17 00:00:00 2001 From: Sascha Rothkopf Date: Mon, 21 Sep 2020 10:56:21 +0200 Subject: [PATCH 2/2] Use GMT+0 and Locale.US for static tests using hosts default timezone and locale broke some static tests --- .../qos/logback/core/rolling/helper/RollingCalendarTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/logback-android/src/test/java/ch/qos/logback/core/rolling/helper/RollingCalendarTest.java b/logback-android/src/test/java/ch/qos/logback/core/rolling/helper/RollingCalendarTest.java index 42578f15d5..4ac32b39ee 100644 --- a/logback-android/src/test/java/ch/qos/logback/core/rolling/helper/RollingCalendarTest.java +++ b/logback-android/src/test/java/ch/qos/logback/core/rolling/helper/RollingCalendarTest.java @@ -90,7 +90,7 @@ public void roundsDateWithMissingTimeUnits() throws ParseException { } private Calendar getEndOfNextNthPeriod(String dateFormat, Date date, int n) { - RollingCalendar rc = new RollingCalendar(dateFormat); + RollingCalendar rc = new RollingCalendar(dateFormat, GMT_TIMEZONE, Locale.US); Date nextDate = rc.getEndOfNextNthPeriod(date, n); Calendar cal = Calendar.getInstance(GMT_TIMEZONE, Locale.US); cal.setTime(nextDate); @@ -242,4 +242,4 @@ private void checkCollisionFreeness(String pattern, boolean expected) { assertFalse(rc.isCollisionFree()); } } -} \ No newline at end of file +}