You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Vladimir Ivanov (JIRA)" <ji...@apache.org> on 2006/06/08 10:21:30 UTC

[jira] Updated: (HARMONY-577) [classlib][util] java.util.zip.ZipOutputStream.write(byte[]) doesn't throw IOException if an entry is not set

     [ http://issues.apache.org/jira/browse/HARMONY-577?page=all ]

Vladimir Ivanov updated HARMONY-577:
------------------------------------

    Attachment: ZipOutputStream.diffs
                ZipOutputStreamTest.diffs

> [classlib][util] java.util.zip.ZipOutputStream.write(byte[]) doesn't throw IOException if an entry is not set
> -------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-577
>          URL: http://issues.apache.org/jira/browse/HARMONY-577
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Vladimir Ivanov
>  Attachments: ZipOutputStream.diffs, ZipOutputStreamTest.diffs
>
> Harmony java.util.zip.ZipOutputStream.write(byte[]) doesn't throw IOException if an entry is not set while RI does.
> import java.io.File; 
> import java.io.FileOutputStream; 
> import java.io.IOException; 
> import java.util.zip.ZipEntry; 
> import java.util.zip.ZipException; 
> import java.util.zip.ZipOutputStream; 
> public class Test { 
>     public static void main(String [] args) { 
>          try { 
>             ZipOutputStream zip = prepareStream(); 
>             try { 
>                 zip.putNextEntry(new ZipEntry("one")); 
>                 zip.setMethod( ZipOutputStream.STORED); 
>                 zip.setMethod( ZipEntry.STORED ); 
>                 try { 
>                     zip.putNextEntry( new ZipEntry("Second")); 
>                     System.out.println("FAILED: ZipException expected"); 
>                 } catch (ZipException e) {} //We have not set an entry 
>                 try { 
>                     zip.write( new byte[2]); // We try to write data without entry 
>                     System.out.println("FAILED: expected IOE there" ); 
>                 } catch (IOException e2) { 
>                     System.out.println("passed"); 
>                 } 
>             } catch (IOException e1) { 
>                 System.out.println("FAILED: unexpected " + e1); 
>             } 
>         } catch (IOException e) { 
>             System.out.println("ERROR: " + e); 
>         } 
>     } 
>     private static ZipOutputStream prepareStream() throws IOException { 
>         File f = File.createTempFile("testZip", "tst"); 
>         f.deleteOnExit(); 
>         FileOutputStream stream = new FileOutputStream(f); 
>         return new ZipOutputStream(stream); 
>     } 
>  }
> Steps to Reproduce: 
> 1.Compile Test.java using BEA 1.4.2 javac 
> % javac -d Test.java 
> 2.Run Test class 
>   
> The output on Harmony: 
> FAILED: expected IOE there 
> The output on RI: 
> passed

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira