harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r428675 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/io/BufferedInputStream.java test/java/org/apache/harmony/tests/java/io/BufferedInputStreamTest.java
Date Fri, 04 Aug 2006 09:35:10 GMT
Author: tellison
Date: Fri Aug  4 02:35:09 2006
New Revision: 428675

URL: http://svn.apache.org/viewvc?rev=428675&view=rev
Log:
Fix for HARMONY-1054 ([classlib][io] java.io.BufferedInputStream.read() throws unexpected
exception when it created from null InputStream)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedInputStream.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/BufferedInputStreamTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedInputStream.java?rev=428675&r1=428674&r2=428675&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedInputStream.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedInputStream.java
Fri Aug  4 02:35:09 2006
@@ -62,7 +62,7 @@
 	 */
 	public BufferedInputStream(InputStream in) {
 		super(in);
-		buf = new byte[2048];
+		buf = (in == null) ? null : new byte[2048];
 	}
 
 	/**
@@ -78,7 +78,7 @@
 	public BufferedInputStream(InputStream in, int size) {
 		super(in);
 		if (size > 0)
-			buf = new byte[size];
+			buf = (in == null) ? null : new byte[size];
 		else
 			throw new IllegalArgumentException(org.apache.harmony.luni.util.Msg
 					.getString("K0058")); //$NON-NLS-1$

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/BufferedInputStreamTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/BufferedInputStreamTest.java?rev=428675&r1=428674&r2=428675&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/BufferedInputStreamTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/BufferedInputStreamTest.java
Fri Aug  4 02:35:09 2006
@@ -57,4 +57,29 @@
 		buf.read();
 		buf.close();
 	}
+	
+	/*
+	 * @tests java.io.BufferedInputStream(InputStream)
+	 */
+	public void test_ConstructorLjava_io_InputStream() {
+		try {
+			BufferedInputStream str = new BufferedInputStream(null);
+			str.read();
+			fail("Expected an IOException");
+		} catch (IOException e) {
+			// Expected
+		}
+	}
+	/*
+	 * @tests java.io.BufferedInputStream(InputStream)
+	 */
+	public void test_ConstructorLjava_io_InputStreamI() {
+		try {
+			BufferedInputStream str = new BufferedInputStream(null, 1);
+			str.read();
+			fail("Expected an IOException");
+		} catch (IOException e) {
+			// Expected
+		}
+	}
 }



Mime
View raw message