[alibaba/arthas]JAD 反编译出来的代码异常

2025-11-12 554 views
8
[x] 我已经在 issues 里搜索,没有重复的issue。 环境信息 arthas-boot.jar 或者 as.sh 的版本: xxx Arthas 版本: 3.6.6 操作系统版本: docker ubuntu latest 目标进程的JVM版本: jdk11 执行arthas-boot的版本: jdk11 重现问题的步骤 jad反编译代码 期望的结果

What do you expected from the above steps?

   public static void decompress(byte[] content, String destPath) throws IOException {
        if (content == null || content.length == 0) {
            return;
        }
        ByteArrayInputStream inputStream = new ByteArrayInputStream(content);
        ZipInputStream zipInputStream = new ZipInputStream(inputStream);
        ZipEntry zipEntry;
        while ((zipEntry = zipInputStream.getNextEntry()) != null) {
            if (zipEntry.isDirectory()) {
                //若是目录
                File file = new File(destPath + "/" + zipEntry.getName());
                if (!file.exists()) {
                    if (!file.mkdirs()) {
                        log.debug("目录创建失败," + destPath + "/" + zipEntry.getName());
                    }
                }
            } else {
                //若是文件
                File file = createFile(destPath, zipEntry.getName());
                try (OutputStream os = new FileOutputStream(file)) {
                    byte[] buffer = new byte[1024];
                    int readLength;
                    while ((readLength = zipInputStream.read(buffer, 0, 1024)) >= 0) {
                        os.write(buffer, 0, readLength);
                    }
                    //log.info("解压文件 " + destPath + "/" + zipEntry.getName());
                    os.flush();
                }
            }
        }
        zipInputStream.close();
        inputStream.close();
    }
实际运行的结果

实际运行结果,最好有详细的日志,异常栈。尽量贴文本。

           public static void decompress(byte[] byArray, String string) throws IOException {
               ZipEntry zipEntry;
               byte[] content;
/*28*/         if (content == null || content.length == 0) {
/*29*/             return;
               }
               ByteArrayInputStream inputStream = new ByteArrayInputStream(content);
               ZipInputStream zipInputStream = new ZipInputStream(inputStream);
/*34*/         while ((zipEntry = zipInputStream.getNextEntry()) != null) {
                   File file;
                   void destPath;
/*35*/             if (zipEntry.isDirectory()) {
                       file = new File((String)destPath + "/" + zipEntry.getName());
/*38*/                 if (file.exists() || file.mkdirs()) continue;
/*40*/                 log.debug("目录创建失败," + (String)destPath + "/" + zipEntry.getName());
/*43*/                 continue;
                   }
/*45*/             file = FileZipUtil.createFile((String)destPath, zipEntry.getName());
                   try (FileOutputStream os = new FileOutputStream(file);){
                       byte[] buffer;
                       int readLength;
/*47*/                 AllocationCallee.__ejt_array_alloc((Object)new byte[1024], (int)1);
/*49*/                 while ((readLength = zipInputStream.read(buffer, 0, 1024)) >= 0) {
/*50*/                     ((OutputStream)os).write(buffer, 0, readLength);
                       }
/*53*/                 os.flush();
                   }
               }
/*57*/         zipInputStream.close();
/*58*/         inputStream.close();
           }

把异常信息贴到这里

入参destPath信息丢失 解析异常 入参的时候没解析到参数名  导致代码块里解析不到变量类型 变成了void

回答

6

顺便问个小问题

类中使用@Slf4j 导致mc的时候 找不到这个LogFactory类(好像是这个名字)怎么办?

1

jad本身不保证都能成功,看wiki的说明。另外,mc不支持 lombok。