This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[BC] Patch preview: java.util.zip fixlet


I'm not checking this in yet -- I'm going to wait until I write a test
case and put it in Mauve.  I have to turn my attention to something
else for a while so it may be a few days.

This basically reverts a zip patch from a while back, to let EOF
handling work correctly.  With this, Eclipse 3 gets a little further.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* java/util/zip/InflaterInputStream.java (fill): Don't throw an
	exception if we hit EOF of `in'.
	(read): Handle case where inflating returns -1.

Index: java/util/zip/InflaterInputStream.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/zip/InflaterInputStream.java,v
retrieving revision 1.18.8.1
diff -u -r1.18.8.1 InflaterInputStream.java
--- java/util/zip/InflaterInputStream.java 12 Oct 2004 14:53:20 -0000 1.18.8.1
+++ java/util/zip/InflaterInputStream.java 19 Oct 2004 19:47:49 -0000
@@ -152,10 +152,8 @@
     
     len = in.read(buf, 0, buf.length);
 
-    if (len < 0)
-      throw new ZipException("Deflated stream ends early.");
-    
-    inf.setInput(buf, 0, len);
+    if (len >= 0)
+      inf.setInput(buf, 0, len);
   }
 
   /**
@@ -188,7 +186,7 @@
       return -1;
 
     int count = 0;
-    for (;;)
+    while (count == 0)
       {
 	if (inf.needsInput())
 	  fill();
@@ -211,10 +209,8 @@
 	  {
 	    throw new ZipException(dfe.getMessage());
 	  }
-
-	if (count > 0)
-	  return count;
       }
+    return count;
   }
 
   /**


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]