test/jdk/jdk/nio/zipfs/CRCWriteTest.java
author lancea
Thu, 14 Nov 2019 10:54:32 -0500
changeset 59083 3e4d8b5856f3
parent 58822 9d95d8a8b750
permissions -rw-r--r--
8234080: jdk/nio/zipfs/CRCWriteTest.java fails Reviewed-by: clanger, amlu
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
58822
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
     1
/*
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
     2
 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
     4
 *
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
     7
 * published by the Free Software Foundation.
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
     8
 *
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    13
 * accompanied this code).
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    14
 *
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    18
 *
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    21
 * questions.
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    22
 *
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    23
 */
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    24
import org.testng.annotations.Test;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    25
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    26
import java.io.FileInputStream;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    27
import java.io.IOException;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    28
import java.io.InputStream;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    29
import java.io.OutputStream;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    30
import java.nio.charset.StandardCharsets;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    31
import java.nio.file.FileSystem;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    32
import java.nio.file.FileSystems;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    33
import java.nio.file.Files;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    34
import java.nio.file.Path;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    35
import java.util.Arrays;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    36
import java.util.Map;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    37
import java.util.zip.ZipEntry;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    38
import java.util.zip.ZipFile;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    39
import java.util.zip.ZipInputStream;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    40
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    41
import static org.testng.Assert.*;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    42
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    43
/**
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    44
 * @test
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    45
 * @bug 8232879
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    46
 * @summary Test OutputStream::write with Zip FS
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    47
 * @modules jdk.zipfs
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    48
 * @run testng/othervm CRCWriteTest
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    49
 */
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    50
public class CRCWriteTest {
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    51
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    52
    // Jar File path used by the test
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    53
    private final Path JAR_FILE = Path.of("CRCWrite.jar");
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    54
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    55
    /**
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    56
     * Validate that an OutputStream obtained for the Zip FileSystem
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    57
     * can be used successfully with the OutputStream write methods
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    58
     */
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    59
    @Test
59083
3e4d8b5856f3 8234080: jdk/nio/zipfs/CRCWriteTest.java fails
lancea
parents: 58822
diff changeset
    60
    public void zipFsOsDeflatedWriteTest() throws Exception {
58822
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    61
        Files.deleteIfExists(JAR_FILE);
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    62
        String[] msg = {"Hello ", "Tennis Anyone", "!!!!"};
59083
3e4d8b5856f3 8234080: jdk/nio/zipfs/CRCWriteTest.java fails
lancea
parents: 58822
diff changeset
    63
        Entry e0 = Entry.of("Entry-0", ZipEntry.DEFLATED, String.join("",msg));
58822
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    64
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    65
        try (FileSystem zipfs = FileSystems.newFileSystem(JAR_FILE,
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    66
                Map.of("create", "true"))) {
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    67
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    68
            // Write to the Jar file using the various OutputStream write methods
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    69
            try (OutputStream os = Files.newOutputStream(zipfs.getPath(e0.name))) {
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    70
                for (byte b : msg[0].getBytes(StandardCharsets.UTF_8)) {
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    71
                    os.write(b);
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    72
                }
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    73
                os.write(msg[1].getBytes(StandardCharsets.UTF_8));
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    74
                os.write(msg[2].getBytes(StandardCharsets.UTF_8), 0, msg[2].length());
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    75
            }
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    76
        }
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    77
        verify(JAR_FILE, e0);
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    78
    }
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    79
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    80
    /**
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    81
     * Represents an entry in a Zip file. An entry encapsulates a name, a
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    82
     * compression method, and its contents/data.
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    83
     */
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    84
    static class Entry {
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    85
        private final String name;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    86
        private final int method;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    87
        private final byte[] bytes;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    88
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    89
        Entry(String name, int method, String contents) {
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    90
            this.name = name;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    91
            this.method = method;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    92
            this.bytes = contents.getBytes(StandardCharsets.UTF_8);
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    93
        }
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    94
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    95
        static Entry of(String name, int method, String contents) {
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    96
            return new Entry(name, method, contents);
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    97
        }
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    98
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
    99
        /**
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   100
         * Returns a new Entry with the same name and compression method as this
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   101
         * Entry but with the given content.
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   102
         */
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   103
        Entry content(String contents) {
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   104
            return new Entry(name, method, contents);
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   105
        }
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   106
    }
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   107
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   108
    /**
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   109
     * Verify that the given path is a Zip file containing exactly the
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   110
     * given entries.
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   111
     */
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   112
    private static void verify(Path zipfile, Entry... entries) throws IOException {
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   113
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   114
        // check entries with ZipFile API
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   115
        try (ZipFile zf = new ZipFile(zipfile.toFile())) {
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   116
            // check entry count
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   117
            assertEquals(entries.length, zf.size());
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   118
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   119
            // Check compression method and content of each entry
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   120
            for (Entry e : entries) {
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   121
                ZipEntry ze = zf.getEntry(e.name);
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   122
                assertNotNull(ze);
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   123
                assertEquals(e.method, ze.getMethod());
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   124
                try (InputStream in = zf.getInputStream(ze)) {
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   125
                    byte[] bytes = in.readAllBytes();
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   126
                    assertTrue(Arrays.equals(bytes, e.bytes));
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   127
                }
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   128
            }
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   129
        }
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   130
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   131
        // Check entries using ZipInputStream
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   132
        for (Entry e : entries) {
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   133
            try (ZipInputStream zis =
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   134
                         new ZipInputStream(new FileInputStream(zipfile.toFile()))) {
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   135
                ZipEntry ze;
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   136
                while ((ze = zis.getNextEntry()) != null) {
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   137
                    assertEquals(e.method, ze.getMethod());
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   138
                    byte[] bytes = zis.readAllBytes();
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   139
                    assertTrue(Arrays.equals(bytes, e.bytes));
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   140
                }
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   141
            }
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   142
        }
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   143
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   144
        // Check entries with FileSystem API
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   145
        try (FileSystem fs = FileSystems.newFileSystem(zipfile)) {
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   146
            // check entry count
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   147
            Path top = fs.getPath("/");
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   148
            long count = Files.find(top, Integer.MAX_VALUE,
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   149
                    (path, attrs) -> attrs.isRegularFile()).count();
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   150
            assertEquals(entries.length, count);
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   151
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   152
            // check content of each entry
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   153
            for (Entry e : entries) {
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   154
                Path file = fs.getPath(e.name);
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   155
                byte[] bytes = Files.readAllBytes(file);
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   156
                assertTrue(Arrays.equals(bytes, e.bytes));
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   157
            }
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   158
        }
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   159
    }
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   160
}
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   161
9d95d8a8b750 8232879: Writing out data with the Zip File System leads to a CRC failure
lancea
parents:
diff changeset
   162