Repository navigation
Implement new update API - #3948
Conversation
|
Caution Review failedThe pull request is closed. Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughThis PR overhauls the application's update subsystem and related wiring. It removes the SemVer comparator and its tests, relocates and reimplements update checking as a ScheduledService-based UpdateChecker with task/fallback behavior, adds UpdateService, FallbackUpdateMechanism, UpdateCheckerHttpClient, DelegatingHttpClient, and FallbackUpdateInfo, and removes the old UpdateCheckerModule and UpdateCheckerTask. Settings and SettingsProvider are refactored for DI-driven persistence and add lastUpdateAttemptedByVersion; Environment gains getAppVersionWithBuildNumber(). Preferences UI, FXML, and controllers are updated to use the new update flow and bindings. Several build/workflow files and module-info imports are adjusted. Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Areas requiring extra attention:
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Nitpick comments (5)
src/main/java/org/cryptomator/common/updates/UpdatesModule.java (1)
14-18: Consider adding null safety checkThe implementation looks good, but consider adding a null check in case
UpdateService.get()returns null to prevent potential NPE.@Provides @Singleton static List<UpdateService> provideSupportedUpdateServices() { - return UpdateService.get().toList(); + var services = UpdateService.get(); + return services != null ? services.toList() : List.of(); }src/main/java/org/cryptomator/common/updates/AppUpdateChecker.java (1)
22-36: Consider adjusting error logging strategyThe implementation is good, but logging an error for every non-flatpak build number might be too aggressive. Consider if other build numbers are valid but simply don't require update services.
default -> { - LOG.error("Unexpected value 'buildNumber': {}", buildNumber.get()); + LOG.debug("Build number '{}' does not support update services", buildNumber.get()); return false; }src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java (3)
113-113: Fix typo in log message-LOG.debug("Update progess is at percentage: {} and has status: {}", progress.getProgress(), progress.getStatus()); +LOG.debug("Update progress is at percentage: {} and has status: {}", progress.getProgress(), progress.getStatus());
150-153: Consider moving to utility classThis duration conversion method could be useful elsewhere. Consider moving it to a utility class for reuse.
160-186: Consider consolidating overloaded methodsHaving multiple overloaded versions of
checkStarted,checkSucceeded, andcheckFailedwith different signatures creates API confusion. Consider using a common interface or consolidating these methods.For example, you could create a common update result type that both update services can use, reducing the need for method overloading.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
pom.xml(1 hunks)src/main/java/module-info.java(1 hunks)src/main/java/org/cryptomator/common/CommonsModule.java(2 hunks)src/main/java/org/cryptomator/common/updates/AppUpdateChecker.java(1 hunks)src/main/java/org/cryptomator/common/updates/UpdatesModule.java(1 hunks)src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java(6 hunks)src/main/java/org/cryptomator/ui/mainwindow/MainWindowController.java(1 hunks)src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java(8 hunks)src/main/resources/fxml/preferences_updates.fxml(2 hunks)
🧰 Additional context used
🧠 Learnings (11)
📚 Learning: in the cryptomator project, it's acceptable to update the jdk version (e.g., to jdk 23) while keepin...
Learnt from: overheadhunter
PR: cryptomator/cryptomator#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/module-info.javapom.xmlsrc/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.javasrc/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java
📚 Learning: the `integrationsloadercopy` class in `org.cryptomator.common.integrations` package is a temporary s...
Learnt from: infeo
PR: cryptomator/cryptomator#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/module-info.javasrc/main/java/org/cryptomator/common/CommonsModule.javasrc/main/java/org/cryptomator/common/updates/UpdatesModule.javapom.xml
📚 Learning: in the cryptomator project, updating `legacyregisterdevicecontroller` is not necessary when changing...
Learnt from: gepbird
PR: cryptomator/cryptomator#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/module-info.javasrc/main/java/org/cryptomator/ui/mainwindow/MainWindowController.javasrc/main/java/org/cryptomator/common/CommonsModule.javapom.xml
📚 Learning: in the file `src/main/java/org/cryptomator/ui/fxapp/fxapplicationwindows.java`, when reviewing the m...
Learnt from: infeo
PR: cryptomator/cryptomator#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/mainwindow/MainWindowController.javasrc/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.javasrc/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java
📚 Learning: in the cryptomator project, null checks for javafx fxml injected components in the `initialize` meth...
Learnt from: purejava
PR: cryptomator/cryptomator#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/mainwindow/MainWindowController.javasrc/main/resources/fxml/preferences_updates.fxmlsrc/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.javasrc/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java
📚 Learning: in the cryptomator project, parameter validation is performed in the `simpledialog` builder, so it's...
Learnt from: infeo
PR: cryptomator/cryptomator#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/mainwindow/MainWindowController.java
📚 Learning: the constructor of the `settingsprovider` class in the cryptomator project is marked with the `@inje...
Learnt from: infeo
PR: cryptomator/cryptomator#3494
File: src/main/java/org/cryptomator/common/settings/SettingsProvider.java:50-50
Timestamp: 2024-07-17T10:12:26.832Z
Learning: The constructor of the `SettingsProvider` class in the Cryptomator project is marked with the `@Inject` annotation, indicating that it is managed by a dependency injection framework and not called directly in written code.
Applied to files:
src/main/java/org/cryptomator/common/CommonsModule.javapom.xmlsrc/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.javasrc/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java
📚 Learning: in the cryptomator project, the exact jdk version is fixed in release workflows (e.g., `.github/work...
Learnt from: infeo
PR: cryptomator/cryptomator#3641
File: .github/workflows/win-exe.yml:19-19
Timestamp: 2024-12-10T17:06:19.650Z
Learning: In the Cryptomator project, the exact JDK version is fixed in release workflows (e.g., `.github/workflows/win-exe.yml`, `.github/workflows/mac-dmg.yml`) to ensure reproducible builds.
Applied to files:
pom.xml
📚 Learning: in the cryptomator windows build workflow, the debug launcher (cryptomatordebug) should be included ...
Learnt from: infeo
PR: cryptomator/cryptomator#2666
File: .github/workflows/win-exe.yml:0-0
Timestamp: 2025-06-17T12:55:22.351Z
Learning: In the Cryptomator Windows build workflow, the debug launcher (CryptomatorDebug) should be included in every build as an additional, non-standard executable, not conditionally based on the isDebug input. This design provides users with debugging capabilities when needed without affecting the normal user experience.
Applied to files:
pom.xml
📚 Learning: in cryptomator, avoid adding unnecessary complexity to error handling in ui controllers unless it's ...
Learnt from: purejava
PR: cryptomator/cryptomator#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/preferences/UpdatesPreferencesController.java
📚 Learning: the `-fx-underline` property is a valid javafx css property for labeled controls, as documented in t...
Learnt from: overheadhunter
PR: cryptomator/cryptomator#3757
File: src/main/resources/css/light_theme.css:361-366
Timestamp: 2025-02-23T09:08:51.746Z
Learning: The `-fx-underline` property is a valid JavaFX CSS property for Labeled controls, as documented in the JavaFX CSS Reference Guide (https://openjfx.io/javadoc/21/javafx.graphics/javafx/scene/doc-files/cssref.html#labeled).
Applied to files:
src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java
🧬 Code Graph Analysis (2)
src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java (1)
src/main/java/org/cryptomator/common/updates/AppUpdateChecker.java (1)
AppUpdateChecker(12-77)
src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java (2)
src/main/java/org/cryptomator/common/updates/AppUpdateChecker.java (1)
AppUpdateChecker(12-77)src/main/java/org/cryptomator/ui/fxapp/UpdateCheckerTask.java (1)
UpdateCheckerTask(16-58)
🔇 Additional comments (11)
src/main/java/module-info.java (1)
53-53: LGTM! Module dependency correctly added.The addition of
org.purejava.portalmodule dependency is appropriate for the Flatpak portal API integration. The placement within the requires section follows proper module system conventions.src/main/java/org/cryptomator/common/CommonsModule.java (2)
14-14: LGTM! Import correctly added.The import for
UpdatesModuleis properly placed and necessary for the Dagger module integration.
34-34: LGTM! Module integration follows Dagger conventions.The inclusion of
UpdatesModulein the@Moduleannotation'sincludesparameter correctly integrates the update functionality into the dependency injection system, enabling update services throughout the application.src/main/java/org/cryptomator/ui/mainwindow/MainWindowController.java (1)
54-54: LGTM! Binding correctly combines update availability states.The modification to bind
updateAvailableto bothupdateAvailableProperty()andappUpdateAvailableProperty()using logical OR is correct. This ensures the UI will show update notifications for both general updates and app-specific updates (like Flatpak), which aligns perfectly with the PR objectives.src/main/resources/fxml/preferences_updates.fxml (2)
16-16: LGTM! Import correctly added.The
ProgressBarimport is properly added and necessary for the new Flatpak update UI component.
56-68: LGTM! Flatpak update UI properly implemented.The new button for Flatpak updates is well-structured with appropriate bindings:
- Button visibility correctly bound to
controller.appUpdateAvailable- Progress bar visibility and progress correctly bound to
controller.updatingFlatpakandcontroller.flatpakProgress- VBox layout with centered alignment is appropriate for the button content
- fx:id for
flatpakButtonLabelenables controller to set dynamic button textThe UI integration follows JavaFX best practices and aligns with the PR objectives for Flatpak autoupdate functionality.
pom.xml (1)
40-40: Verify SNAPSHOT version availability.The update to
1.7.0-SNAPSHOTfor the Linux integrations version aligns with the Flatpak functionality requirements. Please ensure this SNAPSHOT version is available and compatible.src/main/java/org/cryptomator/common/updates/UpdatesModule.java (1)
20-24: LGTM!Good use of Optional for handling potentially empty list of update services.
src/main/java/org/cryptomator/common/updates/AppUpdateChecker.java (1)
57-62: LGTM!Clean implementation using streams and annotation checking.
src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java (1)
105-108: Fix broken switch statementThe switch statement is missing break statements, causing it to always execute the default case and log an error.
switch (env.getBuildNumber().get()) { - case "flatpak-1" -> flatpakButtonLabel.setText(appUpdateChecker.getServiceForChannel(DistributionChannel.Value.LINUX_FLATPAK).getDisplayName()); - default -> LOG.error("Unexpected value 'buildNumber': {}", env.getBuildNumber().get()); + case "flatpak-1" -> { + var service = appUpdateChecker.getServiceForChannel(DistributionChannel.Value.LINUX_FLATPAK); + if (service != null) { + flatpakButtonLabel.setText(service.getDisplayName()); + } + } + default -> { + // Non-flatpak builds don't need special handling + } }⛔ Skipped due to learnings
Learnt from: infeo PR: cryptomator/cryptomator#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.src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java (1)
12-12: Confirm external UpdateCheckerTask importWe currently have two classes named
UpdateCheckerTask:
- Local implementation:
src/main/java/org/cryptomator/ui/fxapp/UpdateCheckerTask.java- External API:
Declared viarequires org.purejava.portal;in module-info.javaLines 11–12 of
src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java:import org.purejava.portal.rest.UpdateCheckerTask;Please verify that you intentionally want the external
org.purejava.portal.rest.UpdateCheckerTask.
- If you meant to use the local version, update or remove this import.
- Otherwise, consider renaming the local
UpdateCheckerTaskto avoid confusion.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (3)
src/main/java/org/cryptomator/common/updates/AppUpdateChecker.java (2)
39-56: Improve type safety and null handlingThis issue was previously identified and still needs addressing.
65-77: Eliminate code duplicationThis duplication was previously identified and still needs addressing.
src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java (1)
83-83: Fix unsafe castThis unsafe casting issue was previously identified and still needs addressing.
🧹 Nitpick comments (2)
src/main/java/org/cryptomator/common/updates/AppUpdateChecker.java (1)
48-48: Fix inconsistent error messageThe error message references "LINUX_FLATPAK" but this method uses display names, not distribution channels.
- LOG.error("Required service for channel LINUX_FLATPAK not available"); + LOG.error("Required service for display name '{}' not available", DISPLAY_NAME_FLATPAK);src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java (1)
96-128: Improve readability with status constantsThe progress status checks use magic numbers which reduce code readability and maintainability.
Consider defining constants for the status values:
+ private static final int STATUS_IN_PROGRESS = 0; + private static final int STATUS_NO_UPDATE = 1; + private static final int STATUS_COMPLETE = 2; + private static final int STATUS_FAILED = 3; + public void terminateFlatpakOnUpdateCompleted(Runnable onComplete, UpdatesPreferencesController controller) { var service = updateChecker.getServiceForChannel(DISPLAY_NAME_FLATPAK); service.addProgressListener(new ProgressListener() { @Override public void onProgress(Progress progress) { - if (progress.getStatus() == 1) { + if (progress.getStatus() == STATUS_NO_UPDATE) { LOG.info("No update to install"); return; } - if (progress.getStatus() == 3) { + if (progress.getStatus() == STATUS_FAILED) { LOG.info("Update failed"); return; } - if (progress.getStatus() == 0 || progress.getStatus() == 2) { + if (progress.getStatus() == STATUS_IN_PROGRESS || progress.getStatus() == STATUS_COMPLETE) { LOG.debug("Update progess is at percentage: {} and has status: {}", progress.getProgress(), progress.getStatus()); Platform.runLater(() -> controller.flatpakProgressProperty().set(progress.getProgress() / 100.0)); } - if (progress.getStatus() == 2 && progress.getProgress() == 100) { + if (progress.getStatus() == STATUS_COMPLETE && progress.getProgress() == 100) { LOG.debug("Update successfully finished, restarting App now"); service.removeProgressListener(this); if (onComplete != null) { Platform.runLater(onComplete); } service.spawnApp(); appTerminator.terminate(); } } }); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/main/java/org/cryptomator/common/updates/AppUpdateChecker.java(1 hunks)src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java(5 hunks)src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java(7 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: in the cryptomator project, it's acceptable to update the jdk version (e.g., to jdk 23) while keepin...
Learnt from: overheadhunter
PR: cryptomator/cryptomator#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/fxapp/UpdateChecker.java
📚 Learning: in the file `src/main/java/org/cryptomator/ui/fxapp/fxapplicationwindows.java`, when reviewing the m...
Learnt from: infeo
PR: cryptomator/cryptomator#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/fxapp/UpdateChecker.java
📚 Learning: in the cryptomator project, null checks for javafx fxml injected components in the `initialize` meth...
Learnt from: purejava
PR: cryptomator/cryptomator#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/fxapp/UpdateChecker.java
📚 Learning: the constructor of the `settingsprovider` class in the cryptomator project is marked with the `@inje...
Learnt from: infeo
PR: cryptomator/cryptomator#3494
File: src/main/java/org/cryptomator/common/settings/SettingsProvider.java:50-50
Timestamp: 2024-07-17T10:12:26.832Z
Learning: The constructor of the `SettingsProvider` class in the Cryptomator project is marked with the `@Inject` annotation, indicating that it is managed by a dependency injection framework and not called directly in written code.
Applied to files:
src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java
🔇 Additional comments (9)
src/main/java/org/cryptomator/common/updates/AppUpdateChecker.java (2)
12-21: LGTM!The constructor and field declarations follow good practices with proper dependency injection and immutable fields.
23-37: LGTM!The method properly validates the Optional parameter and handles the expected build number case with appropriate error logging for unexpected values.
src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java (7)
6-11: LGTM!The new imports are appropriate for the Flatpak update integration.
37-37: LGTM!The display name constant maintains consistency with the AppUpdateChecker implementation.
42-68: LGTM!The new fields and constructor changes properly integrate the AppUpdateChecker service with appropriate dependency injection and property bindings.
91-94: LGTM!The updateAppNow method correctly delegates to the update service.
140-153: LGTM!The Flatpak update checker method and duration conversion utility follow appropriate patterns and handle the service lifecycle correctly.
160-187: LGTM!The method overloads properly handle the new AppUpdateChecker flow while maintaining separation from the legacy update checking approach.
204-236: LGTM!The new property accessors and refactored update availability methods provide good abstraction and maintain consistency with JavaFX patterns.
# Conflicts: # src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java # src/main/resources/fxml/preferences_updates.fxml
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java (1)
54-57: DuplicateEnvironmentfield still present
🧹 Nitpick comments (5)
src/main/java/org/cryptomator/updater/DownloadUpdateMechanism.java (1)
24-35: Hard-coded URL & fragile asset filterThe URL and the
endsWith("arm64.dmg")check are Flatpak/mac-specific and will break for other platforms or if GitHub throttles unauthenticated calls. Consider:
- Injecting the release source URI via config.
- Adding a
User-Agentheader to avoid 403.- Comparing
tag_nameagainstenvironment.getAppVersion()to ensure an actual update..idea/compiler.xml (1)
17-66: Duplicate entries bloat processor pathThe same jars (e.g., dagger-compiler 2.56.2) are listed twice, increasing indexing time. Clean up the duplicates to keep the project config minimal.
src/main/java/org/cryptomator/updater/MacOsDmgUpdateMechanism.java (1)
50-67: No signature/checksum verification after extractionAfter download you verify the file checksum, but the extracted
.appisn’t code-signed/verified. Consider runningspctl --assessor similar before replacing the installation to avoid tampering.src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java (2)
143-149: RedundantPlatform.exit()
Platform.exit()is called inside theifblock and again unconditionally afterwards, causing a double shutdown request.- } else { - LOG.error(...); - } - Platform.exit(); // second call + } else { + LOG.error(...); + }Remove the second call or restructure the logic.
247-254: Titles not localized
"Preparing Update...","Restart to Update","failed"are hard-coded English strings. Move them to the resource bundle like the rest of the UI texts.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
.idea/compiler.xml(2 hunks).idea/inspectionProfiles/Project_Default.xml(1 hunks)src/main/java/module-info.java(3 hunks)src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java(2 hunks)src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java(8 hunks)src/main/java/org/cryptomator/updater/DownloadUpdateMechanism.java(1 hunks)src/main/java/org/cryptomator/updater/MacOsDmgUpdateMechanism.java(1 hunks)src/main/resources/fxml/preferences_updates.fxml(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- .idea/inspectionProfiles/Project_Default.xml
🚧 Files skipped from review as they are similar to previous changes (3)
- src/main/resources/fxml/preferences_updates.fxml
- src/main/java/module-info.java
- src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
Learnt from: overheadhunter
PR: cryptomator/cryptomator#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.
Learnt from: gepbird
PR: cryptomator/cryptomator#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.
Learnt from: infeo
PR: cryptomator/cryptomator#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.
Learnt from: infeo
PR: cryptomator/cryptomator#3641
File: .github/workflows/win-exe.yml:19-19
Timestamp: 2024-12-10T17:06:19.650Z
Learning: In the Cryptomator project, the exact JDK version is fixed in release workflows (e.g., `.github/workflows/win-exe.yml`, `.github/workflows/mac-dmg.yml`) to ensure reproducible builds.
Learnt from: infeo
PR: cryptomator/cryptomator#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.
Learnt from: infeo
PR: cryptomator/cryptomator#2666
File: .github/workflows/win-exe.yml:0-0
Timestamp: 2025-06-17T12:55:22.351Z
Learning: In the Cryptomator Windows build workflow, the debug launcher (CryptomatorDebug) should be included in every build as an additional, non-standard executable, not conditionally based on the isDebug input. This design provides users with debugging capabilities when needed without affecting the normal user experience.
📚 Learning: 2024-12-10T17:06:19.650Z
Learnt from: infeo
PR: cryptomator/cryptomator#3641
File: .github/workflows/win-exe.yml:19-19
Timestamp: 2024-12-10T17:06:19.650Z
Learning: In the Cryptomator project, the exact JDK version is fixed in release workflows (e.g., `.github/workflows/win-exe.yml`, `.github/workflows/mac-dmg.yml`) to ensure reproducible builds.
Applied to files:
.idea/compiler.xml
📚 Learning: 2024-12-11T08:28:24.864Z
Learnt from: overheadhunter
PR: cryptomator/cryptomator#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:
.idea/compiler.xmlsrc/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java
📚 Learning: 2025-01-09T12:33:23.183Z
Learnt from: infeo
PR: cryptomator/cryptomator#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/updater/MacOsDmgUpdateMechanism.java
📚 Learning: 2024-11-21T16:57:58.292Z
Learnt from: infeo
PR: cryptomator/cryptomator#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/preferences/UpdatesPreferencesController.java
📚 Learning: 2024-12-11T13:52:43.966Z
Learnt from: infeo
PR: cryptomator/cryptomator#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/preferences/UpdatesPreferencesController.java
📚 Learning: 2024-11-24T16:47:01.698Z
Learnt from: purejava
PR: cryptomator/cryptomator#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/preferences/UpdatesPreferencesController.java
📚 Learning: 2024-11-24T16:41:49.825Z
Learnt from: purejava
PR: cryptomator/cryptomator#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/preferences/UpdatesPreferencesController.java
📚 Learning: 2024-07-17T10:12:26.832Z
Learnt from: infeo
PR: cryptomator/cryptomator#3494
File: src/main/java/org/cryptomator/common/settings/SettingsProvider.java:50-50
Timestamp: 2024-07-17T10:12:26.832Z
Learning: The constructor of the `SettingsProvider` class in the Cryptomator project is marked with the `Inject` annotation, indicating that it is managed by a dependency injection framework and not called directly in written code.
Applied to files:
src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java
🔇 Additional comments (1)
src/main/java/org/cryptomator/updater/MacOsDmgUpdateMechanism.java (1)
90-97: installPath needs quotingIf
installPathcontains spaces,cp -R …andopen -a …will fail. Wrap it in single quotes inside the script or use$'...'quoting.⛔ Skipped due to learnings
Learnt from: infeo PR: cryptomator/cryptomator#2666 File: .github/workflows/win-exe.yml:0-0 Timestamp: 2025-06-17T12:55:22.351Z Learning: In the Cryptomator Windows build workflow, the debug launcher (CryptomatorDebug) should be included in every build as an additional, non-standard executable, not conditionally based on the isDebug input. This design provides users with debugging capabilities when needed without affecting the normal user experience.Learnt from: infeo PR: cryptomator/cryptomator#3780 File: src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java:27-37 Timestamp: 2025-03-21T15:33:41.461Z Learning: In the Cryptomator application, tasks scheduled with an injected ScheduledExecutorService don't require explicit cancellation in a separate shutdown method, as they will be automatically canceled when the executorService shuts down.Learnt from: infeo PR: cryptomator/cryptomator#3641 File: .github/workflows/win-exe.yml:19-19 Timestamp: 2024-12-10T17:06:19.650Z Learning: In the Cryptomator project, the exact JDK version is fixed in release workflows (e.g., `.github/workflows/win-exe.yml`, `.github/workflows/mac-dmg.yml`) to ensure reproducible builds.
# Conflicts: # .github/workflows/debian.yml # .github/workflows/dependency-check.yml # .github/workflows/win-exe.yml # .idea/misc.xml # dist/linux/debian/control
# Conflicts: # .idea/compiler.xml # pom.xml
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
dist/linux/debian/controlis excluded by!**/dist/**dist/linux/debian/rulesis excluded by!**/dist/**
📒 Files selected for processing (14)
.github/workflows/appimage.yml(1 hunks).github/workflows/build.yml(1 hunks).github/workflows/check-jdk-updates.yml(1 hunks).github/workflows/debian.yml(2 hunks).github/workflows/dependency-check.yml(1 hunks).github/workflows/get-version.yml(1 hunks).github/workflows/mac-dmg-x64.yml(1 hunks).github/workflows/mac-dmg.yml(1 hunks).github/workflows/pullrequest.yml(1 hunks).github/workflows/release-check.yml(1 hunks).github/workflows/win-exe.yml(1 hunks).idea/compiler.xml(2 hunks).idea/misc.xml(1 hunks)pom.xml(2 hunks)
✅ Files skipped from review due to trivial changes (2)
- .github/workflows/release-check.yml
- .github/workflows/get-version.yml
🚧 Files skipped from review as they are similar to previous changes (1)
- pom.xml
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-12-10T17:06:19.650Z
Learnt from: infeo
PR: cryptomator/cryptomator#3641
File: .github/workflows/win-exe.yml:19-19
Timestamp: 2024-12-10T17:06:19.650Z
Learning: In the Cryptomator project, the exact JDK version is fixed in release workflows (e.g., `.github/workflows/win-exe.yml`, `.github/workflows/mac-dmg.yml`) to ensure reproducible builds.
Applied to files:
.github/workflows/check-jdk-updates.yml
🔇 Additional comments (11)
.github/workflows/pullrequest.yml (1)
8-8: Java version upgrade to 25 looks good.Consistent with project-wide Java 25 adoption. Java 25 reached General Availability on 16 September 2025, making this update timely and appropriate.
.github/workflows/build.yml (1)
14-14: Java version upgrade to 25 is consistent across workflows.Part of the coordinated Java 25 upgrade evident across all CI pipelines.
.github/workflows/mac-dmg.yml (1)
25-25: Java version upgrade with coordinated OpenJFX v25 updates.The version bump is consistent with OpenJFX version updates in the same file (line 45). Java 25 is GA as of September 16, 2025, and Oracle provides long-term support for Java 25 for at least eight years.
.github/workflows/mac-dmg-x64.yml (1)
27-27: Java version upgrade maintains parity with mac-dmg.yml.Correctly updated in parallel workflow variant with corresponding OpenJFX v25 updates (lines 47–48).
.idea/misc.xml (1)
11-11: IDE language level updated to match Java 25 project target.Ensures consistent code inspection and compilation warnings in IntelliJ IDEA.
.github/workflows/check-jdk-updates.yml (1)
9-9: Java version baseline updated for monthly update checks.Aligns the monitoring baseline with the project's Java 25 target. Workflow will now check for patch/build updates beyond 25.0.0.
.github/workflows/appimage.yml (1)
22-22: Java version upgrade with consistent OpenJFX v25 updates.Lines 40 and 44 show coordinated OpenJFX v25 updates for both architectures, confirming the upgrade was thoroughly planned.
.github/workflows/dependency-check.yml (1)
14-14: Java version bump aligns with project-wide upgrade.Straightforward version update as part of the Java 25 migration across CI workflows.
.github/workflows/debian.yml (3)
26-26: Java version bump to 25.0.0 is consistent with project migration.Approved as part of the coordinated Java 25 upgrade.
28-31: OpenJFX JMODs aligned with Java 25 upgrade.URLs correctly point to v25 OpenJFX binaries, and checksums are provided. The downstream validation step (lines 82–102) ensures JMOD major version consistency with pom.xml, which mitigates version mismatch risks.
27-27: Verify ifopenjdk-25-jdkis available in ubuntu-22.04 default repositories; syntax concern was unfounded.The version constraint syntax
(>= 25+36)is valid per Debian specifications—the upstream_version must contain only alphanumerics and the characters "." (full stop), "+" (plus), "-" (hyphen), "~" (tilde). The plus-sign in25+36is standard for Debian versioning.However, package availability remains a concern. Java 25 is available in Ubuntu 25.10 (Questing Quokka) and 25.04 (Plucky Puffin), but openjdk-25 for Ubuntu 22.04 (jammy) is listed as version 25+36-1~22.04.2 and appears to be in the "proposed" repository rather than standard main or security repos. OpenJDK 25 is a short-term release with 6 months support; Ubuntu has made JDK 24 into system repository for upcoming Ubuntu 25.04, while all current Ubuntu releases may use the official tarball instead.
The build will likely fail unless the workflow explicitly enables
universe/proposedrepos or uses an alternative installation method. Consider adding repository configuration or switching to LTS releases (17, 21) for ubuntu-22.04.
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java (1)
197-209: Fix potential NPE in getTimeDifferenceMessage().
lastSuccessfulUpdateCheck.getValue()can be null; computingDuration.betweenbefore null/default checks risks NPE.public String getTimeDifferenceMessage() { - var lastSuccessCheck = lastSuccessfulUpdateCheck.getValue(); - var duration = Duration.between(lastSuccessCheck, Instant.now()); - var hours = duration.toHours(); - if (lastSuccessCheck.equals(Settings.DEFAULT_TIMESTAMP)) { + var lastSuccessCheck = lastSuccessfulUpdateCheck.getValue(); + if (lastSuccessCheck == null || lastSuccessCheck.equals(Settings.DEFAULT_TIMESTAMP)) { return resourceBundle.getString("preferences.updates.lastUpdateCheck.never"); - } else if (hours < 1) { + } + var duration = Duration.between(lastSuccessCheck, Instant.now()); + var hours = duration.toHours(); + if (hours < 1) { return resourceBundle.getString("preferences.updates.lastUpdateCheck.recently"); } else if (hours < 24) { return String.format(resourceBundle.getString("preferences.updates.lastUpdateCheck.hoursAgo"), hours); } else { return String.format(resourceBundle.getString("preferences.updates.lastUpdateCheck.daysAgo"), duration.toDays()); } }
♻️ Duplicate comments (3)
src/main/java/org/cryptomator/updater/DownloadUpdateMechanism.java (1)
26-45: Fix compile error (HttpClient not AutoCloseable), close the body stream, and harden HTTP call.
- HttpClient in try‑with‑resources won’t compile.
- InputStream body isn’t closed → leak.
- Throwing on non‑200 risks crashing on 403/429; prefer graceful false.
- Missing User‑Agent; GitHub API expects one. Add timeouts.
Apply:
- public boolean isUpdateAvailable(String currentVersion) { - try (var client = HttpClient.newHttpClient()) { - // TODO: check different source - HttpRequest request = HttpRequest.newBuilder().uri(URI.create("https://api.github.com/repos/cryptomator/cryptomator/releases/latest")).header("Accept", "application/vnd.github+json").build(); - - HttpResponse<InputStream> response = client.send(request, HttpResponse.BodyHandlers.ofInputStream()); - - if (response.statusCode() != 200) { - throw new RuntimeException("Failed to fetch release: " + response.statusCode()); - } - - var release = MAPPER.readValue(response.body(), GitHubRelease.class); - - return release.assets.stream().anyMatch(a -> a.name.endsWith(assetSuffix)) - && UpdateMechanism.isUpdateAvailable(release.tagName, currentVersion); - } catch (IOException | InterruptedException e) { - return false; - } - } + public boolean isUpdateAvailable(String currentVersion) { + try { + var client = HttpClient.newBuilder() + .connectTimeout(java.time.Duration.ofSeconds(10)) + .followRedirects(HttpClient.Redirect.NORMAL) + .build(); + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create("https://api.github.com/repos/cryptomator/cryptomator/releases/latest")) + .header("Accept", "application/vnd.github+json") + .header("User-Agent", "Cryptomator/" + currentVersion) + .timeout(java.time.Duration.ofSeconds(20)) + .GET() + .build(); + HttpResponse<InputStream> response = client.send(request, HttpResponse.BodyHandlers.ofInputStream()); + if (response.statusCode() != 200) { + // TODO: log status/details + return false; + } + try (InputStream body = response.body()) { + var release = MAPPER.readValue(body, GitHubRelease.class); + return release.assets.stream().anyMatch(a -> a.name.endsWith(assetSuffix)) + && UpdateMechanism.isUpdateAvailable(release.tagName, currentVersion); + } + } catch (IOException | InterruptedException e) { + Thread.currentThread().interrupt(); + return false; + } + }src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java (1)
54-59: Remove duplicate Environment field/param (env).
environmentandenvduplicate the same dependency;envis unused and confusing. Remove the extra field and constructor parameter; useenvironmentconsistently.private final Application application; private final Environment environment; private final ResourceBundle resourceBundle; private final Settings settings; - private final Environment env; ... - UpdatesPreferencesController(Application application, Environment environment, ResourceBundle resourceBundle, Settings settings, UpdateChecker updateChecker, Environment env, FallbackUpdateMechanism fallbackUpdateMechanism) { + UpdatesPreferencesController(Application application, Environment environment, ResourceBundle resourceBundle, Settings settings, UpdateChecker updateChecker, FallbackUpdateMechanism fallbackUpdateMechanism) { ... - this.env = env;Also applies to: 81-87
src/main/java/org/cryptomator/updater/MacOsDmgUpdateMechanism.java (1)
106-116: Fix broken quoting and remove hard-coded user path in restart command.Embedding
scriptinside"nohup bash -c \"...\""breaks due to unescaped quotes. Also redirects to a developer path. Use a here‑doc and send output to/dev/null. Add cleanup.- String script = """ - while kill -0 ${CRYPTOMATOR_PID} 2> /dev/null; do sleep 0.5; done; - cp -R 'Cryptomator.app' "${CRYPTOMATOR_INSTALL_PATH}"; - open -a "${CRYPTOMATOR_INSTALL_PATH}" - """; - var command = List.of("bash", "-c", "nohup bash -c \"" + script + "\" >/Users/sebastian/Downloads/nohup.out 2>&1 &"); + String script = """ + nohup bash <<EOF >/dev/null 2>&1 & + while kill -0 ${CRYPTOMATOR_PID} 2> /dev/null; do sleep 0.5; done; + # Replace existing app atomically + rm -rf "${CRYPTOMATOR_INSTALL_PATH}" + cp -R "Cryptomator.app" "${CRYPTOMATOR_INSTALL_PATH}" + open -a "${CRYPTOMATOR_INSTALL_PATH}" + # best-effort cleanup of temp artifacts + rm -rf "Cryptomator.app" "update.dmg" + EOF + """; + var command = List.of("bash", "-c", script); var processBuilder = new ProcessBuilder(command); processBuilder.directory(workDir.toFile()); processBuilder.environment().put("CRYPTOMATOR_PID", String.valueOf(ProcessHandle.current().pid())); processBuilder.environment().put("CRYPTOMATOR_INSTALL_PATH", installPath); processBuilder.start();Optionally redirect to
${HOME}/Library/Logs/cryptomator-update.loginstead of/dev/nullfor troubleshooting.
🧹 Nitpick comments (8)
src/main/resources/fxml/preferences_updates.fxml (1)
56-67: Hide the Update button when no update is available.Bind visibility/management to the availability flag to avoid a disabled dead control.
- <Button onAction="#doUpdate" disable="${!controller.updateReady}"> <!-- TODO: visible="${controller.updateAvailable}" --> + <Button onAction="#doUpdate" + visible="${controller.updateAvailable}" + managed="${controller.updateAvailable}" + disable="${!controller.updateReady}">src/main/java/org/cryptomator/updater/UpdateService.java (1)
20-23: Avoid per‑service executor leaks; prefer shared or default executor.newVirtualThreadPerTaskExecutor() creates a new executor per instance without shutdown. Consider a shared app‑level executor or the Service default executor.
src/main/java/org/cryptomator/updater/FallbackUpdateMechanism.java (1)
49-55: Minor: prefer UTF‑8 and localize labels.
- Use UTF‑8 for URL encoding.
- Localize “Go to download page” and @DisplayName.
- return UpdateStep.of("Go to download page", this::openDownloadPage); // TODO localize + return UpdateStep.of(Resources.i18n("updates.goToDownloadPage"), this::openDownloadPage); @@ - var downloadUrl = DOWNLOADS_URI_TEMPLATE.formatted(URLEncoder.encode(env.getAppVersion(), StandardCharsets.US_ASCII)); + var downloadUrl = DOWNLOADS_URI_TEMPLATE.formatted(URLEncoder.encode(env.getAppVersion(), StandardCharsets.UTF_8));src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java (2)
135-138: Guard against starting Service in non-READY state.Avoid IllegalStateException if clicked while running; cheap defensive guard.
@FXML public void doUpdate() { - updateService.start(); + if (updateService.getState() == Worker.State.READY) { + updateService.start(); + } }Please confirm the Update button is disabled via
updateReadyProperty()in FXML during RUNNING/SCHEDULED.
244-251: Localize hard-coded button titles.Strings should come from
resourceBundle; keep UI consistent and translatable.public String getUpdateButtonTitle() { return switch (updateService.getState()) { - case READY -> updateMechanism.getName(); - case SCHEDULED, RUNNING -> updateService.getMessage(); // "Preparing Update..."; // TODO: resourceBundle.getString("preferences.updates.preparingUpdate")... - case SUCCEEDED -> "Restart to Update"; // TODO: resourceBundle.getString("preferences.updates.readyToRestart")... - case FAILED, CANCELLED -> "failed"; + case READY -> updateMechanism.getName(); // consider localizing mechanism names too + case SCHEDULED, RUNNING -> updateService.getMessage() != null ? updateService.getMessage() + : resourceBundle.getString("preferences.updates.preparingUpdate"); + case SUCCEEDED -> resourceBundle.getString("preferences.updates.readyToRestart"); + case FAILED, CANCELLED -> resourceBundle.getString("preferences.updates.failed"); }; }src/main/java/org/cryptomator/updater/MacOsDmgUpdateMechanism.java (3)
25-26: Localize display name.Replace hard-coded display name with a resource key for i18n.
-@DisplayName("download .dmg file") // TODO: localize +@DisplayName("updater.macos.dmg") // resolve via resourceBundle in UI
95-105: Destination path selection may need privilege escalation and user-install fallback.Copying into
/Applicationscan fail without admin rights. Consider:
- Trying
~/Applicationsif system Applications is not writable.- Using
osascript/SMJobBless for elevated copy when needed.
83-91: Avoid potential I/O deadlock; capture stdout/stderr safely.Redirect error to stdout to read a single stream or drain both to avoid buffer blocking on verbose failures.
- try { - if (p.waitFor() != 0) { - LOG.error("Failed to extract DMG, exit code: {}, output: {}", p.exitValue(), new String(p.getErrorStream().readAllBytes())); + processBuilder.redirectErrorStream(true); + try { + if (p.waitFor() != 0) { + LOG.error("Failed to extract DMG, exit code: {}, output: {}", p.exitValue(), new String(p.getInputStream().readAllBytes()));
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
dist/mac/dmg/build.shis excluded by!**/dist/**
📒 Files selected for processing (7)
.idea/runConfigurations/Cryptomator_macOS.xml(1 hunks)src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java(8 hunks)src/main/java/org/cryptomator/updater/DownloadUpdateMechanism.java(1 hunks)src/main/java/org/cryptomator/updater/FallbackUpdateMechanism.java(1 hunks)src/main/java/org/cryptomator/updater/MacOsDmgUpdateMechanism.java(1 hunks)src/main/java/org/cryptomator/updater/UpdateService.java(1 hunks)src/main/resources/fxml/preferences_updates.fxml(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/main/java/org/cryptomator/updater/FallbackUpdateMechanism.java (1)
src/main/java/org/cryptomator/common/Environment.java (1)
Environment(19-160)
src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java (1)
src/main/java/org/cryptomator/updater/UpdateService.java (1)
UpdateService(16-59)
🔇 Additional comments (1)
src/main/java/org/cryptomator/updater/DownloadUpdateMechanism.java (1)
40-41: Verify version tag prefix handling in UpdateMechanism.isUpdateAvailable.The review comment is valid. Line 41 calls UpdateMechanism.isUpdateAvailable(release.tagName, currentVersion), passing the GitHub release tag name directly without stripping any "v" prefix. The external dependency org.cryptomator.integrations.api (1.7.0-SNAPSHOT) implements this method, and you should confirm its version comparison logic properly handles GitHub tag names with the "v" prefix (e.g., "v1.17.0") to avoid update detection failures.
There was a problem hiding this comment.
Actionable comments posted: 5
♻️ Duplicate comments (2)
src/main/java/org/cryptomator/updater/MacOsDmgUpdateMechanism.java (2)
32-67: Wire real update metadata instead of hard-coded ARM64 artifactThe download step still pulls a fixed 1.17.0 ARM64 DMG irrespective of the detected architecture or advertised version, so x64 users download the wrong build and future releases never ship. Capture the matching asset from the JSON response and pass its URL/checksum/size into the download step before returning
UpdateInfo.private static final Logger LOG = LoggerFactory.getLogger(MacOsDmgUpdateMechanism.class); + private volatile Asset pendingAsset; + private volatile String pendingVersion; @@ - if (UpdateMechanism.isUpdateAvailable(response.latestVersion().macVersion(), currentVersion) - && response.assets().stream().map(Asset::name).anyMatch(s -> s.endsWith(suffix))) { - return new UpdateInfo(response.latestVersion().macVersion(), this); + var asset = response.assets().stream() + .filter(a -> a.name().endsWith(suffix)) + .findFirst() + .orElse(null); + var latestVersion = response.latestVersion().macVersion(); + if (asset != null && UpdateMechanism.isUpdateAvailable(latestVersion, currentVersion)) { + pendingAsset = asset; + pendingVersion = latestVersion; + return new UpdateInfo(latestVersion, this); } else { return null; } @@ - Path workDir = Files.createTempDirectory("cryptomator-update"); - return new UpdateProcessImpl(workDir); + var asset = pendingAsset; + if (asset == null) { + throw new UpdateFailedException("No update metadata available for download."); + } + Path workDir = Files.createTempDirectory("cryptomator-update"); + return new UpdateProcessImpl(workDir, asset); @@ - private static class UpdateProcessImpl extends DownloadUpdateStep { - - // FIXME: use URI and CHECKSUM from update API - private static final URI UPDATE_URI = URI.create("https://github.com/cryptomator/cryptomator/releases/download/1.17.0/Cryptomator-1.17.0-arm64.dmg"); - private static final byte[] CHECKSUM = HexFormat.of().withLowerCase().parseHex("03f45e203204e93b39925cbb04e19c9316da4f77debaba4fb5071f0ec8e727e8"); + private static class UpdateProcessImpl extends DownloadUpdateStep { @@ - public UpdateProcessImpl(Path workDir) { - var destination = workDir.resolve("update.dmg"); - super(UPDATE_URI, destination, CHECKSUM, 60_000_000L); // initially assume 60 MB for the update size + public UpdateProcessImpl(Path workDir, Asset asset) { + var destination = workDir.resolve("update.dmg"); + super(URI.create(asset.downloadUrl()), destination, HexFormat.of().parseHex(asset.digest()), asset.size());
119-120: Remove developer-specific/Users/sebastian/...redirectionThe restart script writes to
/Users/sebastian/Downloads/nohup.out, which will fail on every other machine. Redirect the background process to a neutral location (e.g./dev/nullor a file underworkDir).- var command = List.of("bash", "-c", "nohup bash -c \"" + script + "\" >/Users/sebastian/Downloads/nohup.out 2>&1 &"); + var command = List.of("bash", "-c", "nohup bash -c \"" + script + "\" >/dev/null 2>&1 &");
🧹 Nitpick comments (3)
src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java (1)
32-32: Document the rationale for the large interval value.The comment mentions that
Duration.INDEFINITEleads to overflows, but using 100,000 hours as a workaround is somewhat arbitrary and could be confusing. Consider adding more context about why this specific value was chosen or if there's a better alternative.src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java (2)
119-125: Use identity comparison for worker references.The method uses
.equals()to compare object references, but identity comparison with==is more appropriate and clearer for checking which worker instance is active.Apply this diff:
public void startWork() { - if (worker.get().equals(updateChecker)) { + if (worker.get() == updateChecker) { updateChecker.checkForUpdatesNow(); - } else if (worker.get().equals(updateService)) { + } else if (worker.get() == updateService) { updateService.start(); } }
247-249: Track the localization TODOs.The hardcoded English strings have TODO comments for localization. These should be tracked in an issue to ensure they're not forgotten.
Do you want me to generate a summary of all localization TODOs in this file for tracking purposes?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (16)
src/main/java/module-info.java(3 hunks)src/main/java/org/cryptomator/common/CommonsModule.java(0 hunks)src/main/java/org/cryptomator/common/SemVerComparator.java(0 hunks)src/main/java/org/cryptomator/ui/fxapp/DelegatingHttpClient.java(1 hunks)src/main/java/org/cryptomator/ui/fxapp/FxApplicationModule.java(1 hunks)src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java(3 hunks)src/main/java/org/cryptomator/ui/fxapp/UpdateCheckerHttpClient.java(1 hunks)src/main/java/org/cryptomator/ui/fxapp/UpdateCheckerModule.java(0 hunks)src/main/java/org/cryptomator/ui/fxapp/UpdateCheckerTask.java(0 hunks)src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java(4 hunks)src/main/java/org/cryptomator/updater/DownloadUpdateMechanism.java(1 hunks)src/main/java/org/cryptomator/updater/FallbackUpdateMechanism.java(1 hunks)src/main/java/org/cryptomator/updater/MacOsDmgUpdateMechanism.java(1 hunks)src/main/java/org/cryptomator/updater/UpdateService.java(1 hunks)src/main/resources/fxml/preferences_updates.fxml(2 hunks)src/test/java/org/cryptomator/common/SemVerComparatorTest.java(0 hunks)
💤 Files with no reviewable changes (5)
- src/main/java/org/cryptomator/common/CommonsModule.java
- src/main/java/org/cryptomator/ui/fxapp/UpdateCheckerTask.java
- src/test/java/org/cryptomator/common/SemVerComparatorTest.java
- src/main/java/org/cryptomator/common/SemVerComparator.java
- src/main/java/org/cryptomator/ui/fxapp/UpdateCheckerModule.java
🚧 Files skipped from review as they are similar to previous changes (2)
- src/main/java/org/cryptomator/updater/UpdateService.java
- src/main/resources/fxml/preferences_updates.fxml
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
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.
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3641
File: .github/workflows/win-exe.yml:19-19
Timestamp: 2024-12-10T17:06:19.650Z
Learning: In the Cryptomator project, the exact JDK version is fixed in release workflows (e.g., `.github/workflows/win-exe.yml`, `.github/workflows/mac-dmg.yml`) to ensure reproducible builds.
📚 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/fxapp/UpdateChecker.javasrc/main/java/org/cryptomator/updater/FallbackUpdateMechanism.javasrc/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.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/fxapp/FxApplicationModule.javasrc/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.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/fxapp/FxApplicationModule.javasrc/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.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/updater/FallbackUpdateMechanism.javasrc/main/java/module-info.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/module-info.java
📚 Learning: 2024-07-17T10:12:26.832Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3494
File: src/main/java/org/cryptomator/common/settings/SettingsProvider.java:50-50
Timestamp: 2024-07-17T10:12:26.832Z
Learning: The constructor of the `SettingsProvider` class in the Cryptomator project is marked with the `Inject` annotation, indicating that it is managed by a dependency injection framework and not called directly in written code.
Applied to files:
src/main/java/module-info.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/preferences/UpdatesPreferencesController.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/preferences/UpdatesPreferencesController.java
🧬 Code graph analysis (4)
src/main/java/org/cryptomator/ui/fxapp/UpdateCheckerHttpClient.java (3)
src/main/java/org/cryptomator/common/Environment.java (1)
Environment(19-160)src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java (1)
FxApplicationScoped(26-159)src/main/java/org/cryptomator/updater/FallbackUpdateMechanism.java (1)
FxApplicationScoped(32-107)
src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java (2)
src/main/java/org/cryptomator/ui/fxapp/UpdateCheckerHttpClient.java (1)
FxApplicationScoped(15-53)src/main/java/org/cryptomator/updater/FallbackUpdateMechanism.java (1)
FxApplicationScoped(32-107)
src/main/java/org/cryptomator/updater/FallbackUpdateMechanism.java (3)
src/main/java/org/cryptomator/common/Environment.java (1)
Environment(19-160)src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java (1)
FxApplicationScoped(26-159)src/main/java/org/cryptomator/ui/fxapp/UpdateCheckerHttpClient.java (1)
FxApplicationScoped(15-53)
src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java (1)
src/main/java/org/cryptomator/updater/UpdateService.java (1)
UpdateService(18-66)
🔇 Additional comments (6)
src/main/java/org/cryptomator/ui/fxapp/DelegatingHttpClient.java (2)
18-24: LGTM! Clean delegation pattern with proper validation.The abstract class declaration, immutable delegate field, and null-check in the constructor follow best practices for implementing the delegation pattern.
26-84: Complete delegation implementation is correct.UpdateCheckerHttpClient is correctly located in the same package (
org.cryptomator.ui.fxapp), so the package-private visibility properly restricts subclassing. All essentialHttpClientmethods are properly overridden and delegated, with correct handling of both synchronous and asynchronous request execution.src/main/java/org/cryptomator/ui/fxapp/FxApplicationModule.java (1)
29-42: No issues found. UpdateChecker dependency injection is properly configured via @Inject constructor.The removal of
UpdateCheckerModulefromFxApplicationModuleis correct.UpdateCheckeritself remains in the codebase with an@Injectconstructor that depends onSettings,Environment,FallbackUpdateMechanism, andUpdateCheckerHttpClient—all of which can be automatically injected by Dagger. The new update mechanism (e.g.,FallbackUpdateMechanism) is properly wired and available for injection. No explicit@Moduleor@Providesmethod is needed when classes have@Injectconstructors.src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java (2)
85-93: LGTM!The pattern of saving the update info before calling
super.succeeded()is correct, and the comment on Line 88 helpfully explains why this is necessary.
146-157: LGTM!The fallback logic correctly tries the primary update mechanism first, then falls back to the fallback mechanism if the primary returns null and they differ. The exception handling will be managed by the Task framework.
src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java (1)
127-143: LGTM!The event handlers correctly distinguish between different update outcomes (EXIT, RETRY, success) and include proper error logging as previously requested.
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (3)
src/main/java/org/cryptomator/updater/FallbackUpdateMechanism.java (2)
69-71: Restore the interrupt before swallowing itCombining
IOExceptionandInterruptedExceptionclears the interrupt flag and causes cancelled checks to keep running. Please restore the interrupt and handle the two exceptions separately.- } catch (IOException | InterruptedException e) { - LOG.warn("Update check failed", e); - return null; + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + LOG.warn("Update check interrupted", e); + return null; + } catch (IOException e) { + LOG.warn("Update check failed", e); + return null;
63-66: Fallback never reports updates
isUpdateAvailableexpects the available version first and the current version second (see the macOS mechanism). Passing them in the opposite order suppresses every update, so the fallback path never fires.- if (UpdateMechanism.isUpdateAvailable(currentVersion, updateVersion)) { + if (UpdateMechanism.isUpdateAvailable(updateVersion, currentVersion)) { return UpdateInfo.of(updateVersion, this);src/main/java/org/cryptomator/updater/UpdateService.java (1)
41-64: Cancellation is ignored, steps keep running
Service.cancel()currently has no effect: the loop never checksisCancelled(), andobserveAndWaitFor(...)sits in the await call until the step finishes. As a result the update keeps downloading/installing even after the UI tries to abort it. Please wire the cancellation flag through the step loop and stop once the service is cancelled.- UpdateStep lastStep; - do { - step.start(); - observeAndWaitFor(step); - lastStep = step; - step = step.nextStep(); - } while (step != null); - return lastStep; + UpdateStep lastStep = null; + while (step != null) { + if (isCancelled()) { + step.cancel(); + throw new InterruptedIOException("Update cancelled"); + } + step.start(); + observeAndWaitFor(step); + lastStep = step; + step = step.nextStep(); + } + return lastStep; @@ - private void observeAndWaitFor(UpdateStep step) throws InterruptedException { - do { - updateProgress(step.preparationProgress(), 1.0); - updateMessage(step.description()); - } while (!step.await(100, TimeUnit.MILLISECONDS)); - } + private void observeAndWaitFor(UpdateStep step) throws InterruptedException { + do { + updateProgress(step.preparationProgress(), 1.0); + updateMessage(step.description()); + if (isCancelled()) { + step.cancel(); + break; + } + } while (!step.await(100, TimeUnit.MILLISECONDS)); + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java(2 hunks)src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java(4 hunks)src/main/java/org/cryptomator/updater/DownloadUpdateMechanism.java(1 hunks)src/main/java/org/cryptomator/updater/FallbackUpdateMechanism.java(1 hunks)src/main/java/org/cryptomator/updater/MacOsDmgUpdateMechanism.java(1 hunks)src/main/java/org/cryptomator/updater/UpdateService.java(1 hunks)src/main/resources/fxml/preferences_updates.fxml(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/main/resources/fxml/preferences_updates.fxml
🧰 Additional context used
🧠 Learnings (7)
📓 Common learnings
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.
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3641
File: .github/workflows/win-exe.yml:19-19
Timestamp: 2024-12-10T17:06:19.650Z
Learning: In the Cryptomator project, the exact JDK version is fixed in release workflows (e.g., `.github/workflows/win-exe.yml`, `.github/workflows/mac-dmg.yml`) to ensure reproducible builds.
📚 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/preferences/UpdatesPreferencesController.javasrc/main/java/org/cryptomator/updater/FallbackUpdateMechanism.javasrc/main/java/org/cryptomator/ui/fxapp/UpdateChecker.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/preferences/UpdatesPreferencesController.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/preferences/UpdatesPreferencesController.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/preferences/UpdatesPreferencesController.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/preferences/UpdatesPreferencesController.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/updater/FallbackUpdateMechanism.java
🧬 Code graph analysis (3)
src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java (2)
src/main/java/org/cryptomator/updater/UpdateService.java (1)
UpdateService(19-67)src/main/java/org/cryptomator/common/settings/Settings.java (1)
Settings(33-241)
src/main/java/org/cryptomator/updater/FallbackUpdateMechanism.java (3)
src/main/java/org/cryptomator/common/Environment.java (1)
Environment(19-160)src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java (1)
FxApplicationScoped(25-170)src/main/java/org/cryptomator/ui/fxapp/UpdateCheckerHttpClient.java (1)
FxApplicationScoped(15-53)
src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java (2)
src/main/java/org/cryptomator/updater/FallbackUpdateMechanism.java (1)
FxApplicationScoped(32-107)src/main/java/org/cryptomator/ui/fxapp/UpdateCheckerHttpClient.java (1)
FxApplicationScoped(15-53)
🔇 Additional comments (6)
src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java (6)
1-26: LGTM: Clean migration to ScheduledService architecture.The transformation from a manually managed service to JavaFX's ScheduledService is well-executed. The imports align with the new architecture, introducing UpdateMechanism integration and Task-based execution.
30-49: LGTM: Well-designed state management with reactive bindings.The UpdateCheckState enum provides clear semantic states, and the reactive bindings (latestVersion, updateAvailable, updateState, checkFailed) properly leverage JavaFX's binding API for type-safe property observation.
63-63: Verify virtual thread executor compatibility with ScheduledService.Using a virtual thread executor with ScheduledService is a modern approach, but since ScheduledService traditionally expects scheduled execution semantics, ensure this pattern has been tested. The service should handle scheduling internally while delegating task execution to the virtual thread pool.
Verify this pattern works as expected by running the application and confirming that:
- Update checks execute successfully on virtual threads
- The scheduled periodic execution continues to work
- No unexpected threading issues occur with JavaFX property updates
67-82: LGTM: Correct ScheduledService lifecycle management.The startCheckingForUpdates method properly uses the cancel/reset/setDelay/start pattern, which is the standard approach for restarting a ScheduledService with new parameters.
106-155: LGTM: Well-structured observable properties.The property accessors follow JavaFX conventions correctly, and the state mapping in getUpdateCheckState() provides a clean abstraction from ScheduledService.State to the domain-specific UpdateCheckState enum.
157-168: LGTM: Clean update check flow with fallback mechanism.The UpdateCheckTask properly implements the primary-then-fallback pattern. The reference equality check (primaryUpdateMechanism != fallbackUpdateMechanism) correctly determines whether to attempt the fallback, and exception handling aligns with the ScheduledService lifecycle.
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java (1)
206-206: Guard against potential NPE (previously flagged).Past review comment indicated this was addressed, but the code at line 206 still accesses
updateChecker.getLastValue().updateMechanism().getName()without null-checkinggetLastValue(). TheUpdateChecker.succeeded()method explicitly states "this will nil the value property!" (line 87 in UpdateChecker.java), sogetLastValue()can return null even whenupdateServiceis in READY state.Add null-checking or use a fallback:
- case READY -> updateChecker.getLastValue().updateMechanism().getName(); + case READY -> { + var lastValue = updateChecker.getLastValue(); + yield lastValue != null ? lastValue.updateMechanism().getName() : "Update"; + }
🧹 Nitpick comments (1)
src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java (1)
207-210: Complete localization for update status messages.The switch statement contains hardcoded English strings with TODO comments indicating incomplete localization. These user-facing messages should be externalized to the resource bundle for i18n support.
Add the missing resource bundle keys and replace the hardcoded strings:
- case SCHEDULED, RUNNING -> updateService.getMessage(); // "Preparing Update..."; // TODO: resourceBundle.getString("preferences.updates.preparingUpdate")... - case SUCCEEDED -> "Restart to Update"; // TODO: resourceBundle.getString("preferences.updates.readyToRestart")... - case FAILED, CANCELLED -> "failed"; + case SCHEDULED, RUNNING -> updateService.getMessage(); + case SUCCEEDED -> resourceBundle.getString("preferences.updates.readyToRestart"); + case FAILED, CANCELLED -> resourceBundle.getString("preferences.updates.failed");
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java(2 hunks)src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java(5 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
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.
📚 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/fxapp/UpdateChecker.javasrc/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.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/preferences/UpdatesPreferencesController.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/preferences/UpdatesPreferencesController.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/preferences/UpdatesPreferencesController.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/preferences/UpdatesPreferencesController.java
🧬 Code graph analysis (2)
src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java (2)
src/main/java/org/cryptomator/updater/FallbackUpdateMechanism.java (1)
FxApplicationScoped(33-112)src/main/java/org/cryptomator/ui/fxapp/UpdateCheckerHttpClient.java (1)
FxApplicationScoped(15-53)
src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java (2)
src/main/java/org/cryptomator/updater/UpdateService.java (1)
UpdateService(19-68)src/main/java/org/cryptomator/common/settings/Settings.java (1)
Settings(33-241)
🔇 Additional comments (2)
src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java (2)
84-92: LGTM! Timestamp update fixed.The
lastSuccessfulUpdateChecktimestamp is now correctly set unconditionally at line 88 for every successful check, regardless of whether an update was found. This properly addresses the previous review feedback.
157-169: LGTM! Clean fallback logic.The
UpdateCheckTaskcorrectly implements the primary-then-fallback pattern: it attempts the primary update mechanism first, and only falls back to the fallback mechanism if the primary returns null and they are distinct mechanisms. Returning null when no update is available is appropriate, as theupdateAvailablebinding (line 44) handles this vialastValueProperty().isNotNull().
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java (1)
96-104: Track the TODO for vault locking requirement.The TODO on line 101 indicates that the update service should only be started when all vaults are locked. This is an important safety requirement that should be implemented or tracked as a follow-up issue.
Would you like me to open a tracking issue for implementing the vault lock check before allowing updates?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
src/main/java/org/cryptomator/common/Environment.java(1 hunks)src/main/java/org/cryptomator/common/settings/Settings.java(6 hunks)src/main/java/org/cryptomator/common/settings/SettingsJson.java(1 hunks)src/main/java/org/cryptomator/common/settings/SettingsProvider.java(5 hunks)src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java(2 hunks)src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java(5 hunks)src/test/java/org/cryptomator/common/settings/SettingsTest.java(1 hunks)
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
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.
📚 Learning: 2024-07-17T10:12:26.832Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3494
File: src/main/java/org/cryptomator/common/settings/SettingsProvider.java:50-50
Timestamp: 2024-07-17T10:12:26.832Z
Learning: The constructor of the `SettingsProvider` class in the Cryptomator project is marked with the `Inject` annotation, indicating that it is managed by a dependency injection framework and not called directly in written code.
Applied to files:
src/test/java/org/cryptomator/common/settings/SettingsTest.javasrc/main/java/org/cryptomator/common/settings/Settings.javasrc/main/java/org/cryptomator/common/settings/SettingsProvider.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/fxapp/UpdateChecker.javasrc/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.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/preferences/UpdatesPreferencesController.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/preferences/UpdatesPreferencesController.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/preferences/UpdatesPreferencesController.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/preferences/UpdatesPreferencesController.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/preferences/UpdatesPreferencesController.java
📚 Learning: 2025-03-21T15:33:41.461Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3780
File: src/main/java/org/cryptomator/ui/fxapp/FxFSEventList.java:27-37
Timestamp: 2025-03-21T15:33:41.461Z
Learning: In the Cryptomator application, tasks scheduled with an injected ScheduledExecutorService don't require explicit cancellation in a separate shutdown method, as they will be automatically canceled when the executorService shuts down.
Applied to files:
src/main/java/org/cryptomator/common/settings/SettingsProvider.java
🧬 Code graph analysis (4)
src/test/java/org/cryptomator/common/settings/SettingsTest.java (2)
src/main/java/org/cryptomator/common/settings/Settings.java (1)
Settings(31-235)src/main/java/org/cryptomator/common/settings/VaultSettings.java (1)
VaultSettings(32-167)
src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java (2)
src/main/java/org/cryptomator/updater/FallbackUpdateMechanism.java (1)
FxApplicationScoped(33-112)src/main/java/org/cryptomator/ui/fxapp/UpdateCheckerHttpClient.java (1)
FxApplicationScoped(15-53)
src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java (2)
src/main/java/org/cryptomator/updater/UpdateService.java (1)
UpdateService(19-68)src/main/java/org/cryptomator/common/settings/Settings.java (1)
Settings(31-235)
src/main/java/org/cryptomator/common/settings/SettingsProvider.java (1)
src/main/java/org/cryptomator/common/settings/Settings.java (1)
Settings(31-235)
🔇 Additional comments (8)
src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java (4)
62-69: Defensive fallback logic looks good.The logic to prefer the fallback mechanism when the current version already attempted an update is sound defensive programming. This prevents repeatedly attempting a potentially broken platform-specific update mechanism.
71-72: Executor and period binding are appropriate.The virtual thread executor is well-suited for I/O-bound update checks. The large duration workaround for the disabled case is reasonable given the overflow concern noted in the comment.
92-100: LGTM!The
succeeded()override correctly captures the update info before callingsuper.succeeded()and updates the timestamp unconditionally, ensuring the last check time is recorded even when no update is available.
165-176: Fallback strategy implemented correctly.The task correctly tries the primary update mechanism first, then falls back to the secondary mechanism only when needed. The guard
primaryUpdateMechanism != fallbackUpdateMechanismprevents redundant checks when they're the same instance.src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java (4)
62-75: LGTM!The constructor correctly initializes the
UpdateServiceand sets up the complex bindings. The worker binding appropriately switches between the update service and update checker based on update availability.
106-120: LGTM!The success handler correctly manages all update outcomes: recording the attempt version before exit, resetting for retry, and logging completion. The defensive persistence of
lastUpdateAttemptedByVersionbefore exit ensures the fallback logic can activate on the next launch.
122-126: LGTM!The failure handler correctly logs the exception and resets the service, allowing users to retry after a failed update attempt.
204-215: No null check required at line 209; the code is safe by design.The binding logic guarantees that lastValue is the value that was last successfully computed and is set to the most recently successfully computed value, even across iterations. More importantly, the control flow is secure:
- updateAvailable = lastValueProperty().isNotNull(), and worker is set to updateService only when updateAvailable is true
- Line 205-206 returns early if
worker != updateService- At line 209, being in the READY case guarantees
worker == updateService(not updateChecker)- This can only occur when updateAvailable is true, which means lastValueProperty is not null
- Therefore,
getLastValue()cannot be null at line 209The code is correct; no fix is needed.
There was a problem hiding this comment.
Pull Request Overview
This PR implements native update mechanisms for Cryptomator, allowing the application to download and apply updates automatically. The key changes include upgrading to JDK 25, refactoring the update checking system to use the integrations API, and implementing platform-specific update mechanisms (e.g., MacOS DMG installer).
- Upgraded Java version from JDK 24 to JDK 25 across all build configurations and workflows
- Refactored update checker to use new integrations API with support for multiple update mechanisms
- Implemented native update mechanism for macOS DMG downloads with automated installation
- Removed SemVerComparator in favor of version comparison logic in integrations API
Reviewed Changes
Copilot reviewed 33 out of 40 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pom.xml | Updated JDK version from 24 to 25 and integrations dependencies to SNAPSHOT versions |
| src/main/java/org/cryptomator/updater/*.java | New update mechanism implementations for downloading and installing updates |
| src/main/java/org/cryptomator/ui/fxapp/UpdateChecker.java | Refactored to extend ScheduledService and use UpdateMechanism API |
| src/main/java/org/cryptomator/common/settings/Settings.java | Added lastUpdateAttemptedByVersion property to track update attempts |
| src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java | Updated to handle both update checking and update installation workflows |
| Various workflow files | Updated Java versions from 24 to 25 |
Files not reviewed (4)
- .idea/compiler.xml: Language not supported
- .idea/inspectionProfiles/Project_Default.xml: Language not supported
- .idea/misc.xml: Language not supported
- .idea/runConfigurations/Cryptomator_macOS.xml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (6)
src/main/java/org/cryptomator/updater/MacOsDmgUpdateMechanism.java (5)
28-28: TODO: Localize the display name.The display name "download .dmg file" should be localized to support multiple languages.
Do you want me to generate an issue to track this localization task?
49-56: Consider temp directory cleanup on failure.While the temporary directory is created for the update process, there's no explicit cleanup mechanism if the update fails or is cancelled. This is likely acceptable for an update mechanism (cleanup can be deferred to the OS), but consider whether explicit cleanup would be beneficial.
65-65: Validate digest format before substring.The code assumes the digest always starts with "sha256:" but doesn't validate this. If the format changes or is unexpected,
substring(7)could produce incorrect results or throw an exception.Consider adding validation:
- var checksum = HexFormat.of().withLowerCase().parseHex(updateInfo.asset().digest().substring(7)); // remove "sha256:" prefix + var digest = updateInfo.asset().digest(); + if (!digest.startsWith("sha256:")) { + throw new IllegalArgumentException("Unexpected digest format: " + digest); + } + var checksum = HexFormat.of().withLowerCase().parseHex(digest.substring(7));
80-103: Potential volume mount leak on partial failure.If the script fails after
hdiutil attachbut beforehdiutil detach(e.g., if the copy fails), the mounted volume may remain attached. Consider adding explicit cleanup or using a trap in the bash script.Example with cleanup:
String script = """ + trap 'hdiutil detach "/Volumes/Cryptomator_${MOUNT_ID}" -quiet 2>/dev/null' EXIT hdiutil attach 'update.dmg' -mountpoint "/Volumes/Cryptomator_${MOUNT_ID}" -nobrowse -quiet && cp -R "/Volumes/Cryptomator_${MOUNT_ID}/Cryptomator.app" 'Cryptomator.app' && hdiutil detach "/Volumes/Cryptomator_${MOUNT_ID}" -quiet """;This ensures the volume is detached even if the copy fails.
105-134: Consider validating write permissions before launching install script.The restart method launches a background script that will execute after the current process exits. If the installation directory lacks write permissions, the script will fail silently, leaving the user without the update and potentially with a broken installation (if the old app was already removed).
Consider adding a pre-check:
} else { throw new UpdateFailedException("Cannot determine destination path for Cryptomator.app, current path: " + selfPath); } + // Verify write permissions before proceeding + Path installDir = Path.of(installPath).getParent(); + if (!Files.isWritable(installDir)) { + throw new UpdateFailedException("No write permission for installation directory: " + installDir); + } LOG.info("Restarting to apply Update in {} now...", workDir);This provides immediate feedback if the update will fail due to permissions.
src/main/java/org/cryptomator/updater/UpdateService.java (1)
46-69: Consider adding cancellation support.The current implementation doesn't check
isCancelled()during step execution. If the user cancels the update service, the steps will continue running until completion. This may be intentional if update steps cannot be safely interrupted, but consider whether partial cancellation support would improve UX.If cancellation should be supported:
protected UpdateStep call() throws IOException { try { UpdateStep step = updateInfo.useToPrepareFirstStep(); UpdateStep lastStep; do { + if (isCancelled()) { + step.cancel(); + break; + } step.start(); observeAndWaitFor(step); lastStep = step; step = step.nextStep(); } while (step != null); return lastStep; } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new InterruptedIOException("Update interrupted"); } } private void observeAndWaitFor(UpdateStep step) throws InterruptedException { do { + if (isCancelled()) { + step.cancel(); + throw new InterruptedException("Cancelled"); + } updateProgress(step.preparationProgress(), 1.0); updateMessage(step.description()); } while (!step.await(100, TimeUnit.MILLISECONDS)); }Alternatively, if cancellation should not be supported, consider documenting this decision.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
src/main/java/org/cryptomator/ui/mainwindow/MainWindowController.java(1 hunks)src/main/java/org/cryptomator/ui/preferences/AboutController.java(1 hunks)src/main/java/org/cryptomator/ui/preferences/PreferencesController.java(1 hunks)src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java(4 hunks)src/main/java/org/cryptomator/ui/updatereminder/UpdateReminderController.java(1 hunks)src/main/java/org/cryptomator/updater/DelegatingHttpClient.java(1 hunks)src/main/java/org/cryptomator/updater/FallbackUpdateMechanism.java(1 hunks)src/main/java/org/cryptomator/updater/MacOsDmgUpdateMechanism.java(1 hunks)src/main/java/org/cryptomator/updater/UpdateChecker.java(1 hunks)src/main/java/org/cryptomator/updater/UpdateCheckerHttpClient.java(1 hunks)src/main/java/org/cryptomator/updater/UpdateService.java(1 hunks)src/main/resources/fxml/preferences_updates.fxml(1 hunks)src/main/resources/i18n/strings.properties(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/main/resources/i18n/strings.properties
🧰 Additional context used
🧠 Learnings (10)
📓 Common learnings
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.
📚 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/mainwindow/MainWindowController.javasrc/main/java/org/cryptomator/ui/preferences/AboutController.javasrc/main/java/org/cryptomator/ui/updatereminder/UpdateReminderController.javasrc/main/java/org/cryptomator/ui/preferences/PreferencesController.javasrc/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.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/mainwindow/MainWindowController.javasrc/main/java/org/cryptomator/ui/preferences/AboutController.javasrc/main/java/org/cryptomator/ui/updatereminder/UpdateReminderController.javasrc/main/java/org/cryptomator/updater/FallbackUpdateMechanism.javasrc/main/java/org/cryptomator/updater/UpdateService.javasrc/main/java/org/cryptomator/updater/MacOsDmgUpdateMechanism.javasrc/main/java/org/cryptomator/ui/preferences/PreferencesController.javasrc/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.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/mainwindow/MainWindowController.javasrc/main/java/org/cryptomator/ui/preferences/AboutController.javasrc/main/java/org/cryptomator/ui/preferences/PreferencesController.javasrc/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.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/mainwindow/MainWindowController.javasrc/main/java/org/cryptomator/ui/preferences/AboutController.javasrc/main/java/org/cryptomator/ui/updatereminder/UpdateReminderController.javasrc/main/java/org/cryptomator/updater/UpdateCheckerHttpClient.javasrc/main/java/org/cryptomator/updater/FallbackUpdateMechanism.javasrc/main/java/org/cryptomator/ui/preferences/PreferencesController.javasrc/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.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/mainwindow/MainWindowController.javasrc/main/java/org/cryptomator/ui/updatereminder/UpdateReminderController.javasrc/main/java/org/cryptomator/ui/preferences/PreferencesController.javasrc/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java
📚 Learning: 2024-07-17T10:12:26.832Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3494
File: src/main/java/org/cryptomator/common/settings/SettingsProvider.java:50-50
Timestamp: 2024-07-17T10:12:26.832Z
Learning: The constructor of the `SettingsProvider` class in the Cryptomator project is marked with the `Inject` annotation, indicating that it is managed by a dependency injection framework and not called directly in written code.
Applied to files:
src/main/java/org/cryptomator/ui/updatereminder/UpdateReminderController.java
📚 Learning: 2025-11-04T21:08:39.529Z
Learnt from: overheadhunter
Repo: cryptomator/cryptomator PR: 3948
File: src/main/java/org/cryptomator/updater/UpdateService.java:42-58
Timestamp: 2025-11-04T21:08:39.529Z
Learning: In the integrations-api UpdateMechanism interface, the firstStep() method is guaranteed to never return null per API contract.
Applied to files:
src/main/java/org/cryptomator/updater/FallbackUpdateMechanism.javasrc/main/java/org/cryptomator/updater/UpdateService.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/updater/FallbackUpdateMechanism.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/preferences/UpdatesPreferencesController.java
🧬 Code graph analysis (4)
src/main/java/org/cryptomator/updater/UpdateChecker.java (3)
src/main/java/org/cryptomator/common/Environment.java (1)
Environment(19-169)src/main/java/org/cryptomator/common/settings/Settings.java (1)
Settings(31-235)src/main/java/org/cryptomator/updater/FallbackUpdateMechanism.java (1)
FxApplicationScoped(27-105)
src/main/java/org/cryptomator/updater/UpdateCheckerHttpClient.java (1)
src/main/java/org/cryptomator/common/Environment.java (1)
Environment(19-169)
src/main/java/org/cryptomator/updater/FallbackUpdateMechanism.java (2)
src/main/java/org/cryptomator/common/Environment.java (1)
Environment(19-169)src/main/java/org/cryptomator/updater/UpdateChecker.java (1)
FxApplicationScoped(25-198)
src/main/java/org/cryptomator/ui/preferences/UpdatesPreferencesController.java (2)
src/main/java/org/cryptomator/updater/UpdateService.java (1)
UpdateService(21-81)src/main/java/org/cryptomator/common/settings/Settings.java (1)
Settings(31-235)
🔇 Additional comments (14)
src/main/java/org/cryptomator/updater/MacOsDmgUpdateMechanism.java (2)
34-46: LGTM!The architecture detection and asset selection logic is correct. The method properly distinguishes between ARM64 and x64 architectures and selects the appropriate DMG file.
70-78: LGTM!The download completion check and error propagation are handled correctly.
src/main/java/org/cryptomator/ui/updatereminder/UpdateReminderController.java (1)
5-5: LGTM!The import update correctly reflects the relocation of UpdateChecker to the updater package. No functional changes required.
src/main/java/org/cryptomator/ui/mainwindow/MainWindowController.java (1)
10-10: LGTM!Import path correctly updated to reflect the UpdateChecker relocation to the updater package.
src/main/java/org/cryptomator/ui/preferences/AboutController.java (1)
6-6: LGTM!Import path correctly updated to align with the UpdateChecker package refactoring.
src/main/java/org/cryptomator/ui/preferences/PreferencesController.java (1)
5-5: LGTM!Import path updated correctly for the UpdateChecker package relocation.
src/main/java/org/cryptomator/updater/DelegatingHttpClient.java (2)
18-24: LGTM!The wrapper pattern is implemented correctly with proper null validation. The package-private visibility is appropriate for this internal infrastructure class.
26-84: LGTM!Complete and correct delegation of all HttpClient methods. This provides a clean foundation for decorating HTTP clients without altering the base functionality.
src/main/java/org/cryptomator/updater/UpdateService.java (3)
21-30: LGTM!The use of virtual threads for update operations is appropriate for this I/O-heavy workload. The service structure and failure binding are well-designed.
32-35: LGTM!Standard JavaFX Service task creation pattern correctly implemented.
72-80: LGTM!Observable property accessors follow standard JavaFX patterns.
src/main/java/org/cryptomator/updater/UpdateCheckerHttpClient.java (3)
18-24: LGTM!The constructor correctly leverages JDK 25's flexible constructor bodies feature. The HTTP client configuration (redirects, proxy) and User-Agent formatting are appropriate for update checking.
26-39: LGTM!All send method variants are correctly overridden to apply request decoration. The implementation is consistent and complete.
41-47: LGTM!The request decoration correctly adds User-Agent and timeout. Note that this will override any existing User-Agent or timeout in the original request, which is the expected behavior for ensuring consistent update check requests.
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
dist/mac/dmg/build.shis excluded by!**/dist/**
📒 Files selected for processing (3)
.idea/runConfigurations/Cryptomator_macOS.xml(1 hunks)pom.xml(3 hunks)src/main/java/module-info.java(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- .idea/runConfigurations/Cryptomator_macOS.xml
🧰 Additional context used
🧠 Learnings (7)
📓 Common learnings
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.
📚 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/module-info.javapom.xml
📚 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/module-info.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/module-info.java
📚 Learning: 2024-07-17T10:12:26.832Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3494
File: src/main/java/org/cryptomator/common/settings/SettingsProvider.java:50-50
Timestamp: 2024-07-17T10:12:26.832Z
Learning: The constructor of the `SettingsProvider` class in the Cryptomator project is marked with the `Inject` annotation, indicating that it is managed by a dependency injection framework and not called directly in written code.
Applied to files:
src/main/java/module-info.java
📚 Learning: 2024-12-10T17:06:19.650Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3641
File: .github/workflows/win-exe.yml:19-19
Timestamp: 2024-12-10T17:06:19.650Z
Learning: In the Cryptomator project, the exact JDK version is fixed in release workflows (e.g., `.github/workflows/win-exe.yml`, `.github/workflows/mac-dmg.yml`) to ensure reproducible builds.
Applied to files:
pom.xml
📚 Learning: 2025-11-04T21:07:05.326Z
Learnt from: overheadhunter
Repo: cryptomator/cryptomator PR: 3948
File: .idea/compiler.xml:43-68
Timestamp: 2025-11-04T21:07:05.326Z
Learning: The `.idea/compiler.xml` file in the Cryptomator repository is auto-generated by IntelliJ IDEA and should not be manually edited, as changes will be overwritten during project reimport or dependency synchronization.
Applied to files:
pom.xml
🔇 Additional comments (4)
pom.xml (3)
29-29: JDK version updated to Java 25.The JDK bump from 24 to 25 is aligned with the broader refactoring. This should be compatible with the current dependencies (JavaFX 25, Dagger 2.57.2, etc.) per prior project experience.
37-37: SNAPSHOT versions for platform-specific integrations libraries.Three new SNAPSHOT dependencies have been introduced to support the Flatpak autoupdate functionality:
- integrations-api: 1.8.0-SNAPSHOT
- integrations-mac: 1.5.0-SNAPSHOT
- integrations-linux: 1.7.0-SNAPSHOT
Confirm that these correspond to the upstream dependency changes referenced in the PR objectives (cryptomator/integrations-api#62, cryptomator/integrations-linux#117) and that the SNAPSHOT artifacts are published to the Central Portal Snapshots repository configured above.
Also applies to: 39-39, 40-40
65-65: JaCoCo plugin version bumped to 0.8.14.Patch version bump from 0.8.13 to 0.8.14 is low-risk and applies cleanly to the coverage profile configuration.
src/main/java/module-info.java (1)
54-55: Dependencies align with autoupdate feature requirements.The additions of
com.github.benmanes.caffeine(caching library) andcom.fasterxml.jackson.annotation(JSON annotations) are appropriate for the autoupdate functionality, which likely involves caching update check results and parsing JSON responses from update APIs.
|
@purejava I'm happy with the integration of the update API in the desktop app now. However, the real challenge is to tell it which update mechanism shall be used. This needs to be done during packaging, as can be seen here: So the jpackage step in the Flatpak build needs to be adjusted as well. |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/mac-dmg-x64.yml(2 hunks).github/workflows/mac-dmg.yml(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- .github/workflows/mac-dmg.yml
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
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.
📚 Learning: 2024-12-10T17:06:19.650Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 3641
File: .github/workflows/win-exe.yml:19-19
Timestamp: 2024-12-10T17:06:19.650Z
Learning: In the Cryptomator project, the exact JDK version is fixed in release workflows (e.g., `.github/workflows/win-exe.yml`, `.github/workflows/mac-dmg.yml`) to ensure reproducible builds.
Applied to files:
.github/workflows/mac-dmg-x64.yml
📚 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:
.github/workflows/mac-dmg-x64.yml
📚 Learning: 2025-06-17T12:55:22.351Z
Learnt from: infeo
Repo: cryptomator/cryptomator PR: 2666
File: .github/workflows/win-exe.yml:0-0
Timestamp: 2025-06-17T12:55:22.351Z
Learning: In the Cryptomator Windows build workflow, the debug launcher (CryptomatorDebug) should be included in every build as an additional, non-standard executable, not conditionally based on the isDebug input. This design provides users with debugging capabilities when needed without affecting the normal user experience.
Applied to files:
.github/workflows/mac-dmg-x64.yml
🔇 Additional comments (1)
.github/workflows/mac-dmg-x64.yml (1)
138-139: DMG update mechanism configuration is correctly added.The new
--java-options "-Dcryptomator.updateMechanism=org.cryptomator.macos.update.DmgUpdateMechanism"on Line 139 correctly implements the packaging-level update mechanism selection discussed in the PR objectives. The backslash continuation on Line 138 is properly formatted, and this aligns with overheadhunter's requirement that "selecting which update mechanism must be handled during packaging."
# Conflicts: # .github/workflows/appimage.yml # .github/workflows/check-jdk-updates.yml # .github/workflows/debian.yml # .github/workflows/mac-dmg-x64.yml # .github/workflows/mac-dmg.yml # .github/workflows/win-exe.yml
@overheadhunter Thanks for pointing that out! I'll open a PR on Flathub and add the link to the first comment of this PR. After all the API changes you have done to bring Flatpak update and a general update mechanism together - thanks again - I re-tested Flatpak update with the latest Cryptomator release Bildschirmaufnahme.2025-11-16.um.12.04.42.-.Trim.mp4One litte adjustment to the 07:20:47.853 [virtual-61] ERROR o.cryptomator.updater.UpdateChecker - Update check using class org.cryptomator.linux.update.FlatpakUpdater failed.
org.cryptomator.integrations.update.UpdateFailedException: Check for updates failed.
at org.cryptomator.integrations.linux@1.7.0-SNAPSHOT/org.cryptomator.linux.update.FlatpakUpdater.checkForUpdate(FlatpakUpdater.java:80)
at org.cryptomator.integrations.linux@1.7.0-SNAPSHOT/org.cryptomator.linux.update.FlatpakUpdater.checkForUpdate(FlatpakUpdater.java:35)
at org.cryptomator.desktop@1.17.9/org.cryptomator.updater.UpdateChecker$UpdateCheckTask.call(UpdateChecker.java:178)
at org.cryptomator.desktop@1.17.9/org.cryptomator.updater.UpdateChecker$UpdateCheckTask.call(UpdateChecker.java:173)
at javafx.graphics@25.0.1/javafx.concurrent.Task$TaskCallable.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at javafx.graphics@25.0.1/javafx.concurrent.Service.lambda$executeTask$0(Unknown Source)
at java.base/java.util.concurrent.ThreadPerTaskExecutor$TaskRunner.run(Unknown Source)
at java.base/java.lang.VirtualThread.run(Unknown Source)
Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Failed to call `setAccess()` on Constructor 'org.cryptomator.linux.update.FlatpakUpdater$AppstreamResponse' (of class `org.cryptomator.linux.update.FlatpakUpdater$AppstreamResponse`) due to `java.lang.reflect.InaccessibleObjectException`, problem: Unable to make public org.cryptomator.linux.update.FlatpakUpdater$AppstreamResponse(java.util.List) accessible: module org.cryptomator.integrations.linux does not "exports org.cryptomator.linux.update" to module com.fasterxml.jackson.databind
at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 1]
at [email protected]/com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:62)
at [email protected]/com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.buildBeanDeserializer(BeanDeserializerFactory.java:270)
at [email protected]/com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:152)
at [email protected]/com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer2(DeserializerCache.java:472)
at [email protected]/com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:416)
at [email protected]/com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:318)
at [email protected]/com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:285)
at [email protected]/com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:175)
at [email protected]/com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:689)
at [email protected]/com.fasterxml.jackson.databind.ObjectReader._findRootDeserializer(ObjectReader.java:2427)
at [email protected]/com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:2146)
at [email protected]/com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1504)
at [email protected]/com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1519)
at [email protected]/org.cryptomator.linux.update.FlatpakUpdater.checkForUpdate(FlatpakUpdater.java:67)
... 8 common frames omitted
Caused by: java.lang.IllegalArgumentException: Failed to call `setAccess()` on Constructor 'org.cryptomator.linux.update.FlatpakUpdater$AppstreamResponse' (of class `org.cryptomator.linux.update.FlatpakUpdater$AppstreamResponse`) due to `java.lang.reflect.InaccessibleObjectException`, problem: Unable to make public org.cryptomator.linux.update.FlatpakUpdater$AppstreamResponse(java.util.List) accessible: module org.cryptomator.integrations.linux does not "exports org.cryptomator.linux.update" to module com.fasterxml.jackson.databind
at [email protected]/com.fasterxml.jackson.databind.util.ClassUtil.checkAndFixAccess(ClassUtil.java:1052)
at [email protected]/com.fasterxml.jackson.databind.deser.impl.CreatorCollector._fixAccess(CreatorCollector.java:277)
at [email protected]/com.fasterxml.jackson.databind.deser.impl.CreatorCollector.verifyNonDup(CreatorCollector.java:353)
at [email protected]/com.fasterxml.jackson.databind.deser.impl.CreatorCollector.addPropertyCreator(CreatorCollector.java:177)
at [email protected]/com.fasterxml.jackson.databind.deser.BasicDeserializerFactory._addSelectedPropertiesBasedCreator(BasicDeserializerFactory.java:542)
at [email protected]/com.fasterxml.jackson.databind.deser.BasicDeserializerFactory._constructDefaultValueInstantiator(BasicDeserializerFactory.java:259)
at [email protected]/com.fasterxml.jackson.databind.deser.BasicDeserializerFactory.findValueInstantiator(BasicDeserializerFactory.java:209)
at [email protected]/com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.buildBeanDeserializer(BeanDeserializerFactory.java:263)
... 20 common frames omitted
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make public org.cryptomator.linux.update.FlatpakUpdater$AppstreamResponse(java.util.List) accessible: module org.cryptomator.integrations.linux does not "exports org.cryptomator.linux.update" to module com.fasterxml.jackson.databind
at java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(Unknown Source)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
at java.base/java.lang.reflect.Constructor.checkCanSetAccessible(Unknown Source)
at java.base/java.lang.reflect.Constructor.setAccessible(Unknown Source)
at [email protected]/com.fasterxml.jackson.databind.util.ClassUtil.checkAndFixAccess(ClassUtil.java:1039)
... 27 common frames omittedI'll add a commit that fixes that there as well. However, on testing, I noticed for the Flatpaked app, that, after a successful update via the new mechanism and after downgrading the installed Cryptomator version manually with Warehouse again, it falls back to the "Download from web page" update offer and does not offer the Flatpak update any more. This seems acceptable, as nobody will do this in real life. Nevertheless, I wanted to point that out and will look into it. |
Thank you!
That is expected as only the current HEAD knows the new mechanism. |
Flatpak offers a way to check for updates of an app on Flathub and even more: the running app can be updated in the background to the newest version and this version can be spawned/started.
This PR implements all this, based on the triggering an external update mechanism.
Some notes on the design:
integrations-apihas been widened further than suggested in Trigger External Update Mechanism #3740. This is due to some cool features being available via the Flatpak portal, that come in handy for other autoupdate features for other distribution channels or platforms to come and therefore were added to the APIbuildNumberDepends on
cryptomator/integrations-api#62cryptomator/integrations-api#72, cryptomator/integrations-linux#117 and flathub/org.cryptomator.Cryptomator#128.See it in Action:
Screencast.mov
Test it yourself:
An otherwise unchanged Cryptomator 1.17.1 was taken, and repackaged as 1.17.0, including the autoupdate functionality mentioned above. This made it possible to deploy it twice as 1.17.0 and 1.17.1 to a Flatpak testing hub.
I recommend Warehouse to easily manage your Flatpak repositories and app versions.
Visit https://flatter.purejava.org/ and install the repo as "system install".


It contains the two versions of Cryptomator. [1] When installing Cryptomator, the latest version gets installed. Downgrade it to the version before to have the opportunity to test the autoupdate functionality.



Right after the downgrade, an app gets masked, as Flatpak names it, which disables updates for an app. Unmask the app/enable updates again and start the app.
In case a Warehouse operation fails, make sure, that the operation was executed on a currenrt cache. Refreshing the Warehouse cache solves the issue.
[1] at least for a week. GitHub deletes actions caches after seven days and currently this cannot be configured