Repository navigation
Keep Maven revision context menu with strict checksums - #7523
Merged
Merged
Conversation
With checksumPolicy=strict the Repositories view lost every action of a Maven revision (Refresh Cache, Clear from Cache, Delete from Index, Add Compile/Runtime Dependencies, Update to, Add Sources and the Maven clipboard entries) once the sources jar had been cached. Only the view's own "Copy bsn+version" and "Copy info" remained. Why: RepoActionsUtil.addSources probes the sources jar with MavenRepository.get(), which calls toLocalFile() and thereby the trusted checksum check synchronously. A cached sources jar has no entry in the checksum file, so strict mode throws a TrustedChecksumException instead of failing the promise. The exception escaped getRevisionActions() and RepositoryBundleVersion.actions() swallowed it, dropping the whole menu. The first menu opening still worked because the file was not cached yet. Fix: treat a lookup that throws like a failed promise, so only the "Add Sources" entry is disabled. This covers MavenBndRepository and BndPomRepository, which share the helper. Tests: RepoActionsUtilTest, and MavenRepositoryContextMenuSwtbotTest which checks the context menu entries of a Maven repository, bundle and revision in the Repositories view for a lenient and a strict repository. The assertions tolerate the online content of Maven Central, and the test is skipped when Maven Central is unreachable. Before the fix the strict test failed on the second menu opening; afterwards the SWTBot suite passes (35 tests, 4 perf tests skipped, no failures). Signed-off-by: peterkir <peter@klib.io>
peterkir
added a commit
that referenced
this pull request
Nov 9, 2026
Keep Maven revision context menu with strict checksums
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With checksumPolicy=strict the Repositories view lost every action of a
Maven revision (Refresh Cache, Clear from Cache, Delete from Index, Add
Compile/Runtime Dependencies, Update to, Add Sources and the Maven
clipboard entries) once the sources jar had been cached. Only the view's
own "Copy bsn+version" and "Copy info" remained.
Why: RepoActionsUtil.addSources probes the sources jar with
MavenRepository.get(), which calls toLocalFile() and thereby the trusted
checksum check synchronously. A cached sources jar has no entry in the
checksum file, so strict mode throws a TrustedChecksumException instead
of failing the promise. The exception escaped getRevisionActions() and
RepositoryBundleVersion.actions() swallowed it, dropping the whole menu.
The first menu opening still worked because the file was not cached yet.
Fix: treat a lookup that throws like a failed promise, so only the
"Add Sources" entry is disabled. This covers MavenBndRepository and
BndPomRepository, which share the helper.
Tests: RepoActionsUtilTest, and MavenRepositoryContextMenuSwtbotTest which
checks the context menu entries of a Maven repository, bundle and
revision in the Repositories view for a lenient and a strict repository.
The assertions tolerate the online content of Maven Central, and the test
is skipped when Maven Central is unreachable. Before the fix the strict
test failed on the second menu opening; afterwards the SWTBot suite
passes (35 tests, 4 perf tests skipped, no failures).