harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r431852 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/io/PrintStream.java test/java/tests/api/java/io/PrintStreamTest.java
Date Wed, 16 Aug 2006 07:14:19 GMT
Author: pyang
Date: Wed Aug 16 00:14:18 2006
New Revision: 431852

URL: http://svn.apache.org/viewvc?rev=431852&view=rev
Log:
Patch applied for HARMONY-1195 ([classlib][io] PrintStream(OutputStream, boolean, String)
throws IAE while RI throws NPE)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PrintStream.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PrintStreamTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PrintStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PrintStream.java?rev=431852&r1=431851&r2=431852&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PrintStream.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PrintStream.java
Wed Aug 16 00:14:18 2006
@@ -117,7 +117,7 @@
 	public PrintStream(OutputStream out, boolean autoflush, String enc)
 			throws UnsupportedEncodingException {
 		super(out);
-		if (out == null) {
+		if (out == null || enc == null) {
             throw new NullPointerException();
         }
 		this.autoflush = autoflush;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PrintStreamTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PrintStreamTest.java?rev=431852&r1=431851&r2=431852&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PrintStreamTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PrintStreamTest.java
Wed Aug 16 00:14:18 2006
@@ -37,13 +37,11 @@
 	/**
 	 * @tests java.io.PrintStream#PrintStream(java.io.OutputStream)
 	 */
-	public void test_ConstructorLjava_io_OutputStream() {
+	public void test_ConstructorLjava_io_OutputStream() throws Exception{
 		// Test for method java.io.PrintStream(java.io.OutputStream)
 		try {
 			os = new java.io.PrintStream(bos);
 			os.print(2345.76834720202);
-		} catch (Exception e) {
-			fail("IOException during constructor test : " + e.getMessage());
 		} finally {
 			try {
 				os.close();
@@ -51,6 +49,12 @@
 				fail("IOException during constructor test : " + e.getMessage());
 			}
 		}
+        //regression for HARMONY-1195
+        try {
+            os = new PrintStream(bos, true, null);
+            fail("Should throw NPE.");
+        } catch (NullPointerException e) {
+        } 
 	}
 
 	/**



Mime
View raw message