Author: bodewig Date: Sat May 25 14:52:38 2013 New Revision: 1486333 URL: http://svn.apache.org/r1486333 Log: Use example archive from COMPRESS-227 in test rather than creating a new one
Added: commons/proper/compress/trunk/src/test/resources/COMPRESS-227.zip (with props) Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java?rev=1486333&r1=1486332&r2=1486333&view=diff ============================================================================== --- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java (original) +++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java Sat May 25 14:52:38 2013 @@ -204,46 +204,16 @@ public class ZipFileTest extends TestCas } } + /** + * @see https://issues.apache.org/jira/browse/COMPRESS-227 + */ public void testDuplicateEntry() throws Exception { - File f = File.createTempFile("commons-compress-zipfiletest", ".zip"); - f.deleteOnExit(); - File f2 = File.createTempFile("commons-compress-zipfiletest", ".txt"); - f2.deleteOnExit(); - - OutputStream o = null; - try { - o = new FileOutputStream(f); - ZipArchiveOutputStream zo = new ZipArchiveOutputStream(o); - // simple way to ensure entries have extra data - zo.setUseZip64(Zip64Mode.Always); - - // add the same file twice - ZipArchiveEntry ze = new ZipArchiveEntry(f2, "foo"); - zo.putArchiveEntry(ze); - zo.write(new byte[0]); - zo.closeArchiveEntry(); - ze = new ZipArchiveEntry(f2, "foo"); - zo.putArchiveEntry(ze); - zo.write(new byte[0]); - zo.closeArchiveEntry(); - zo.close(); - - o.close(); - o = null; + File archive = getFile("COMPRESS-227.zip"); + zf = new ZipFile(archive); - System.err.println("-------------------vvvvvvvvvvvvvvvvvvvvvvv-----------"); - zf = new ZipFile(f); - ze = zf.getEntry("foo"); - assertNotNull(ze); - assertNotNull(zf.getInputStream(ze)); - } finally { - System.err.println("-------------------^^^^^^^^^^^^^^^^^^^^^^^-----------"); - if (o != null) { - o.close(); - } - f.delete(); - f2.delete(); - } + ZipArchiveEntry ze = zf.getEntry("test1.txt"); + assertNotNull(ze); + assertNotNull(zf.getInputStream(ze)); } /* Added: commons/proper/compress/trunk/src/test/resources/COMPRESS-227.zip URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/COMPRESS-227.zip?rev=1486333&view=auto ============================================================================== Binary file - no diff available. Propchange: commons/proper/compress/trunk/src/test/resources/COMPRESS-227.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream