Immediately after construction of a ZipInputStream, available() will return 0. Sun's javadoc states, "Returns 0 after EOF has reached for the current entry data, otherwise always return 1." My interpretation is there is no current entry, so EOF hasn't been reached on it yet, so return 1. Release: 3.3 20020828 (experimental) Environment: System: Linux churchill 2.4.3-12 #1 Fri Jun 8 15:05:56 EDT 2001 i686 unknown Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ../gcc/configure --prefix=/home/user/jmr/app/gcc --enable-langs=c++,java --enable-shared --enable-threads=posix --with-as=/home/user/jmr/app/binutils/bin/as --with-ld=/home/user/jmr/app/binutils/bin/ld : (reconfigured) How-To-Repeat: ; cat ZISAvailTest.java import java.net.URL; import java.util.zip.ZipInputStream; public class ZISAvailTest { public static void main(String[] s) throws Exception { URL u = new URL("http://www.xwt.org/dist/xwt-0258.jar"); System.err.println(new ZipInputStream(u.openStream()).available()); } } ; gcj ZISAvailTest.java --main=ZISAvailTest ; ./a.out 0 Whereas Sun's jdk gives: ; javac ZISAvailTest.java ; java ZISAvailTest 1
Responsible-Changed-From-To: unassigned->tromey Responsible-Changed-Why: I'm handling the administrivia
State-Changed-From-To: open->closed State-Changed-Why: Thanks, I'm checking in your patch.
From: tromey@gcc.gnu.org To: gcc-gnats@gcc.gnu.org Cc: Subject: libgcj/7766 Date: 25 Sep 2002 20:10:42 -0000 CVSROOT: /cvs/gcc Module name: gcc Changes by: tromey@gcc.gnu.org 2002-09-25 13:10:42 Modified files: libjava : ChangeLog libjava/java/util/zip: ZipInputStream.java Log message: 2002-09-25 Jesse Rosenstock <jmr@ugcs.caltech.edu> Fix for PR libgcj/7766: * java/util/zip/ZipInputStream.java (entryAtEOF): New field. (getNextEntry): Set it. (closeEntry): Likewise. (read): Likewise. (close): Likewise. (available): Use it. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.1452&r2=1.1453 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/util/zip/ZipInputStream.java.diff?cvsroot=gcc&r1=1.14&r2=1.15