-
Notifications
You must be signed in to change notification settings - Fork 148
Description
Environment
- Jmix version: 2.7.4
Bug Description
When a FileStorageException is thrown with a type other than FILE_NOT_FOUND, no exception notification is shown in the UI.
The reason is that FileNotExistsExceptionHandler is registered for FileStorageException, but internally it only handles exceptions of type FILE_NOT_FOUND.
For all other FileStorageException.Type values, the handler returns without showing a notification.
Because a specific handler for FileStorageException exists, the generic UI exception notification mechanism is not triggered.
As a result, the exception becomes invisible to the user.
Steps To Reproduce
- Open demo project
- Open Attachment List
- Edit an attachment
- Block write permissions on the
filestoragedirectory in the filesystem - Click button "Attach Demo File"
- Save the attachment
Current Behavior
- No error notification is shown in the UI
FileRefremainsnull- The thrown
FileStorageException(e.g.IO_EXCEPTIONorSTORAGE_INACCESSIBLE) is not visible to the user - No generic exception dialog appears
The exception is effectively swallowed on the UI level.
Expected Behavior
If a FileStorageException is thrown with a type other than FILE_NOT_FOUND, a proper error notification or generic exception dialog should be shown in the UI.
The exception must not silently disappear.
Root Cause Analysis
FileNotExistsExceptionHandler is registered for:
super(FileStorageException.class.getName());But in doHandle():
if (FileStorageException.Type.FILE_NOT_FOUND != ((FileStorageException) throwable).getType()) {
return;
}For all other FileStorageException.Type values, the handler returns without handling the exception.
Since the handler is considered responsible for FileStorageException, the default generic exception handler is not invoked.
Suggested Fix
One of the following approaches:
- Only register the handler for
FILE_NOT_FOUND, not for allFileStorageException - Re-throw or delegate to the generic handler if the type is not
FILE_NOT_FOUND - Provide a fallback notification for other
FileStorageExceptiontypes
Sample Project
Metadata
Metadata
Assignees
Labels
Type
Projects
Status