History log of /libcore/luni/src/test/java/libcore/java/util/zip/ZipInputStreamTest.java
Revision Date Author Comments
27604018f783bf6354a13870b3e7785edca69b5f 28-Sep-2016 Paul Duffin <paulduffin@google.com> Detect and fix resource leakages in tests

Tests that test those classes that use CloseGuard to detect
reosurce leakages are switched to use TestCaseWithRules and
ResourceLeakageDetector.getRule() to detect any resource
leakages and the leaks fixed.

A number of tests could not be fixed due to bugs in the core
classes so a new DisableResourceLeakageDetection annotation was
added as part of this change. A method annotated with that does
not perform resource leakage detection. The affected tests were
annotated with a description and a reference to an associated
bug.

This uses try-with-resources to aid in closing resources. While
that does provide some benefits it is all too easy to change the
behavior of the test unless care is taken. To avoid that it is
important not to merge it with an existing try block such as
those which follow the following pattern:
try {... fail()} catch(..) {}
Merging them could result in the test catching and ignoring
exceptions thrown during the creation of the resource which is
almost certainly not what the test was intending.

Test: Tested with vogar and CTS
Bug: 31542223
Change-Id: Id32bb40fe04eb9719d7e6cd367abb53118b21832
68c863dd3854d96c8cd5cc53b71c4d93037fb09d 22-Mar-2016 Narayan Kamath <narayan@google.com> ZipInputStreamTest: Add test cases for #available.

Documents differences between M and N.

bug: 27476977
Change-Id: I08f77966bc94efe8faf8c87e87429cc4e6483a62
28e3dec0da4a2dd9852fa05120273d1e2271f05f 24-Jun-2015 Narayan Kamath <narayan@google.com> InflaterInputStream : deflated streams are self limiting.

We call fill() whenever the Inflater needs more input. If the inflater
needs more input, reaching the end of the underlying stream is an error
that must be propagated to the caller.

bug: 21846904
Change-Id: If46cf7837df3a509b20fea8819e09f9a597905a5
0aff1dd0b4be1b8d8cb45b59079ca883a1b3205a 17-Jun-2014 Elliott Hughes <enh@google.com> Remove.

(cherry-pick of 63744c884dd4b4f4307f2b021fb894af164972af.)

Change-Id: Ibf79a402e1bad98a262e380fcee3d35c127ae6d5
63744c884dd4b4f4307f2b021fb894af164972af 17-Jun-2014 Elliott Hughes <enh@google.com> Remove.

Change-Id: Ibf79a402e1bad98a262e380fcee3d35c127ae6d5
e3d756c5dae1af2aa5f0ad8bc7f133df3e7401eb 11-Mar-2014 Neil Fuller <nfuller@google.com> Add Java 1.7 APIs: ZipFile, ZipInputStream, ZipOutputStream

Add constructor support for the character encoding to use.

When reading a ZipFile this is used for the file comment and for
entry names and comments when a zip entry is not self-described
as UTF-8 encoded.

When writing a zip file the character encoding determines the
encoding used for the file comment, entry names and comments.

The default for reading and writing when the character encoding
is not specified remains as UTF-8.

Additional fix:
ZipOutputStream: null comments no longer cause NullPointerException.

Change-Id: I7cadfa939377d0f87fd5503dae2a0b2dbac2ba39
ef164bf196538c04f499dcbb49a389c70ff5601a 26-Feb-2014 Paul Duffin <paulduffin@google.com> Improve error message when attempting to open an empty zip

The bug report states that the behaviour of ZipFile has changed between 4.3 and
4.4 when opening an empty zip file. I did some investigation and it appears as
though the reference implementation also throws an exception in that case so I
decided that 4.4 is working as designed. However, to make it clearer I made a
minor change to explicitly check for an empty zip file so that we can report a
slightly improved message explaining that they are not supported. I added a
test for various forms of empty streams and zip files and removed part of an
older test from harmony tests as it is no longer necessary.

Bug: https://code.google.com/p/android/issues/detail?id=65380
Change-Id: I1f2fcbf6bbaedb7dbccf8dd4f1cec4e330274524
55e276b6718282224e0069645da2222beda7b8df 11-Nov-2010 Elliott Hughes <enh@google.com> Tests that would have caught my recent ZipInputStream/ZipOutputStream regressions.

Not the best tests in the world, but they would have been sufficient.

Bug: 3181430
Change-Id: Id68f5bb6a2c66f9f5c8c061b34dfeb5d3d63e63e