diff options
author | Ivan Frade <ifrade@google.com> | 2024-12-17 10:19:48 -0800 |
---|---|---|
committer | Ivan Frade <ifrade@google.com> | 2024-12-23 12:56:24 -0800 |
commit | 478c91216ff1867b747bbe6cfe0c180b4e0bbdf4 (patch) | |
tree | b452b44e920f0761db7977c5eeae7f365e973ff0 /org.eclipse.jgit/src/org | |
parent | 9219a7724e4f8b46130577acd24fee8cd7956099 (diff) | |
download | jgit-478c91216ff1867b747bbe6cfe0c180b4e0bbdf4.tar.gz jgit-478c91216ff1867b747bbe6cfe0c180b4e0bbdf4.zip |
RecursiveMerger: Create PersonIdent with java.time API
We are moving away from the old java.util.Date api to the
java.time.Instant version. This class uses a deprecated constructor in
PersonIdent.
Use the new constructor for PersonIdent with Instant/ZoneId.
Change-Id: I50e2a643ad17a5c0722f87b1bb8abcad286745a5
Diffstat (limited to 'org.eclipse.jgit/src/org')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java index fc5ab62898..f58ef4faba 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java @@ -18,10 +18,10 @@ package org.eclipse.jgit.merge; import java.io.IOException; import java.text.MessageFormat; +import java.time.Instant; +import java.time.ZoneOffset; import java.util.ArrayList; -import java.util.Date; import java.util.List; -import java.util.TimeZone; import java.util.stream.Collectors; import org.eclipse.jgit.dircache.DirCache; @@ -233,12 +233,11 @@ public class RecursiveMerger extends ResolveMerger { private static PersonIdent mockAuthor(List<RevCommit> parents) { String name = RecursiveMerger.class.getSimpleName(); int time = 0; - for (RevCommit p : parents) + for (RevCommit p : parents) { time = Math.max(time, p.getCommitTime()); - return new PersonIdent( - name, name + "@JGit", //$NON-NLS-1$ - new Date((time + 1) * 1000L), - TimeZone.getTimeZone("GMT+0000")); //$NON-NLS-1$ + } + return new PersonIdent(name, name + "@JGit", //$NON-NLS-1$ + Instant.ofEpochSecond(time+1), ZoneOffset.UTC); } private String failingPathsMessage() { |