Invalid Entry Compressed Size

北城余情 提交于 2019-12-05 07:03:33

The problematic line is this:

JarEntry je = new JarEntry(jarEntry);

as it will also copy the compressed size.

Unless you care about preserving other fields than name, you should use this constructor and provide only the file name, as this:

JarEntry je = new JarEntry(jarEntry.getName ());

The compressed size will be then automatically computed.

doing in this way it will not copy Jar Attributes and other meta information. The issue is caused when the jar/zip file is modified after it is initially packaged.

You can do this:

JarEntry je = new JarEntry(jarEntry);
je.setCompressedSize(-1);

This will cause the size of entry to be recalculated and you'll get copied all other attributes from the original jarEntry

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!