aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Fick <mfick@nvidia.com>2024-12-05 14:33:34 -0800
committerMartin Fick <mfick@nvidia.com>2024-12-05 14:59:46 -0800
commiteb0ef9d16ea780c431837f904ad4d1ad0aaa5d7d (patch)
tree6aa9595c67a4aa5d8684c20d165b5e38d8381083
parentdd8b13acc0d60b53f399ce7e0c6718b81ad2ab16 (diff)
downloadjgit-eb0ef9d16ea780c431837f904ad4d1ad0aaa5d7d.tar.gz
jgit-eb0ef9d16ea780c431837f904ad4d1ad0aaa5d7d.zip
FileSnapshot: silence "Not a Directory" exceptions
Sometimes a FileSystemException with "Not a Directory" can be thrown while creating a FileSnapshot, likely because the file or directory was deleted. Since NoSuchFileExceptions are already silenced, and the FileSnapshot already handles all IOExceptions, there is likely no value in seeing this info in the logs, treat these situation the same and silence them also. Change-Id: I022639c42154a0a4c71065741f023f5eb95f9b55 Signed-off-by: Martin Fick <mfick@nvidia.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java
index c5e9e99673..d34baf358c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java
@@ -15,6 +15,7 @@ import static org.eclipse.jgit.util.FS.FileStoreAttributes.FALLBACK_TIMESTAMP_RE
import java.io.File;
import java.io.IOException;
+import java.nio.file.FileSystemException;
import java.nio.file.NoSuchFileException;
import java.nio.file.attribute.BasicFileAttributes;
import java.time.Duration;
@@ -581,6 +582,10 @@ public class FileSnapshot {
try {
return FS.DETECTED.fileAttributes(path);
} catch (NoSuchFileException e) {
+ } catch (FileSystemException e) {
+ if (!e.getMessage().endsWith("Not a directory")) {
+ LOG.error(e.getMessage(), e);
+ }
} catch (IOException e) {
LOG.error(e.getMessage(), e);
}