From b074e8eb44627fcc45294320d3465f17ecab83c2 Mon Sep 17 00:00:00 2001 From: Stepan Usatiuk Date: Sun, 4 May 2025 17:13:43 +0200 Subject: [PATCH] Dhfs-fs: proper not found unlink exception --- .../java/com/usatiuk/dhfsfs/service/DhfsFileServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dhfs-parent/dhfs-fs/src/main/java/com/usatiuk/dhfsfs/service/DhfsFileServiceImpl.java b/dhfs-parent/dhfs-fs/src/main/java/com/usatiuk/dhfsfs/service/DhfsFileServiceImpl.java index c4b76854..88b02a55 100644 --- a/dhfs-parent/dhfs-fs/src/main/java/com/usatiuk/dhfsfs/service/DhfsFileServiceImpl.java +++ b/dhfs-parent/dhfs-fs/src/main/java/com/usatiuk/dhfsfs/service/DhfsFileServiceImpl.java @@ -218,6 +218,8 @@ public class DhfsFileServiceImpl implements DhfsFileService { public void unlink(String name) { jObjectTxManager.executeTx(() -> { var node = getDirEntryOpt(name).orElse(null); + if (node == null) + throw new StatusRuntimeException(Status.NOT_FOUND.withDescription("File not found when trying to unlink: " + name)); if (node.meta() instanceof JKleppmannTreeNodeMetaDirectory f) { if (!allowRecursiveDelete && !node.children().isEmpty()) throw new DirectoryNotEmptyException();