Index: C:/harmony/trunk_0427/modules/luni/src/main/java/java/io/BufferedInputStream.java =================================================================== --- C:/harmony/trunk_0427/modules/luni/src/main/java/java/io/BufferedInputStream.java (revision 417639) +++ C:/harmony/trunk_0427/modules/luni/src/main/java/java/io/BufferedInputStream.java (working copy) @@ -62,7 +62,9 @@ */ public BufferedInputStream(InputStream in) { super(in); - buf = new byte[2048]; + if (in != null) { + buf = new byte[2048]; + } } /** @@ -77,11 +79,13 @@ */ public BufferedInputStream(InputStream in, int size) { super(in); - if (size > 0) - buf = new byte[size]; - else - throw new IllegalArgumentException(org.apache.harmony.luni.util.Msg + if (in != null) { + if (size > 0) + buf = new byte[size]; + else + throw new IllegalArgumentException(org.apache.harmony.luni.util.Msg .getString("K0058")); //$NON-NLS-1$ + } } /** @@ -109,6 +113,9 @@ * If an error occurs attempting to close this stream. */ public synchronized void close() throws IOException { + if (buf == null) { + throw new IOException(org.apache.harmony.luni.util.Msg.getString("K0059")); + } super.close(); buf = null; } @@ -311,6 +318,9 @@ * occurs. */ public synchronized long skip(long amount) throws IOException { + if (buf == null) { + throw new IOException(org.apache.harmony.luni.util.Msg.getString("K0059")); + } if (amount < 1) return 0;