summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-08-17 00:16:32 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2019-08-18 11:59:54 +0200
commit31356f5d181ea1a1c43b44d9dfbe9e8e81aed984 (patch)
treef2e79633381b5d7822994c01bbb72df66181c125 /org.eclipse.jgit
parentf383206ace187ec92672b806e18a54e8d398a27d (diff)
downloadjgit-31356f5d181ea1a1c43b44d9dfbe9e8e81aed984.tar.gz
jgit-31356f5d181ea1a1c43b44d9dfbe9e8e81aed984.zip
FileUtils#lastModifiedInstant should not log error if path doesn't exist
Change-Id: Id8447735beb24becb41612d3d29d5351f8273d22 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java
index 80f188cb2c..9f7d9a236e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java
@@ -55,6 +55,7 @@ import java.nio.file.CopyOption;
import java.nio.file.Files;
import java.nio.file.InvalidPathException;
import java.nio.file.LinkOption;
+import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
@@ -677,9 +678,14 @@ public class FileUtils {
try {
return Files.getLastModifiedTime(path, LinkOption.NOFOLLOW_LINKS)
.toInstant();
+ } catch (NoSuchFileException e) {
+ LOG.debug(
+ "Cannot read lastModifiedInstant since path {} does not exist", //$NON-NLS-1$
+ path);
+ return Instant.EPOCH;
} catch (IOException e) {
LOG.error(MessageFormat
- .format(JGitText.get().readLastModifiedFailed, path));
+ .format(JGitText.get().readLastModifiedFailed, path), e);
return Instant.ofEpochMilli(path.toFile().lastModified());
}
}