harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r953412 - in /harmony/enhanced/java/trunk/classlib/modules/luni/src: main/java/java/io/ test/api/common/org/apache/harmony/luni/tests/java/io/
Date Thu, 10 Jun 2010 17:57:01 GMT
Author: tellison
Date: Thu Jun 10 17:57:00 2010
New Revision: 953412

URL: http://svn.apache.org/viewvc?rev=953412&view=rev
Log:
Applied patch and created tests for HARMONY-6534 ([classlib][luni] construct UnsupportedEncodingException
with name of encoding)

Modified:
    harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/InputStreamReader.java
    harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/PrintStream.java
    harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/InputStreamReaderTest.java
    harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/PrintStreamTest.java

Modified: harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/InputStreamReader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/InputStreamReader.java?rev=953412&r1=953411&r2=953412&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/InputStreamReader.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/InputStreamReader.java
Thu Jun 10 17:57:00 2010
@@ -101,7 +101,7 @@ public class InputStreamReader extends R
                     CodingErrorAction.REPLACE);
         } catch (IllegalArgumentException e) {
             throw (UnsupportedEncodingException)
-                    new UnsupportedEncodingException().initCause(e);
+                    new UnsupportedEncodingException(enc).initCause(e);
         }
         bytes.limit(0);
     }

Modified: harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/PrintStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/PrintStream.java?rev=953412&r1=953411&r2=953412&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/PrintStream.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/PrintStream.java
Thu Jun 10 17:57:00 2010
@@ -175,7 +175,7 @@ public class PrintStream extends FilterO
             throw new NullPointerException();
         }
         if (!Charset.isSupported(csn)) {
-            throw new UnsupportedEncodingException();
+            throw new UnsupportedEncodingException(csn);
         }
         encoding = csn;
     }

Modified: harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/InputStreamReaderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/InputStreamReaderTest.java?rev=953412&r1=953411&r2=953412&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/InputStreamReaderTest.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/InputStreamReaderTest.java
Thu Jun 10 17:57:00 2010
@@ -24,6 +24,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStreamWriter;
+import java.io.PrintStream;
 import java.io.UnsupportedEncodingException;
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetDecoder;
@@ -211,7 +212,7 @@ public class InputStreamReaderTest exten
             is = new InputStreamReader(fis, "Bogus");
             fail("Failed to throw Unsupported Encoding exception");
         } catch (UnsupportedEncodingException e) {
-            // Expected
+            assertNotNull(e.getMessage());
         }
 
         try {

Modified: harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/PrintStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/PrintStreamTest.java?rev=953412&r1=953411&r2=953412&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/PrintStreamTest.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/PrintStreamTest.java
Thu Jun 10 17:57:00 2010
@@ -77,6 +77,14 @@ public class PrintStreamTest extends jun
     	MockPrintStream os = new MockPrintStream(testFilePath, "utf-8");
     	assertNotNull(os);
     	os.close();
+    	
+    	// Test that a bogus charset is mentioned in the exception
+    	try {
+    	    new PrintStream(testFilePath, "Bogus");
+    	    fail("Exception expected");
+    	} catch (UnsupportedEncodingException e) {
+    	    assertNotNull(e.getMessage());
+    	}
     }
 
     /**



Mime
View raw message