镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Keep Maven revision context menu with strict checksums - #7523

Merged
peterkir merged 1 commit into
bndtools:masterfrom
peterkir:fix-maven-repo-menu
Nov 9, 2026
Merged

peterkir merged 1 commit into
bndtools:masterfrom
peterkir:fix-maven-repo-menu

Conversation

@peterkir

@peterkir peterkir commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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).

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
peterkir merged commit bf128b0 into bndtools:master Nov 9, 2026
16 of 19 checks passed
peterkir added a commit that referenced this pull request Nov 9, 2026
Keep Maven revision context menu with strict checksums
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant