Repository navigation
Feature: Files in use - #4078
Conversation
# Conflicts: # pom.xml
Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
and reduce css Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (3)
src/main/java/org/cryptomator/ui/notification/NotificationController.java (2)
126-133: Add defensive validation for path edge cases.The JavaDoc states the path must not end with "/", but there's no runtime validation. If an empty path or path ending with "/" is passed,
filenamebecomes empty, andfilename.substring(filename.length() - 6)throwsStringIndexOutOfBoundsException.🔎 Apply this diff to add validation:
private String convertPathStringToShortenedFileName(String path) { + if (path == null || path.isEmpty() || path.endsWith("/")) { + return "unknown"; + } var filename = path.substring(path.lastIndexOf("/") + 1); + if (filename.isEmpty()) { + return "unknown"; + } if (filename.length() < 20) {
137-146: Potential NPE whenselectedEventis null.If
selectedEvent.get()returns null (e.g., when the events list becomes empty before this method is invoked), line 140 will throw aNullPointerExceptionwhen callingev.actualEvent().🔎 Apply this diff to add null guard:
@FXML public void processSelectedEvent() { + var ev = selectedEvent.get(); + if (ev == null) { + close(); + return; + } try { - var ev = selectedEvent.get(); switch (ev.actualEvent()) {src/main/java/org/cryptomator/ui/eventview/EventListCellController.java (1)
265-273: Use type-safe mount point handling to ensure correct path conversion across platforms.The current implementation calls
uri().getPath().substring(1)unconditionally, which creates relative paths on Unix systems instead of absolute paths. On Unix,file:///home/user/mountyields/home/user/mountfromgetPath(), andsubstring(1)produceshome/user/mount(relative). On Windows,file:///C:/Users/mountyields/C:/Users/mount, wheresubstring(1)correctly producesC:/Users/mount.Follow the pattern used elsewhere in the codebase (e.g.,
Vault.java,VaultDetailUnlockedController.java): check if the mount point isMountpoint.WithPathand usemp.path()directly instead of extracting the path from the URI. This ensures proper absolute path handling across all platforms and aligns with how mount points are accessed throughout the application.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (5)
dist/linux/appimage/build.shis excluded by!**/dist/**dist/linux/common/application-vnd.cryptomator.encrypted.xmlis excluded by!**/dist/**dist/linux/debian/cryptomator.installis excluded by!**/dist/**dist/mac/resources/Info.plistis excluded by!**/dist/**dist/win/resources/main.wxsis excluded by!**/dist/**
📒 Files selected for processing (5)
src/main/java/org/cryptomator/common/Constants.java(1 hunks)src/main/java/org/cryptomator/common/FilesystemOwnerSupplier.java(1 hunks)src/main/java/org/cryptomator/ui/eventview/EventListCellController.java(7 hunks)src/main/java/org/cryptomator/ui/notification/NotificationController.java(1 hunks)src/main/resources/i18n/strings.properties(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- src/main/java/org/cryptomator/common/Constants.java
- src/main/java/org/cryptomator/common/FilesystemOwnerSupplier.java
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3267
File: src/main/java/org/cryptomator/ui/vaultoptions/VaultOptionsController.java:54-56
Timestamp: 2024-07-27T13:14:40.963Z
Learning: The user `infeo` has clarified that in the Cryptomator project, it is intentional for the vault options to be disabled when the vault is unlocked and not disabled when the vault is locked. This is a specific design decision for the `VaultOptionsController.java` within the context of PR 3267.
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3780
File: src/main/java/org/cryptomator/ui/eventview/EventListCellController.java:113-128
Timestamp: 2025-03-21T15:58:30.027Z
Learning: In Cryptomator's event system, entries are removed directly from the model (FileSystemEventAggregator) and then automatically synced to the view (FxFSEventList) with a potential delay of up to one second. This follows a model-view pattern where verification of removal is handled by the synchronization mechanism rather than explicit logging.
📚 Learning: 2025-10-20T20:55:38.432Z
Learnt from: oyvinrog
Repo: cryptomator/cryptomator PR: 4018
File: src/main/resources/i18n/strings_sk.properties:486-494
Timestamp: 2025-10-20T20:55:38.432Z
Learning: In Cryptomator, new i18n keys are intentionally added to all locale files (strings_*.properties) with English placeholder values first. Actual translations are provided later through separate Crowdin commits. This prevents runtime errors and is the project's standard translation workflow. Do not flag English values in non-English locale files as translation issues.
Applied to files:
src/main/resources/i18n/strings.propertiessrc/main/java/org/cryptomator/ui/notification/NotificationController.javasrc/main/java/org/cryptomator/ui/eventview/EventListCellController.java
📚 Learning: 2024-11-21T16:57:58.292Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3618
File: src/main/java/org/cryptomator/ui/fxapp/FxApplicationWindows.java:151-165
Timestamp: 2024-11-21T16:57:58.292Z
Learning: In the file `src/main/java/org/cryptomator/ui/fxapp/FxApplicationWindows.java`, when reviewing the method `showDokanySupportEndWindow`, suggestions to add error handling to asynchronous dialog creation (e.g., `CompletableFuture`) may be considered out of scope for certain pull requests.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.javasrc/main/java/org/cryptomator/ui/eventview/EventListCellController.java
📚 Learning: 2024-11-24T16:41:49.825Z
Learnt from: purejava
Repo: cryptomator/cryptomator PR: 3311
File: src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.java:52-56
Timestamp: 2024-11-24T16:41:49.825Z
Learning: In the Cryptomator project, null checks for JavaFX FXML injected components in the `initialize` method (e.g., in `MasterkeyOptionsController.java`) are unnecessary, as null values would indicate a severe issue with the JavaFX framework.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2024-12-11T13:52:43.966Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3618
File: src/main/java/org/cryptomator/ui/dialogs/SimpleDialogController.java:55-67
Timestamp: 2024-12-11T13:52:43.966Z
Learning: In the `SimpleDialogController` class of the Cryptomator application, the actions passed to the `handleOk()` and `handleCancel()` methods are responsible for their own error handling. Therefore, wrapping these actions with try-catch blocks in the controller is unnecessary.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2024-11-21T16:31:37.834Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3618
File: src/main/java/org/cryptomator/ui/mainwindow/VaultListContextMenuController.java:85-97
Timestamp: 2024-11-21T16:31:37.834Z
Learning: In `VaultListContextMenuController.didClickRemoveVault`, adding error handling and additional safety measures around vault removal is considered out of scope for this PR.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2024-07-27T13:14:40.963Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3267
File: src/main/java/org/cryptomator/ui/vaultoptions/VaultOptionsController.java:54-56
Timestamp: 2024-07-27T13:14:40.963Z
Learning: The user `infeo` has clarified that in the Cryptomator project, it is intentional for the vault options to be disabled when the vault is unlocked and not disabled when the vault is locked. This is a specific design decision for the `VaultOptionsController.java` within the context of PR 3267.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2024-11-24T16:47:01.698Z
Learnt from: purejava
Repo: cryptomator/cryptomator PR: 3311
File: src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.java:0-0
Timestamp: 2024-11-24T16:47:01.698Z
Learning: In Cryptomator, avoid adding unnecessary complexity to error handling in UI controllers unless it's critical.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2024-12-11T13:52:42.201Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3618
File: src/main/java/org/cryptomator/ui/dialogs/SimpleDialogController.java:27-45
Timestamp: 2024-12-11T13:52:42.201Z
Learning: In the Cryptomator project, parameter validation is performed in the `SimpleDialog` builder, so it's unnecessary to duplicate validation in controller classes like `SimpleDialogController`.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2025-12-18T14:24:57.436Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 4078
File: src/main/java/org/cryptomator/common/Constants.java:16-16
Timestamp: 2025-12-18T14:24:57.436Z
Learning: In the Cryptomator Hub integration, HUB_USER_DEVICE_SEPARATOR must be a character not present in usernames or device names to safely concatenate userName + '&' + deviceName and later split it without extra escaping. This pattern should be enforced consistently across Java sources that use HUB_USER_DEVICE_SEPARATOR (not just Constants.java). Add a short code comment documenting the constraint, and include unit tests that verify both correct concatenation and correct parsing when the separator is present. If the separator ever changes, re-evaluate all concatenation/splitting logic and encoding assumptions.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.javasrc/main/java/org/cryptomator/ui/eventview/EventListCellController.java
📚 Learning: 2025-03-21T15:58:30.027Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3780
File: src/main/java/org/cryptomator/ui/eventview/EventListCellController.java:113-128
Timestamp: 2025-03-21T15:58:30.027Z
Learning: In Cryptomator's event system, entries are removed directly from the model (FileSystemEventAggregator) and then automatically synced to the view (FxFSEventList) with a potential delay of up to one second. This follows a model-view pattern where verification of removal is handled by the synchronization mechanism rather than explicit logging.
Applied to files:
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java
📚 Learning: 2024-11-19T23:01:51.307Z
Learnt from: gepbird
Repo: cryptomator/cryptomator PR: 3621
File: src/main/java/org/cryptomator/ui/keyloading/hub/HubConfig.java:55-58
Timestamp: 2024-11-19T23:01:51.307Z
Learning: In the Cryptomator project, updating `LegacyRegisterDeviceController` is not necessary when changing URI construction methods.
Applied to files:
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Build Cryptomator.app for arm64
- GitHub Check: Build AppImage (ubuntu-latest, x86_64, https://download2.gluonhq.com/openjfx/25/openjfx-25_linux-...
- GitHub Check: Build AppImage (ubuntu-24.04-arm, aarch64, https://download2.gluonhq.com/openjfx/25/openjfx-25_li...
- GitHub Check: Build .msi Installer (x64, windows-latest, zulu, 25.0.1+8, jdk)
- GitHub Check: Compile and Test
🔇 Additional comments (7)
src/main/resources/i18n/strings.properties (1)
16-16: Strings additions look good.The new button label and event view entries follow existing conventions and are syntactically correct. The commented notification template keys at lines 710–712 appear to be intentional placeholders, likely documented for the notification feature referenced in PR #4069. As per the learnings, adding new i18n keys with English values first is standard practice in the Crowdin workflow.
Also applies to: 699-712
src/main/java/org/cryptomator/ui/notification/NotificationController.java (3)
55-72: Constructor initialization looks good.The dependency injection and property initialization are well-structured. The locale fallback logic for the DateTimeFormatter appropriately handles the case when
preferredLanguageis null.
152-169: Bounds validation inremoveSelectedEvent()looks good.The defensive check at lines 155-158 properly validates the index before removal and handles the error case gracefully by logging and closing the window.
227-233: Good null-safety ingetActionText().Using
Objects.requireNonNullElseto return an empty string whenactionTextis null prevents NPEs in UI bindings.src/main/java/org/cryptomator/ui/eventview/EventListCellController.java (3)
3-4: LGTM!The new imports, localized action usage at line 120, and FileIsInUseEvent case handling are correct and consistent with the i18n refactoring applied throughout this file.
Also applies to: 120-120, 129-129
212-222: LGTM!The helper methods properly separate localization concerns and menu item creation. This refactoring improves maintainability and consistency across the event adjustment methods.
159-209: LGTM!All event adjustment methods have been consistently refactored to use
addLocalizedAction, properly implementing internationalization support across the event view.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java (1)
134-152: Consider a different icon for the locked-by-another-user state.
LOCK_OPENmight suggest the file is available, but it's actually locked by another user. Consider usingLOCKorUSER_LOCKto better convey that the file is inaccessible.🔎 Alternative icon suggestion
private void adjustToFileInUseEvent(FileIsInUseEvent fiiue) { - eventIcon.setValue(FontAwesome5Icon.LOCK_OPEN); + eventIcon.setValue(FontAwesome5Icon.LOCK); eventMessage.setValue(resourceBundle.getString("eventView.entry.inUse.message"));
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java(7 hunks)
🧰 Additional context used
🧠 Learnings (16)
📓 Common learnings
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3267
File: src/main/java/org/cryptomator/ui/vaultoptions/VaultOptionsController.java:54-56
Timestamp: 2024-07-27T13:14:40.963Z
Learning: The user `infeo` has clarified that in the Cryptomator project, it is intentional for the vault options to be disabled when the vault is unlocked and not disabled when the vault is locked. This is a specific design decision for the `VaultOptionsController.java` within the context of PR 3267.
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3780
File: src/main/java/org/cryptomator/ui/eventview/EventListCellController.java:113-128
Timestamp: 2025-03-21T15:58:30.027Z
Learning: In Cryptomator's event system, entries are removed directly from the model (FileSystemEventAggregator) and then automatically synced to the view (FxFSEventList) with a potential delay of up to one second. This follows a model-view pattern where verification of removal is handled by the synchronization mechanism rather than explicit logging.
📚 Learning: 2025-03-21T15:58:30.027Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3780
File: src/main/java/org/cryptomator/ui/eventview/EventListCellController.java:113-128
Timestamp: 2025-03-21T15:58:30.027Z
Learning: In Cryptomator's event system, entries are removed directly from the model (FileSystemEventAggregator) and then automatically synced to the view (FxFSEventList) with a potential delay of up to one second. This follows a model-view pattern where verification of removal is handled by the synchronization mechanism rather than explicit logging.
Applied to files:
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java
📚 Learning: 2024-11-21T16:57:58.292Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3618
File: src/main/java/org/cryptomator/ui/fxapp/FxApplicationWindows.java:151-165
Timestamp: 2024-11-21T16:57:58.292Z
Learning: In the file `src/main/java/org/cryptomator/ui/fxapp/FxApplicationWindows.java`, when reviewing the method `showDokanySupportEndWindow`, suggestions to add error handling to asynchronous dialog creation (e.g., `CompletableFuture`) may be considered out of scope for certain pull requests.
Applied to files:
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java
📚 Learning: 2024-11-19T23:01:51.307Z
Learnt from: gepbird
Repo: cryptomator/cryptomator PR: 3621
File: src/main/java/org/cryptomator/ui/keyloading/hub/HubConfig.java:55-58
Timestamp: 2024-11-19T23:01:51.307Z
Learning: In the Cryptomator project, updating `LegacyRegisterDeviceController` is not necessary when changing URI construction methods.
Applied to files:
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java
📚 Learning: 2025-10-20T20:55:38.432Z
Learnt from: oyvinrog
Repo: cryptomator/cryptomator PR: 4018
File: src/main/resources/i18n/strings_sk.properties:486-494
Timestamp: 2025-10-20T20:55:38.432Z
Learning: In Cryptomator, new i18n keys are intentionally added to all locale files (strings_*.properties) with English placeholder values first. Actual translations are provided later through separate Crowdin commits. This prevents runtime errors and is the project's standard translation workflow. Do not flag English values in non-English locale files as translation issues.
Applied to files:
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java
📚 Learning: 2025-12-18T14:24:57.436Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 4078
File: src/main/java/org/cryptomator/common/Constants.java:16-16
Timestamp: 2025-12-18T14:24:57.436Z
Learning: In the Cryptomator Hub integration, HUB_USER_DEVICE_SEPARATOR must be a character not present in usernames or device names to safely concatenate userName + '&' + deviceName and later split it without extra escaping. This pattern should be enforced consistently across Java sources that use HUB_USER_DEVICE_SEPARATOR (not just Constants.java). Add a short code comment documenting the constraint, and include unit tests that verify both correct concatenation and correct parsing when the separator is present. If the separator ever changes, re-evaluate all concatenation/splitting logic and encoding assumptions.
Applied to files:
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java
📚 Learning: 2025-12-18T14:25:24.513Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 4078
File: src/main/java/org/cryptomator/ui/keyloading/hub/ReceiveKeyController.java:188-188
Timestamp: 2025-12-18T14:25:24.513Z
Learning: In the Cryptomator Hub integration, usernames and device names are validated to prevent the "&" character from appearing in them. This ensures that the HUB_USER_DEVICE_SEPARATOR ("&") can safely be used to concatenate and split username and device name without parsing ambiguity in ReceiveKeyController.java and NotificationController.java.
Applied to files:
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java
📚 Learning: 2024-07-27T13:14:40.963Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3267
File: src/main/java/org/cryptomator/ui/vaultoptions/VaultOptionsController.java:54-56
Timestamp: 2024-07-27T13:14:40.963Z
Learning: The user `infeo` has clarified that in the Cryptomator project, it is intentional for the vault options to be disabled when the vault is unlocked and not disabled when the vault is locked. This is a specific design decision for the `VaultOptionsController.java` within the context of PR 3267.
Applied to files:
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java
📚 Learning: 2024-11-24T16:47:01.698Z
Learnt from: purejava
Repo: cryptomator/cryptomator PR: 3311
File: src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.java:0-0
Timestamp: 2024-11-24T16:47:01.698Z
Learning: In Cryptomator, avoid adding unnecessary complexity to error handling in UI controllers unless it's critical.
Applied to files:
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java
📚 Learning: 2024-12-11T13:52:43.966Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3618
File: src/main/java/org/cryptomator/ui/dialogs/SimpleDialogController.java:55-67
Timestamp: 2024-12-11T13:52:43.966Z
Learning: In the `SimpleDialogController` class of the Cryptomator application, the actions passed to the `handleOk()` and `handleCancel()` methods are responsible for their own error handling. Therefore, wrapping these actions with try-catch blocks in the controller is unnecessary.
Applied to files:
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java
📚 Learning: 2024-11-21T16:31:37.834Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3618
File: src/main/java/org/cryptomator/ui/mainwindow/VaultListContextMenuController.java:85-97
Timestamp: 2024-11-21T16:31:37.834Z
Learning: In `VaultListContextMenuController.didClickRemoveVault`, adding error handling and additional safety measures around vault removal is considered out of scope for this PR.
Applied to files:
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java
📚 Learning: 2025-01-09T12:33:23.183Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3675
File: src/main/java/org/cryptomator/common/integrations/IntegrationsLoaderCopy.java:65-73
Timestamp: 2025-01-09T12:33:23.183Z
Learning: The `IntegrationsLoaderCopy` class in `org.cryptomator.common.integrations` package is a temporary solution for module visibility problems and will be removed soon. No improvements or refactoring should be suggested for this class.
Applied to files:
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java
📚 Learning: 2024-12-11T13:52:42.201Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3618
File: src/main/java/org/cryptomator/ui/dialogs/SimpleDialogController.java:27-45
Timestamp: 2024-12-11T13:52:42.201Z
Learning: In the Cryptomator project, parameter validation is performed in the `SimpleDialog` builder, so it's unnecessary to duplicate validation in controller classes like `SimpleDialogController`.
Applied to files:
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java
📚 Learning: 2024-12-11T08:28:24.864Z
Learnt from: overheadhunter
Repo: cryptomator/cryptomator PR: 3641
File: .github/workflows/win-exe.yml:20-21
Timestamp: 2024-12-11T08:28:24.864Z
Learning: In the Cryptomator project, it's acceptable to update the JDK version (e.g., to JDK 23) while keeping the JavaFX version at an older version (e.g., JavaFX 22.0.2), as this has not caused problems in the past.
Applied to files:
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java
📚 Learning: 2025-01-09T12:32:51.042Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3675
File: src/main/java/org/cryptomator/launcher/Cryptomator.java:124-131
Timestamp: 2025-01-09T12:32:51.042Z
Learning: In Cryptomator's SSL context configuration, fallback mechanism is not necessary since we're only changing the default SSLContext. If loading fails, the former default SSLContext remains usable.
Applied to files:
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java
📚 Learning: 2025-01-24T13:49:09.640Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3699
File: src/main/java/org/cryptomator/ui/convertvault/HubToPasswordConvertController.java:112-112
Timestamp: 2025-01-24T13:49:09.640Z
Learning: In the HubToPasswordConvertController, the convertInternal() method is specifically for vault conversion operations, while UI-related property updates (like setting keyLoader) should be handled in the UI completion handlers, maintaining a clear separation between vault operations and UI state management.
Applied to files:
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Analyze (java-kotlin)
- GitHub Check: Compile and Test
🔇 Additional comments (6)
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java (6)
3-5: LGTM! Imports are appropriate for the new functionality.The new imports support FileIsInUseEvent handling (line 130-152), OS-specific path conversion (line 273), and user/device separator parsing (line 147).
121-123: Good refactoring for i18n consistency.Replacing the direct action creation with
addLocalizedActionaligns with the broader localization improvements in this file.
213-223: Well-structured helper methods for action creation.The separation between
addLocalizedAction(i18n lookup) andaddAction(UI creation) is clean and maintainable. The pattern is used consistently throughout the file.
160-210: Excellent i18n refactoring across all event handlers.All event adjustment methods now use
addLocalizedActionconsistently, ensuring proper internationalization support throughout the event view UI.
266-277: Improved path conversion using Path API.The refactored implementation correctly uses
Path.of(mountPoint, ...)instead of string concatenation, and handles Windows-specific URI path conversion. The assumptions about absolute vault paths are documented in the inline comments.
130-130: LGTM! FileIsInUseEvent routing added correctly.The new case properly routes FileIsInUseEvent to the dedicated handler method, consistent with the existing event handling pattern.
Signed-off-by: Armin Schrenk <[email protected]>
* add scrollbar to description content * move filename to own visual element * move vaultName above message Signed-off-by: Armin Schrenk <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/main/resources/fxml/notification.fxml (1)
15-22: Consider making dimensions more flexible.The notification window has fixed
prefHeight="200.0" prefWidth="400.0" maxHeight="200.0" maxWidth="400.0". This could truncate long filenames or descriptions, though theScrollPanehelps. If this is intentional for a consistent notification appearance, it's acceptable.src/main/java/org/cryptomator/ui/notification/NotificationController.java (1)
76-86: Consider defensive bounds check in selection listener.Line 80 assumes
n.intValue()is a valid index when the list is non-empty. IfselectionIndexbecomes stale after rapid list mutations, this could throwIndexOutOfBoundsException. Given thatselectionIndexis internally managed andremoveSelectedEventhandles bounds, this is likely safe, but a defensive check would be more robust.🔎 Optional defensive check
selectionIndex.addListener((_, _, n) -> { - if (!events.isEmpty()) { + int idx = n.intValue(); + if (idx >= 0 && idx < events.size()) { selectedEvent.setValue(events.get(n.intValue())); } });
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/main/java/org/cryptomator/event/NotificationManager.java(1 hunks)src/main/java/org/cryptomator/ui/fxapp/FxNotificationManager.java(1 hunks)src/main/java/org/cryptomator/ui/notification/NotificationController.java(1 hunks)src/main/resources/fxml/notification.fxml(1 hunks)
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3267
File: src/main/java/org/cryptomator/ui/vaultoptions/VaultOptionsController.java:54-56
Timestamp: 2024-07-27T13:14:40.963Z
Learning: The user `infeo` has clarified that in the Cryptomator project, it is intentional for the vault options to be disabled when the vault is unlocked and not disabled when the vault is locked. This is a specific design decision for the `VaultOptionsController.java` within the context of PR 3267.
📚 Learning: 2025-03-21T15:58:30.027Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3780
File: src/main/java/org/cryptomator/ui/eventview/EventListCellController.java:113-128
Timestamp: 2025-03-21T15:58:30.027Z
Learning: In Cryptomator's event system, entries are removed directly from the model (FileSystemEventAggregator) and then automatically synced to the view (FxFSEventList) with a potential delay of up to one second. This follows a model-view pattern where verification of removal is handled by the synchronization mechanism rather than explicit logging.
Applied to files:
src/main/java/org/cryptomator/event/NotificationManager.java
📚 Learning: 2025-12-18T14:24:57.436Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 4078
File: src/main/java/org/cryptomator/common/Constants.java:16-16
Timestamp: 2025-12-18T14:24:57.436Z
Learning: In the Cryptomator Hub integration, HUB_USER_DEVICE_SEPARATOR must be a character not present in usernames or device names to safely concatenate userName + '&' + deviceName and later split it without extra escaping. This pattern should be enforced consistently across Java sources that use HUB_USER_DEVICE_SEPARATOR (not just Constants.java). Add a short code comment documenting the constraint, and include unit tests that verify both correct concatenation and correct parsing when the separator is present. If the separator ever changes, re-evaluate all concatenation/splitting logic and encoding assumptions.
Applied to files:
src/main/java/org/cryptomator/event/NotificationManager.javasrc/main/java/org/cryptomator/ui/notification/NotificationController.javasrc/main/java/org/cryptomator/ui/fxapp/FxNotificationManager.java
📚 Learning: 2024-11-21T16:57:58.292Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3618
File: src/main/java/org/cryptomator/ui/fxapp/FxApplicationWindows.java:151-165
Timestamp: 2024-11-21T16:57:58.292Z
Learning: In the file `src/main/java/org/cryptomator/ui/fxapp/FxApplicationWindows.java`, when reviewing the method `showDokanySupportEndWindow`, suggestions to add error handling to asynchronous dialog creation (e.g., `CompletableFuture`) may be considered out of scope for certain pull requests.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.javasrc/main/resources/fxml/notification.fxmlsrc/main/java/org/cryptomator/ui/fxapp/FxNotificationManager.java
📚 Learning: 2024-11-24T16:41:49.825Z
Learnt from: purejava
Repo: cryptomator/cryptomator PR: 3311
File: src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.java:52-56
Timestamp: 2024-11-24T16:41:49.825Z
Learning: In the Cryptomator project, null checks for JavaFX FXML injected components in the `initialize` method (e.g., in `MasterkeyOptionsController.java`) are unnecessary, as null values would indicate a severe issue with the JavaFX framework.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.javasrc/main/resources/fxml/notification.fxml
📚 Learning: 2024-12-11T13:52:43.966Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3618
File: src/main/java/org/cryptomator/ui/dialogs/SimpleDialogController.java:55-67
Timestamp: 2024-12-11T13:52:43.966Z
Learning: In the `SimpleDialogController` class of the Cryptomator application, the actions passed to the `handleOk()` and `handleCancel()` methods are responsible for their own error handling. Therefore, wrapping these actions with try-catch blocks in the controller is unnecessary.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2024-11-21T16:31:37.834Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3618
File: src/main/java/org/cryptomator/ui/mainwindow/VaultListContextMenuController.java:85-97
Timestamp: 2024-11-21T16:31:37.834Z
Learning: In `VaultListContextMenuController.didClickRemoveVault`, adding error handling and additional safety measures around vault removal is considered out of scope for this PR.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2024-07-27T13:14:40.963Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3267
File: src/main/java/org/cryptomator/ui/vaultoptions/VaultOptionsController.java:54-56
Timestamp: 2024-07-27T13:14:40.963Z
Learning: The user `infeo` has clarified that in the Cryptomator project, it is intentional for the vault options to be disabled when the vault is unlocked and not disabled when the vault is locked. This is a specific design decision for the `VaultOptionsController.java` within the context of PR 3267.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2024-11-24T16:47:01.698Z
Learnt from: purejava
Repo: cryptomator/cryptomator PR: 3311
File: src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.java:0-0
Timestamp: 2024-11-24T16:47:01.698Z
Learning: In Cryptomator, avoid adding unnecessary complexity to error handling in UI controllers unless it's critical.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2024-12-11T13:52:42.201Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3618
File: src/main/java/org/cryptomator/ui/dialogs/SimpleDialogController.java:27-45
Timestamp: 2024-12-11T13:52:42.201Z
Learning: In the Cryptomator project, parameter validation is performed in the `SimpleDialog` builder, so it's unnecessary to duplicate validation in controller classes like `SimpleDialogController`.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2025-10-20T20:55:38.432Z
Learnt from: oyvinrog
Repo: cryptomator/cryptomator PR: 4018
File: src/main/resources/i18n/strings_sk.properties:486-494
Timestamp: 2025-10-20T20:55:38.432Z
Learning: In Cryptomator, new i18n keys are intentionally added to all locale files (strings_*.properties) with English placeholder values first. Actual translations are provided later through separate Crowdin commits. This prevents runtime errors and is the project's standard translation workflow. Do not flag English values in non-English locale files as translation issues.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2024-11-19T23:01:51.307Z
Learnt from: gepbird
Repo: cryptomator/cryptomator PR: 3621
File: src/main/java/org/cryptomator/ui/keyloading/hub/HubConfig.java:55-58
Timestamp: 2024-11-19T23:01:51.307Z
Learning: In the Cryptomator project, updating `LegacyRegisterDeviceController` is not necessary when changing URI construction methods.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Analyze (java-kotlin)
- GitHub Check: Compile and Test
🔇 Additional comments (11)
src/main/java/org/cryptomator/event/NotificationManager.java (3)
1-41: LGTM!The singleton notification manager with Caffeine-based debouncing is well-structured. The 5-second debounce threshold and thread-safe queue initialization are appropriate for the use case.
57-68: Consider simplifying the synchronization pattern.The current approach uses
synchronized(this)inside thecomputeIfAbsentlambda. While correct, this could be simplified sinceappendToAndClearalso synchronizes onthis. TheConcurrentLinkedQueueis already thread-safe for individual operations, but the synchronization ensures atomicity across the debounce check and queue addition.This works correctly for the expected low-frequency event flow.
70-84: LGTM!The synchronized drain-and-clear pattern is correctly implemented, ensuring thread safety between polling (UI thread) and event addition (background threads).
src/main/resources/fxml/notification.fxml (2)
23-52: LGTM!The header layout with conditional navigation controls and accessibility attributes is well-implemented.
54-74: LGTM!The center content area with proper visibility bindings and scroll handling for the description is well-structured.
src/main/java/org/cryptomator/ui/notification/NotificationController.java (5)
56-74: LGTM!The constructor properly initializes all properties with locale-aware formatting and bindings. The use of
Settings.languagefor localization is appropriate.
88-121: Hardcoded strings noted for post-beta i18n.The TODO comment (lines 109-113) correctly documents that translations should be activated once the feature is out of beta. The fallback approach is reasonable for a beta feature.
139-156: LGTM!The bounds checking and post-removal index adjustment logic are correctly implemented, addressing previous review concerns.
158-178: LGTM!Navigation methods correctly handle bounds, and
close()properly clears events before closing the window.
180-245: LGTM!The property getters follow JavaFX conventions, and the null-safe handling in
getActionText()is appropriate.src/main/java/org/cryptomator/ui/fxapp/FxNotificationManager.java (1)
1-57: LGTM!The polling mechanism correctly marshals UI updates to the JavaFX Application Thread via
Platform.runLater(), and the integration withNotificationManagerandFxApplicationWindowsis well-structured.
Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
Signed-off-by: Armin Schrenk <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/main/java/org/cryptomator/ui/notification/NotificationController.java (1)
102-102: Consider defensive validation for edge-case paths.Line 102 extracts the filename using
substring(lastIndexOf('/') + 1). IfcleartextPath()is"/"or ends with"/", this produces an empty string. WhileFileIsInUseEventlikely provides valid paths, adding a defensive check (or assertion) would make the precondition explicit and prevent potential display issues.🔎 Optional defensive validation
case FileIsInUseEvent fiiue -> { var userAndDevice = fiiue.owner().split(Constants.HUB_USER_DEVICE_SEPARATOR); var user = userAndDevice[0]; var device = userAndDevice.length == 1 ? userAndDevice[0] : userAndDevice[1]; var cleartextFileName = fiiue.cleartextPath().substring(fiiue.cleartextPath().lastIndexOf('/') + 1); + if (cleartextFileName.isEmpty()) { + LOG.warn("Received empty filename from path: {}", fiiue.cleartextPath()); + cleartextFileName = "unknown"; + } eventTimestamp.set(localizedTimeFormatter.format(fiiue.lastUpdated()));
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/java/org/cryptomator/ui/notification/NotificationController.java(1 hunks)
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3267
File: src/main/java/org/cryptomator/ui/vaultoptions/VaultOptionsController.java:54-56
Timestamp: 2024-07-27T13:14:40.963Z
Learning: The user `infeo` has clarified that in the Cryptomator project, it is intentional for the vault options to be disabled when the vault is unlocked and not disabled when the vault is locked. This is a specific design decision for the `VaultOptionsController.java` within the context of PR 3267.
📚 Learning: 2025-12-21T10:47:54.553Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 4078
File: src/main/java/org/cryptomator/ui/notification/NotificationController.java:123-137
Timestamp: 2025-12-21T10:47:54.553Z
Learning: In the Cryptomator notification UI (NotificationController.java), the processSelectedEvent() method does not require a null check for selectedEvent.get() because it is called from UI actions (FXML-bound) that are only accessible when an event is selected, providing an architectural guarantee that selectedEvent is never null when the method is invoked.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2024-11-21T16:57:58.292Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3618
File: src/main/java/org/cryptomator/ui/fxapp/FxApplicationWindows.java:151-165
Timestamp: 2024-11-21T16:57:58.292Z
Learning: In the file `src/main/java/org/cryptomator/ui/fxapp/FxApplicationWindows.java`, when reviewing the method `showDokanySupportEndWindow`, suggestions to add error handling to asynchronous dialog creation (e.g., `CompletableFuture`) may be considered out of scope for certain pull requests.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2024-11-24T16:41:49.825Z
Learnt from: purejava
Repo: cryptomator/cryptomator PR: 3311
File: src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.java:52-56
Timestamp: 2024-11-24T16:41:49.825Z
Learning: In the Cryptomator project, null checks for JavaFX FXML injected components in the `initialize` method (e.g., in `MasterkeyOptionsController.java`) are unnecessary, as null values would indicate a severe issue with the JavaFX framework.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2024-12-11T13:52:43.966Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3618
File: src/main/java/org/cryptomator/ui/dialogs/SimpleDialogController.java:55-67
Timestamp: 2024-12-11T13:52:43.966Z
Learning: In the `SimpleDialogController` class of the Cryptomator application, the actions passed to the `handleOk()` and `handleCancel()` methods are responsible for their own error handling. Therefore, wrapping these actions with try-catch blocks in the controller is unnecessary.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2024-11-21T16:31:37.834Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3618
File: src/main/java/org/cryptomator/ui/mainwindow/VaultListContextMenuController.java:85-97
Timestamp: 2024-11-21T16:31:37.834Z
Learning: In `VaultListContextMenuController.didClickRemoveVault`, adding error handling and additional safety measures around vault removal is considered out of scope for this PR.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2024-07-27T13:14:40.963Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3267
File: src/main/java/org/cryptomator/ui/vaultoptions/VaultOptionsController.java:54-56
Timestamp: 2024-07-27T13:14:40.963Z
Learning: The user `infeo` has clarified that in the Cryptomator project, it is intentional for the vault options to be disabled when the vault is unlocked and not disabled when the vault is locked. This is a specific design decision for the `VaultOptionsController.java` within the context of PR 3267.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2024-11-24T16:47:01.698Z
Learnt from: purejava
Repo: cryptomator/cryptomator PR: 3311
File: src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.java:0-0
Timestamp: 2024-11-24T16:47:01.698Z
Learning: In Cryptomator, avoid adding unnecessary complexity to error handling in UI controllers unless it's critical.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2024-12-11T13:52:42.201Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3618
File: src/main/java/org/cryptomator/ui/dialogs/SimpleDialogController.java:27-45
Timestamp: 2024-12-11T13:52:42.201Z
Learning: In the Cryptomator project, parameter validation is performed in the `SimpleDialog` builder, so it's unnecessary to duplicate validation in controller classes like `SimpleDialogController`.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2025-10-20T20:55:38.432Z
Learnt from: oyvinrog
Repo: cryptomator/cryptomator PR: 4018
File: src/main/resources/i18n/strings_sk.properties:486-494
Timestamp: 2025-10-20T20:55:38.432Z
Learning: In Cryptomator, new i18n keys are intentionally added to all locale files (strings_*.properties) with English placeholder values first. Actual translations are provided later through separate Crowdin commits. This prevents runtime errors and is the project's standard translation workflow. Do not flag English values in non-English locale files as translation issues.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2024-11-19T23:01:51.307Z
Learnt from: gepbird
Repo: cryptomator/cryptomator PR: 3621
File: src/main/java/org/cryptomator/ui/keyloading/hub/HubConfig.java:55-58
Timestamp: 2024-11-19T23:01:51.307Z
Learning: In the Cryptomator project, updating `LegacyRegisterDeviceController` is not necessary when changing URI construction methods.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
📚 Learning: 2025-12-18T14:24:57.436Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 4078
File: src/main/java/org/cryptomator/common/Constants.java:16-16
Timestamp: 2025-12-18T14:24:57.436Z
Learning: In the Cryptomator Hub integration, HUB_USER_DEVICE_SEPARATOR must be a character not present in usernames or device names to safely concatenate userName + '&' + deviceName and later split it without extra escaping. This pattern should be enforced consistently across Java sources that use HUB_USER_DEVICE_SEPARATOR (not just Constants.java). Add a short code comment documenting the constraint, and include unit tests that verify both correct concatenation and correct parsing when the separator is present. If the separator ever changes, re-evaluate all concatenation/splitting logic and encoding assumptions.
Applied to files:
src/main/java/org/cryptomator/ui/notification/NotificationController.java
🧬 Code graph analysis (1)
src/main/java/org/cryptomator/ui/notification/NotificationController.java (1)
src/main/java/org/cryptomator/common/settings/Settings.java (1)
Settings(31-235)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Compile and Test
🔇 Additional comments (1)
src/main/java/org/cryptomator/ui/notification/NotificationController.java (1)
78-78: No action needed. The project is configured to use Java 23, which fully supports the underscore syntax in lambda parameters introduced in Java 22.Likely an incorrect or invalid review comment.
|
@coderabbitai Can you create a new issue to add translations to the notification controller before the final release? |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 8534 🏁 Script executed: Length of output: 54 @infeo, I've created issue #4088 to track enabling translations for the notification controller before the final release. The issue includes all the necessary tasks and references this PR and comment. 🧠 Learnings used |
This PR adds the files-in-use feature to the app.
It allows a shared Cryptomator Hub vault to block file access, if another user is already editing the same file. For more technical info see cryptomator/cryptofs#312.
Opening a file creates a so called in-use-file ending in ".c9u". This file contains the hub user and device, encrypted. Additionally, a lastUpdated timestamp is present. The timestamp gets regularly updated while the file is opened and the OS account is active (e.g. not in standby)
Once the in-use-file is synced to other devices, opening the same file with a different users will throw an error on the filesystem level. Additionally, a notification is shown to the user via the notification window. If the in-use-file contains a lastUpdated timestamp, which is older than 10min, the in-use-file is taken over by the current user and the file is regularly opened.
The notification window contains a button to ignore the lock/in-use-file. If the button is clicked, the user can open the "used" file anyway within the next 2minutes, taking the ownership of the file.
Screenshot of the notification:


Open questions: