[Kaffe] fix for problem in java.util.zip.InflaterInputStream

Moses DeJong dejong at cs.umn.edu
Tue Mar 9 23:18:57 PST 1999


Hello.

Here is a quick patch for InflaterInputStream.java. This patch makes
it work like the DeflaterOutputStream class.



Wed Mar 10 01:15:45 CST 1999  Moses DeJong <dejong at cs.umn.edu>

	* libraries/javalib/java/util/zip/InflaterInputStream.java:
	Fixed constructor for InflaterInputStream class so that it
	works like the DeflaterOutputStream.




% cvs diff InflaterInputStream.java
Index: InflaterInputStream.java
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/javalib/java/util/zip/InflaterInputStream.java,v
retrieving revision 1.2
diff -u -r1.2 InflaterInputStream.java
--- InflaterInputStream.java    1999/02/10 21:34:52     1.2
+++ InflaterInputStream.java    1999/03/10 08:20:08
@@ -31,7 +31,13 @@
 
 public InflaterInputStream(InputStream in, Inflater inf, int size) {
        super(in);
+       if (in == null)
+         throw new NullPointerException("in");
+       if (inf == null)
+         throw new NullPointerException("inf");
        this.inf = inf;
+       if (size < 1)
+         throw new IllegalArgumentException("size < 1");
        buf = new byte[size];
        len = 0;
 }




import java.io.*;
import java.util.zip.*;

public class InflaterTest {

    public static void main(String[] argv) {
	
        InflaterInputStream iis;
	ByteArrayInputStream bais = new ByteArrayInputStream(new byte[100]);
	Inflater inf = new Inflater();

	try {
	    iis = new InflaterInputStream(null);
	} catch (NullPointerException e) {
	    System.out.println("1 OK");
	}

	try {
	    iis = new InflaterInputStream(bais, null);
	} catch (NullPointerException e) {
	    System.out.println("2 OK");
	}
	
       	try {
	    iis = new InflaterInputStream(bais, inf, 0);
	} catch (IllegalArgumentException e) {
	    System.out.println("3 OK");
	}

    }

}





/*
JDK

% java InflaterTest
1 OK
2 OK
3 OK
*/


/*
Kaffe

% kaffe InflaterTest

*/


/*
Kaffe with my patch

% kaffe InflaterTest
1 OK
2 OK
3 OK

*/



later
Mo DeJong
dejong at cs.umn.edu



More information about the kaffe mailing list