diff options
Diffstat (limited to 'nio_char')
-rw-r--r-- | nio_char/src/test/java/tests/api/java/nio/charset/CharsetProviderTest.java | 13 | ||||
-rw-r--r-- | nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetEncoderTest.java | 6 |
2 files changed, 14 insertions, 5 deletions
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/CharsetProviderTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/CharsetProviderTest.java index 535f068..6bcdaef 100644 --- a/nio_char/src/test/java/tests/api/java/nio/charset/CharsetProviderTest.java +++ b/nio_char/src/test/java/tests/api/java/nio/charset/CharsetProviderTest.java @@ -15,6 +15,7 @@ */ package tests.api.java.nio.charset; +import dalvik.annotation.KnownFailure; import dalvik.annotation.TestLevel; import dalvik.annotation.TestTargetClass; import dalvik.annotation.TestTargetNew; @@ -84,7 +85,13 @@ public class CharsetProviderTest extends TestCase { } catch (MalformedURLException e) { fail("unexpected exception: " + e); } - URLClassLoader urlc = new URLClassLoader(new URL[] { url }); + + ClassLoader parent = Thread.currentThread().getContextClassLoader(); + if (parent == null) { + parent = ClassLoader.getSystemClassLoader(); + } + + URLClassLoader urlc = new URLClassLoader(new URL[] { url }, parent); Thread.currentThread().setContextClassLoader(urlc); } @@ -259,6 +266,8 @@ public class CharsetProviderTest extends TestCase { method = "charsetForName", args = {String.class} ) + @KnownFailure("Android throws Error in case of insufficient privileges, " + + "RI throws SecurityException") public void testIsSupported_InsufficientPrivilege() throws Exception { SecurityManager oldMan = System.getSecurityManager(); System.setSecurityManager(new MockSecurityManager()); @@ -292,6 +301,8 @@ public class CharsetProviderTest extends TestCase { method = "charsetForName", args = {String.class} ) + @KnownFailure("Android throws Error in case of insufficient privileges, " + + "RI throws SecurityException") public void testForName_InsufficientPrivilege() throws Exception { SecurityManager oldMan = System.getSecurityManager(); System.setSecurityManager(new MockSecurityManager()); diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetEncoderTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetEncoderTest.java index 9c22dba..249c410 100644 --- a/nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetEncoderTest.java +++ b/nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetEncoderTest.java @@ -31,14 +31,12 @@ import java.nio.charset.Charset; */ public class GBCharsetEncoderTest extends AbstractCharsetEncoderTestCase { - // charset for gb180303 - private static final Charset CS = Charset.forName("gb18030"); - /* * @see CharsetEncoderTest#setUp() */ protected void setUp() throws Exception { - cs = CS; + // charset for gb180303 + cs = Charset.forName("gb18030");; super.setUp(); } |