ysn2233
V2EX  ›  Java

使用 Ibm 的 jdk11(semeru)在 wsl2 中读取 jar 文件会报 libzip 的 CRC32 校验错误

  •  
  •   ysn2233 · Apr 2, 2022 · 1960 views
    This topic created in 1506 days ago, the information mentioned may be changed or developed.

    我在调试某个大型开源项目的时候偶然碰到这个问题,使用 openjdk11 ,或者 Amazon 的都没这个问题,在宿主机 windows host 里用 ibm 的 jdk 也没问题,只有在 wsl2 中用 ibm 的 jdk 产生了这个问题。我调试后发现似乎是某一次 native 方法的 Updatebytes0 返回的结果不同,但想不明白为什么。虽然是个小问题不影响什么但还是想探究一下原因,有没有大佬有点什么思路?有 wsl2 的朋友有空的话也可以帮忙试一下是不是只有我自己有这个问题,测试代码如下,路径应该随便一个 jar 包都可以。

     	File file = new 				File("/home/xxx/.m2/repository/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar");
            final InputStream input = file.toURI().toURL().openStream();
            final ZipInputStream zipInput = new ZipInputStream(input);
    
            ZipEntry entry;
            while ((entry = zipInput.getNextEntry()) != null) {
                if (!entry.isDirectory()) {
                    final String name = entry.getName();
                    System.out.println(name);
                }
            }
    
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2957 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 05:31 · PVG 13:31 · LAX 22:31 · JFK 01:31
    ♥ Do have faith in what you're doing.