diff --git a/afs-core/src/main/java/com/powsybl/afs/AppFileSystem.java b/afs-core/src/main/java/com/powsybl/afs/AppFileSystem.java index f58abe38..3af403ca 100644 --- a/afs-core/src/main/java/com/powsybl/afs/AppFileSystem.java +++ b/afs-core/src/main/java/com/powsybl/afs/AppFileSystem.java @@ -8,6 +8,7 @@ import com.google.common.base.Supplier; import com.google.common.base.Suppliers; +import com.powsybl.afs.storage.AfsStorageException; import com.powsybl.afs.storage.AppStorage; import com.powsybl.afs.storage.EventsBus; import com.powsybl.afs.storage.NodeInfo; @@ -129,6 +130,7 @@ public T findProjectFile(String projectFileId, Class /** * Retrieve a project node with undefined class * @param nodeId the node Id + * @throws AfsStorageException if the node not found * @return a typed node */ public AbstractNodeBase fetchNode(String nodeId) { diff --git a/afs-core/src/test/java/com/powsybl/afs/AfsBaseTest.java b/afs-core/src/test/java/com/powsybl/afs/AfsBaseTest.java index 5c8e537a..0b5c3131 100644 --- a/afs-core/src/test/java/com/powsybl/afs/AfsBaseTest.java +++ b/afs-core/src/test/java/com/powsybl/afs/AfsBaseTest.java @@ -10,6 +10,7 @@ import com.google.common.jimfs.Configuration; import com.google.common.jimfs.Jimfs; import com.powsybl.afs.mapdb.storage.MapDbAppStorage; +import com.powsybl.afs.storage.AfsStorageException; import com.powsybl.afs.storage.AppStorage; import com.powsybl.afs.storage.InMemoryEventsBus; import com.powsybl.afs.storage.NodeGenericMetadata; @@ -509,6 +510,13 @@ public void fetchNodeTest() { checkResult.accept(createdFile, afs.fetchNode(createdFile.getId())); checkResult.accept(nestedFile, afs.fetchNode(nestedFile.getId())); checkResult.accept(projectFolder, afs.fetchNode(projectFolder.getId())); + + try { + afs.fetchNode(UUID.randomUUID().toString()); + fail(); + } catch (AfsStorageException e) { + // ignored + } } @Test