8223597: jdk/nio/zipfs/ZipFSTester.java RuntimeException: CHECK_FAILED! (getAttribute.crc <entries20> failed 6af4413c vs 0 ...)

Reviewed-by: redestad, lancea
This commit is contained in:
Christoph Langer 2019-05-14 09:25:58 +01:00
parent 44e7959bb8
commit e6b1cd1d4b
2 changed files with 11 additions and 3 deletions

View File

@ -1211,7 +1211,7 @@ class ZipFileSystem extends FileSystem {
return 0;
long written = 0;
if (e.crc != 0 && e.csize > 0) {
if (e.csize > 0 && (e.crc != 0 || e.size == 0)) {
// pre-compressed entry, write directly to output stream
writeTo(e, os);
} else {

View File

@ -228,7 +228,7 @@ public class ZipFSTester {
Files.newInputStream(parent);
throw new RuntimeException("Failed");
} catch (FileSystemException e) {
e.printStackTrace(); // expected fse
// expected fse
}
// rmdirs
@ -420,7 +420,15 @@ public class ZipFSTester {
static Object[][] getEntries() {
Object[][] entries = new Object[10 + rdm.nextInt(20)][3];
for (int i = 0; i < entries.length; i++) {
// first entries shall test the corner case of 0 bytes of data
entries[0][0] = "entries" + 0;
entries[0][1] = METHOD_STORED;
entries[0][2] = new byte[0];
entries[1][0] = "entries" + 1;
entries[1][1] = METHOD_DEFLATED;
entries[1][2] = new byte[0];
// the rest is random data
for (int i = 2; i < entries.length; i++) {
entries[i][0] = "entries" + i;
entries[i][1] = rdm.nextInt(10) % 2 == 0 ?
METHOD_STORED : METHOD_DEFLATED;