From adaf4f13be164a8c0ad5981cafd83b3e4d61ab39 Mon Sep 17 00:00:00 2001 From: Peter Kriens Date: Thu, 25 Apr 2024 10:12:34 +0200 Subject: [PATCH] Check if file exists to prevent falsely opening it --- Signed-off-by: Peter Kriens Signed-off-by: Peter Kriens --- .../src/bndtools/jareditor/internal/JarFileSystem.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bndtools.jareditor/src/bndtools/jareditor/internal/JarFileSystem.java b/bndtools.jareditor/src/bndtools/jareditor/internal/JarFileSystem.java index 7f489de5ec..7a9d0572e5 100644 --- a/bndtools.jareditor/src/bndtools/jareditor/internal/JarFileSystem.java +++ b/bndtools.jareditor/src/bndtools/jareditor/internal/JarFileSystem.java @@ -222,6 +222,11 @@ public IFileStore getStore(URI uri) { logger.logError("Cannot locate filestore for the JAR file: " + fileuri, e); return nullFileStore(Path.EMPTY); } + IFileInfo fetchInfo = store.fetchInfo(); + if (fetchInfo == null || !fetchInfo.exists()) { + logger.logInfo("File no longer exists: " + uri, null); + return nullFileStore(Path.EMPTY); + } JarRootNode root = roots.compute(store, this::computeRootNode) .get();