Skip to content

Commit

Permalink
[JENKINS-73775] Replace deprecated call to JGit setLastModified(long)
Browse files Browse the repository at this point in the history
JGit 5 deprecated the DirCacheEntry.setLastModified(long) method and
recommends DirCacheEntry.setLastModified(Instant).  JGit 7.0.0 removes
DirCacheEntry.setLastModified(long).  This change will work with old
versions of JGit and JGit 7.0.0 because the replacement method is
available with older versions and the most recent release.

Javadoc for JGit 6.9.0 is available at
https://javadoc.io/doc/org.eclipse.jgit/org.eclipse.jgit/6.9.0.202403050737-r/org.eclipse.jgit/org/eclipse/jgit/dircache/DirCacheEntry.html

Without this change, users that try to run the Git portion of Blue Ocean
may see a method not found exception that will fail the operation.
  • Loading branch information
MarkEWaite committed Sep 14, 2024
1 parent 7c2a374 commit 67ab912
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.text.MessageFormat;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
Expand Down Expand Up @@ -405,7 +406,7 @@ private static DirCache createTemporaryIndex(final Repository repo, final Object
final DirCache inCoreIndex = DirCache.newInCore();
final DirCacheBuilder dcBuilder = inCoreIndex.builder();
try (final ObjectInserter inserter = repo.newObjectInserter()) {
long lastModified = System.currentTimeMillis();
Instant lastModified = Instant.now();

try {
if (contents != null) {
Expand Down

0 comments on commit 67ab912

Please sign in to comment.