harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r418012 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/lang/String.java test/java/tests/api/java/lang/StringTest.java
Date Thu, 29 Jun 2006 11:21:37 GMT
Author: mloenko
Date: Thu Jun 29 04:21:36 2006
New Revision: 418012

URL: http://svn.apache.org/viewvc?rev=418012&view=rev
Log:
fixes for HARMONY-663
[classlib][luni] compatibility: unexpected IllegalCharsetNameException for String.getBytes("illegal/name")

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/String.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/StringTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/String.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/String.java?rev=418012&r1=418011&r2=418012&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/String.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/String.java
Thu Jun 29 04:21:36 2006
@@ -847,11 +847,15 @@
 		Charset charset = lastCharset;
 		if (charset == null || !encoding.equalsIgnoreCase(charset.name())) {
 			try {
-				charset = Charset.forName(encoding);
-			} catch (UnsupportedCharsetException e) {
-				throw new UnsupportedEncodingException(encoding);
-			}
-			lastCharset = charset;
+                charset = Charset.forName(encoding);
+            } catch (IllegalCharsetNameException e) {
+                throw (UnsupportedEncodingException) (new UnsupportedEncodingException(
+                        encoding).initCause(e));
+            } catch (UnsupportedCharsetException e) {
+                throw (UnsupportedEncodingException) (new UnsupportedEncodingException(
+                        encoding).initCause(e));
+            }
+            lastCharset = charset;
 		}
 		return charset;
 	}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/StringTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/StringTest.java?rev=418012&r1=418011&r2=418012&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/StringTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/StringTest.java
Thu Jun 29 04:21:36 2006
@@ -465,6 +465,13 @@
 			// Can't test missing converter
 			System.out.println(e);
 		}
+
+        // Regression for HARMONY-663
+        try {
+            "string".getBytes("?Q?D??_??_6ffa?+vG?_??ยป??");
+        } catch (java.io.UnsupportedEncodingException e) {
+            //expected
+        }
 	}
 
 	/**



Mime
View raw message