From eb0ef9d16ea780c431837f904ad4d1ad0aaa5d7d Mon Sep 17 00:00:00 2001 From: Martin Fick Date: Thu, 5 Dec 2024 14:33:34 -0800 Subject: 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 --- .../src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java | 5 +++++ 1 file changed, 5 insertions(+) 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); } -- cgit v1.2.3