Skip to content

No UI notification for FileStorageException types other than FILE_NOT_FOUND #5066

@timlehmkuhl

Description

@timlehmkuhl

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

  1. Open demo project
  2. Open Attachment List
  3. Edit an attachment
  4. Block write permissions on the filestorage directory in the filesystem
  5. Click button "Attach Demo File"
  6. Save the attachment

Current Behavior

  • No error notification is shown in the UI
  • FileRef remains null
  • The thrown FileStorageException (e.g. IO_EXCEPTION or STORAGE_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:

  1. Only register the handler for FILE_NOT_FOUND, not for all FileStorageException
  2. Re-throw or delegate to the generic handler if the type is not FILE_NOT_FOUND
  3. Provide a fallback notification for other FileStorageException types

Sample Project

fileDemo.zip

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions