harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r515909 - /harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetTest.java
Date Thu, 08 Mar 2007 03:52:29 GMT
Author: pyang
Date: Wed Mar  7 19:52:27 2007
New Revision: 515909

URL: http://svn.apache.org/viewvc?view=rev&rev=515909
Log:
fix the system property recovery bug

Modified:
    harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetTest.java

Modified: harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetTest.java?view=diff&rev=515909&r1=515908&r2=515909
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetTest.java
Wed Mar  7 19:52:27 2007
@@ -89,7 +89,7 @@
 	public void test_defaultCharset() {
 		String charsetName = null;
 		String defaultCharsetName = null;
-		Properties oldProps = (Properties) System.getProperties().clone();
+        String oldDefaultEncoding = System.getProperty("file.encoding");
 		try {
 			// Normal behavior
 			charsetName = "UTF-8"; //$NON-NLS-1$
@@ -102,16 +102,12 @@
 			defaultCharsetName = Charset.defaultCharset().name();
 			assertEquals(charsetName, defaultCharsetName);
 
-			System.setProperties(oldProps);
-
 			// Unsupported behavior
 			charsetName = "IMPOSSIBLE-8"; //$NON-NLS-1$
 			System.setProperty("file.encoding", charsetName);//$NON-NLS-1$
 			defaultCharsetName = Charset.defaultCharset().name();
 			assertEquals("UTF-8", defaultCharsetName);
 
-			System.setProperties(oldProps);
-
 			// Null behavior
 			try {
 				Properties currentProps = System.getProperties();
@@ -121,7 +117,6 @@
 			} catch (IllegalArgumentException e) {
 				// expected
 			}
-			System.setProperties(oldProps);
 
 			// IllegalCharsetName behavior
 			try {
@@ -133,7 +128,7 @@
 				// expected
 			}
 		} finally {
-			System.setProperties(oldProps);
+            System.setProperty("file.encoding", oldDefaultEncoding);//$NON-NLS-1$
 		}
 	}
 	



Mime
View raw message