aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2024-12-25 01:17:03 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2024-12-25 13:59:10 +0100
commitf031b33289ea4596e283209decbe70d8d4c809b4 (patch)
tree859836de9f6913d9ff24cfb91f4c0cb97c96fdf4
parenta2c281f39f9a455bce18efc166d81887245c880a (diff)
downloadjgit-f031b33289ea4596e283209decbe70d8d4c809b4.tar.gz
jgit-f031b33289ea4596e283209decbe70d8d4c809b4.zip
AllowedSigners: use java.time API
We are moving away from the old java.util.Date API to the java.time API. Change-Id: I66147445b90df8ca8c8c65239bc9f1ca3f086e75
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/signing/ssh/AllowedSigners.java11
1 files changed, 3 insertions, 8 deletions
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/signing/ssh/AllowedSigners.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/signing/ssh/AllowedSigners.java
index cfbe7a78a7..e31ed64ed9 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/signing/ssh/AllowedSigners.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/signing/ssh/AllowedSigners.java
@@ -21,6 +21,7 @@ import java.text.MessageFormat;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
+import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
@@ -36,8 +37,6 @@ import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
-import java.util.TimeZone;
-import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@@ -482,12 +481,8 @@ final class AllowedSigners extends ModifiableFileWatcher {
if (isUTC) {
return time.atOffset(ZoneOffset.UTC).toInstant();
}
- TimeZone tz = SystemReader.getInstance().getTimeZone();
- // Since there are a few TimeZone IDs that are not recognized by ZoneId,
- // use offsets.
- return time.atOffset(ZoneOffset.ofTotalSeconds(
- (int) TimeUnit.MILLISECONDS.toSeconds(tz.getRawOffset())))
- .toInstant();
+ ZoneId tz = SystemReader.getInstance().getTimeZoneId();
+ return time.atZone(tz).toInstant();
}
// OpenSSH uses the backslash *only* to quote the double-quote.