harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r428682 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/io/PushbackInputStream.java test/java/org/apache/harmony/tests/java/io/PushBackInputStreamTest.java
Date Fri, 04 Aug 2006 10:21:38 GMT
Author: tellison
Date: Fri Aug  4 03:21:37 2006
New Revision: 428682

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

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PushbackInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PushbackInputStream.java?rev=428682&r1=428681&r2=428682&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PushbackInputStream.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PushbackInputStream.java
Fri Aug  4 03:21:37 2006
@@ -47,7 +47,7 @@
 	 */
 	public PushbackInputStream(InputStream in) {
 		super(in);
-		buf = new byte[1];
+		buf = (in == null) ? null : new byte[1];
 		pos = 1;
 	}
 
@@ -63,7 +63,7 @@
 	public PushbackInputStream(InputStream in, int size) {
 		super(in);
 		if (size > 0) {
-			buf = new byte[size];
+			buf = (in == null) ? null : new byte[size];
 			pos = size;
 		} else
 			throw new IllegalArgumentException(org.apache.harmony.luni.util.Msg

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/PushBackInputStreamTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/PushBackInputStreamTest.java?rev=428682&r1=428681&r2=428682&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/PushBackInputStreamTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/io/PushBackInputStreamTest.java
Fri Aug  4 03:21:37 2006
@@ -23,6 +23,31 @@
 
 public class PushBackInputStreamTest extends TestCase {
 
+    /*
+     * @tests java.io.PushBackInputStream(InputStream)
+     */
+    public void test_ConstructorLjava_io_InputStream() {
+        try {
+            PushbackInputStream str = new PushbackInputStream(null);
+            str.read();
+            fail("Expected IOException");
+        } catch (IOException e) {
+            // Expected
+        }
+    }
+    
+    /*
+     * @tests java.io.PushBackInputStream(InputStream, int)
+     */
+    public void test_ConstructorLjava_io_InputStreamL() {
+        try {
+            PushbackInputStream str = new PushbackInputStream(null, 1);
+            str.read();
+            fail("Expected IOException");
+        } catch (IOException e) {
+            // Expected
+        }
+    }
 	/**
 	 * @tests java.io.PushbackInputStream#unread(byte[], int, int)
 	 */



Mime
View raw message