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 nested JAR files read error #3981
Describe the bug
When processing a JAR package, the code fails to correctly handle nested JAR files. Specifically, when the packageURL is a nested JAR URL, the jarFileName is incorrectly decoded, leading to a failure in creating the JarFile object.
Here is the problematic code:
private static void processJarPackage(URL packageURL, String packageName, String pkg, ArrayList<String> names) throws IOException {
String jarFileName = URLDecoder.decode(packageURL.getFile(), "UTF-8");
JarFile jf = null;
// jar: client in repository; nested: client in a fat jar
if (jarFileName.startsWith("jar:") || jarFileName.startsWith("nested:")) {
jf = ((JarURLConnection) packageURL.openConnection()).getJarFile();
}
// file: client is a file in target (unit test)
if (jarFileName.startsWith("file:") ) {
jarFileName = jarFileName.substring(5, jarFileName.indexOf("!"));
jf = new JarFile(jarFileName);
}
if (jf == null) {
logger.error("Loading classes from jar with error packageURL: {}", jarFileName);
return;
}
logger.info("Loading classes from jar {}", jarFileName);
Enumeration<JarEntry> jarEntries = jf.entries();
while (jarEntries.hasMoreElements()) {
processJarEntry(jarEntries.nextElement(), packageName, pkg, names);
}
jf.close();
}
For example, given the following URL:
Url packageURL = new Url("jar:file:/app/app.jar!/BOOT-INF/lib/java-client.jar!/io.kubenrnetes.client.openapi.models.V1Job");
String jarFileName = URLDecoder.decode(packageURL.getFile(), "UTF-8");
The jarFileName will be decoded as:
”file:/app/app.jar!/BOOT-INF/lib/java-client.jar!/io.kubenrnetes.openapi.models.V1Job”
This causes the JarFile to fail to initialize.
Proposed Fix:
Change:
String jarFileName = URLDecoder.decode(packageURL.getFile(), "UTF-8");
to:
String jarFileName = URLDecoder.decode(packageURL.toString(), "UTF-8");
Client Version
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
Activity
brendandburns commentedon Mar 19, 2025
What is the exception that you are seeing?
lmxsoft commentedon Mar 19, 2025
fulizhe commentedon May 20, 2025
“jar:nested:/D:/xxxxxx/backend/target/api.jar/!BOOT-INF/lib/client-java-api-19.0.1.jar!/io/kubernetes/client/openapi/models” will be same problem。
lmxsoft commentedon May 20, 2025
k8s-triage-robot commentedon Aug 18, 2025
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
lifecycle/staleis appliedlifecycle/stalewas applied,lifecycle/rottenis appliedlifecycle/rottenwas applied, the issue is closedYou can:
/remove-lifecycle stale/closePlease send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
lmxsoft commentedon Aug 18, 2025
k8s-triage-robot commentedon Sep 17, 2025
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
lifecycle/staleis appliedlifecycle/stalewas applied,lifecycle/rottenis appliedlifecycle/rottenwas applied, the issue is closedYou can:
/remove-lifecycle rotten/closePlease send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
lmxsoft commentedon Sep 17, 2025
k8s-triage-robot commentedon Oct 17, 2025
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
lifecycle/staleis appliedlifecycle/stalewas applied,lifecycle/rottenis appliedlifecycle/rottenwas applied, the issue is closedYou can:
/reopen/remove-lifecycle rottenPlease send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
k8s-ci-robot commentedon Oct 17, 2025
@k8s-triage-robot: Closing this issue, marking it as "Not Planned".
Details
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
lmxsoft commentedon Oct 17, 2025