You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ModelMapper.processJarPackage breaks on paths containing '+' #4710
Which seems to indicate that the file is in fact a URL, which means that we should decode it, and the right solution would be for the + to be URL encoded before it is passed into the function.
Where are you getting your paths with + from? can you send an example?
I guess, I'm wondering if the + should be encoded when the Jar URL is created. If the Java docs I cited above are correct, it seems that the text after "jar:" is a URL, and thus if the + is in the file name, it should be URL encoded before the URL is created.
Again, not trying to pass the buck on fixing this, but trying to understand what the actual "right" answer is here.
The syntax of URL is defined by RFC 2396: Uniform Resource Identifiers (URI): Generic Syntax, amended by RFC 2732: Format for Literal IPv6 Addresses in URLs.
...
Note, the URI class does perform escaping of its component fields in certain circumstances.
The URL class does not itself encode or decode any URL components according to the escaping mechanism defined in RFC2396.
The URLEncoder and URLDecoder classes can also be used, but only for HTML form encoding, which is not the same as the encoding scheme defined in RFC2396.
From that, I understand that:
In a URL path, + means a literal plus sign: RFC 3986
In application/x-www-form-urlencoded data, + means a space: WHATWG
And since we’re talking about paths here, not HTML form data, I think URLDecoder may not be the right tool for this case.
@laureanobrs thanks for the additional details, I merged #4712 that should fix this. If this is important to you, please file a cherry-pick PR into the release branch and we can cut a new library version.
If it's not important, we'll pick this up in the next major library release (roughly timed to k8s release cycles)
Activity
laureanobrs commentedon Apr 20, 2026
One possible minimal-delta fix could be to encode the
+ahead of time:String jarFileName = URLDecoder.decode(packageURL.getFile().replace("+", "%2B"), StandardCharsets.UTF_8);brendandburns commentedon Apr 25, 2026
I'm trying to find the specification for a jar file reference, the best I have found is this:
https://docs.oracle.com/javase/8/docs/api/java/net/JarURLConnection.html
Which seems to indicate that the file is in fact a URL, which means that we should decode it, and the right solution would be for the
+to be URL encoded before it is passed into the function.Where are you getting your paths with
+from? can you send an example?laureanobrs commentedon Apr 29, 2026
Hi Brendan, thanks for your reply. Here’s a minimal reproduction with Bazel:
Bazel project Setup
File
.bazelversionFile
MODULE.bazelFile
BUILD.bazelRun
bazel mod deps --lockfile_mode=update && bazel run @maven//:pin && bazel build //...Path containing the + symbol
Run
find bazel-out/ | grep "processed_client-java-26.0.0.jar"(Note the plus signs in rules_jvm_external++maven+maven.)
That is the jar file that ModelMapper tries to load in the project I’m working on.
brendandburns commentedon Apr 30, 2026
I guess, I'm wondering if the + should be encoded when the Jar URL is created. If the Java docs I cited above are correct, it seems that the text after "jar:" is a URL, and thus if the + is in the file name, it should be URL encoded before the URL is created.
Again, not trying to pass the buck on fixing this, but trying to understand what the actual "right" answer is here.
laureanobrs commentedon Apr 30, 2026
It makes sense to clarify this.
According to Java’s URLDecoder documentation:
And Java’s URL documentation:
From that, I understand that:
+means a literal plus sign: RFC 3986+means a space: WHATWGAnd since we’re talking about paths here, not HTML form data, I think
URLDecodermay not be the right tool for this case.Also, there’s a bug in the OpenJDK bug system (closed as “Not an Issue”) that I think is related to this:
https://bugs.openjdk.org/browse/JDK-8179507
brendandburns commentedon May 1, 2026
@laureanobrs thanks for the additional details, I merged #4712 that should fix this. If this is important to you, please file a cherry-pick PR into the release branch and we can cut a new library version.
If it's not important, we'll pick this up in the next major library release (roughly timed to k8s release cycles)
laureanobrs commentedon May 5, 2026
@brendandburns Thanks! I opened PR #4737 to cut a new release with the fix.