/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 4879507
* @summary ZipInputStream does not check CRC for stored (uncompressed) files
* @author Dave Bristor
*/
public class StoredCRC {
// Run with an arg to create a test file that can be used to figure
// out what position in the data stream can be changed.
} else {
// Test that reading byte-at-a-time works
new ByteArrayInputStream(data));
int pos = 0;
byte[] readData = new byte[256];
try {
while (count > 0) {
}
} catch (Throwable t) {
unexpected(t);
}
// Test that data corruption is detected. Offset 39 was
// determined to be in the entry's uncompressed data.
zis = new ZipInputStream(
new ByteArrayInputStream(data));
try {
fail("Did not catch expected ZipException" );
} catch (ZipException ex) {
} catch (Throwable t) {
unexpected(t);
}
}
}
//--------------------- Infrastructure ---------------------------
else return fail(x + " not equal to " + y);}
}