harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail Loenko (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (HARMONY-577) [classlib][util] java.util.zip.ZipOutputStream.write(byte[]) doesn't throw IOException if an entry is not set
Date Fri, 09 Jun 2006 08:17:33 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-577?page=all ]
     
Mikhail Loenko resolved HARMONY-577:
------------------------------------

    Resolution: Fixed
     Assign To: Mikhail Loenko

Vladimir, thanks for the test and suggested ifx.

I've fixed the bug in slightly different way than you've suggested, please review my fix and
let me
know either it fully resolves your problem

> [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
>     Assignee: Mikhail Loenko
>  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


Mime
View raw message