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:19:29 UTC

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

[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


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


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

Posted by "Vladimir Ivanov (JIRA)" <ji...@apache.org>.
     [ 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


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

Posted by "Mikhail Loenko (JIRA)" <ji...@apache.org>.
     [ 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


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

Posted by "Mikhail Loenko (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-577?page=all ]
     
Mikhail Loenko closed HARMONY-577:
----------------------------------


verified by  Vladimir

> [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


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

Posted by "Mikhail Loenko (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-577?page=comments#action_12415505 ] 

Mikhail Loenko commented on HARMONY-577:
----------------------------------------

p.s. fixed in 412974

> [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


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

Posted by "Vladimir Ivanov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-577?page=comments#action_12415960 ] 

Vladimir Ivanov commented on HARMONY-577:
-----------------------------------------

verified in 412974.

> [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