sofastack / sofa-ark

SOFAArk is a light-weight,java based classloader isolation framework.
https://www.sofastack.tech/projects/sofa-boot/sofa-ark-readme/
Apache License 2.0
1.57k stars 500 forks source link

Jar中jar中jar,解析ArtifactId失败 #655

Closed AiWu4Damon closed 1 year ago

AiWu4Damon commented 1 year ago

Describe the bug

以java -jar启动 当解析的jar包是 jar中jar中jar时报错 方法:com.alipay.sofa.ark.loader.jar.JarUtils#parseArtifactId

入参:/Users/xx/IdeaProjects/app/app-starter/target/app-starter-1.0.0-SNAPSHOT.jar!/BOOT-INF/lib/app2-starter-1.0.0-ark-biz.jar!/lib/app3-client-220630-cube.jar!/

Expected behavior

希望可以正确解析出ArtifactId = app3-client

Actual behavior

报错File must exist

Steps to reproduce

以java-jar启动项目 方法:com.alipay.sofa.ark.loader.jar.JarUtils#parseArtifactId 入参:/Users/xx/IdeaProjects/app/app-starter/target/app-starter-1.0.0-SNAPSHOT.jar!/BOOT-INF/lib/app2-starter-1.0.0-ark-biz.jar!/lib/app3-client-220630-cube.jar!/ 会委托给com.alipay.sofa.ark.loader.jar.JarUtils#parseArtifactIdFromJarInJar方法加载,rootPath=/Users/xx/IdeaProjects/app/app-starter/target/app-starter-1.0.0-SNAPSHOT.jar!/BOOT-INF/lib/app2-starter-1.0.0-ark-biz.jar 但是rootPath的路径其实是个jar中jar,com.alipay.sofa.ark.loader.data.RandomAccessDataFile#RandomAccessDataFile(java.io.File, int)中报错File must exist

Minimal yet complete reproducer code (or GitHub URL to code)

Environment

lylingzhen commented 1 year ago

@AiWu4Damon @lvjing2 这个 Bug 是正在修复是吗?还在调整 MR 的单测?

AiWu4Damon commented 1 year ago

https://github.com/sofastack/sofa-ark/pull/664 调整了解法

lylingzhen commented 1 year ago

PR was merged. Close this issue.