Skip to content

Fix ModelMapper.processJarPackage breaking on paths containing '+'#4712

Merged
k8s-ci-robot merged 2 commits into
masterfrom
copilot/fix-modelmapper-jar-package-issue
May 1, 2026
Merged

Fix ModelMapper.processJarPackage breaking on paths containing '+'#4712
k8s-ci-robot merged 2 commits into
masterfrom
copilot/fix-modelmapper-jar-package-issue

Conversation

Copilot AI commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

ModelMapper.processJarPackage used URLDecoder.decode to extract the JAR file path from a file: URL. URLDecoder follows application/x-www-form-urlencoded semantics where + → space, corrupting paths with literal + characters. This causes initModelMap() to fail silently, leaving the prebuilt model map empty. Manifests in Bazel 8 environments where canonical repo names use + (e.g., rules_jvm_external++maven+maven/...client-java-api-26.0.0.jar).

Changes

  • Replace URLDecoder.decode with URI.create(...).getPath() for the file: JAR path case. URI.getPath() correctly decodes %XX sequences but treats + as a literal character — correct URL semantics.
  • Remove raw packageURL.getFile() post-processing for jar:/nested: cases — these already went through JarURLConnection and were unaffected.
  • Add guard for missing ! separator in the file: URL before calling substring.
  • Remove now-unused imports URLDecoder and StandardCharsets.
// Before: + in path → converted to space → JarFile(...) fails
String jarFileName = URLDecoder.decode(packageURL.getFile(), StandardCharsets.UTF_8);
jarFileName = jarFileName.substring(5, jarFileName.indexOf("!"));
jf = new JarFile(jarFileName);

// After: + preserved, %20 still decoded correctly
int bangIndex = jarFileName.indexOf("!");
String filePart = jarFileName.substring(0, bangIndex);
jf = new JarFile(URI.create(filePart).getPath());

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 22, 2026
Copilot AI linked an issue Apr 22, 2026 that may be closed by this pull request
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 22, 2026
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Apr 22, 2026
Copilot AI changed the title [WIP] Fix ModelMapper.processJarPackage to handle '+' in paths Fix ModelMapper.processJarPackage breaking on paths containing '+' Apr 22, 2026
Copilot AI requested a review from brendandburns April 22, 2026 20:33
@brendandburns brendandburns marked this pull request as ready for review May 1, 2026 14:52
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 1, 2026
@k8s-ci-robot k8s-ci-robot requested a review from yue9944882 May 1, 2026 14:52
@brendandburns

Copy link
Copy Markdown
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 1, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, Copilot

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 1, 2026
@k8s-ci-robot k8s-ci-robot merged commit cafa7a7 into master May 1, 2026
18 checks passed
k8s-ci-robot added a commit that referenced this pull request May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ModelMapper.processJarPackage breaks on paths containing '+'

3 participants