diff options
author | Ivan Frade <ifrade@google.com> | 2024-11-13 11:58:06 -0800 |
---|---|---|
committer | Ivan Frade <ifrade@google.com> | 2024-11-13 12:03:54 -0800 |
commit | c64bc936938b1388065be1c89eb929278b505a87 (patch) | |
tree | b12e2d0453b7aeb5c041a651c8e032abdf984779 | |
parent | bf48fb73a211b020551d574a1ab50138697b7160 (diff) | |
download | jgit-c64bc936938b1388065be1c89eb929278b505a87.tar.gz jgit-c64bc936938b1388065be1c89eb929278b505a87.zip |
SystemReader: Give a default implementation to #getTimezoneAt()
This abstract method forces subclasses (e.g. DelegateSystemReader in
gerrit) to update their code, but there is no strong reason to make it
abstract (subclasses can override it if needed).
Make the method concrete using the current default implementation
(which is the same in the mock).
Change-Id: Id1df0d71cab1d86879adf48e782f0050d3abcfa9
-rw-r--r-- | org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java | 5 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java | 9 |
2 files changed, 3 insertions, 11 deletions
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java index b0365aa7e1..b0a1827265 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java @@ -245,11 +245,6 @@ public class MockSystemReader extends SystemReader { } @Override - public ZoneOffset getTimeZoneAt(Instant when) { - return getTimeZoneId().getRules().getOffset(when); - } - - @Override public TimeZone getTimeZone() { return TimeZone.getTimeZone("GMT-03:30"); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java index 7150e471bc..18b0e152c9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java @@ -178,11 +178,6 @@ public abstract class SystemReader { public int getTimezone(long when) { return getTimeZone().getOffset(when) / (60 * 1000); } - - @Override - public ZoneOffset getTimeZoneAt(Instant when) { - return getTimeZoneId().getRules().getOffset(when); - } } /** @@ -569,7 +564,9 @@ public abstract class SystemReader { * @return the local time zone * @since 7.1 */ - public abstract ZoneOffset getTimeZoneAt(Instant when); + public ZoneOffset getTimeZoneAt(Instant when) { + return getTimeZoneId().getRules().getOffset(when); + } /** * Get system time zone, possibly mocked for testing |