diff options
author | sherman <none@none> | 2011-08-17 14:14:21 -0700 |
---|---|---|
committer | sherman <none@none> | 2011-08-17 14:14:21 -0700 |
commit | 5810e991b6355586e87e50334e4abfa40bf4d103 (patch) | |
tree | 8834f1953e7e6d71dcce11668732aea139a25c50 /test/sun/nio | |
parent | db91ce8b48cda859733a58c2e0b7c7b3fc6332f9 (diff) |
6237353: Remove sun.io package from j2se binary
Summary: Removed sun.io package and related test cases
Reviewed-by: alanb
Diffstat (limited to 'test/sun/nio')
-rw-r--r-- | test/sun/nio/cs/TestCp834_SBCS.java | 24 | ||||
-rw-r--r-- | test/sun/nio/cs/TestISCII91.java | 71 |
2 files changed, 0 insertions, 95 deletions
diff --git a/test/sun/nio/cs/TestCp834_SBCS.java b/test/sun/nio/cs/TestCp834_SBCS.java index 9ca5e2679..25e64698d 100644 --- a/test/sun/nio/cs/TestCp834_SBCS.java +++ b/test/sun/nio/cs/TestCp834_SBCS.java @@ -26,7 +26,6 @@ @summary Check all Cp933 SBCS characters are not supported in Cp834 */ -import sun.io.*; import java.io.*; import java.nio.*; import java.nio.charset.*; @@ -36,8 +35,6 @@ public class TestCp834_SBCS { // The correctness of 1:1 mapping is Coverted by CoderTest.java // and TestConv.java, we only need to verify that SBCS characters // are not supported by this charset. - CharToByteConverter cb834 = CharToByteConverter.getConverter("Cp834"); - ByteToCharConverter bc834 = ByteToCharConverter.getConverter("Cp834"); CharsetEncoder enc834 = Charset.forName("Cp834") .newEncoder() .onUnmappableCharacter(CodingErrorAction.REPLACE) @@ -73,27 +70,6 @@ public class TestCp834_SBCS { ByteBuffer bb = enc834.encode(CharBuffer.wrap(ca)); if (bb.get() != (byte)0xfe || bb.get() != (byte)0xfe) throw new Exception("SBCS is supported in IBM834 encoder"); - - boolean isMalformed = false; - int ret = 0; - bc834.reset(); - try { - ret = bc834.convert(ba, 0, 1, ca, 0, 1); - } catch (sun.io.MalformedInputException x) { isMalformed = true; } - if (!isMalformed && ret != 0 && ca[0] != '\ufffd') { - // three scenarios (1)malformed (2)held as an incomplete - // input or (3)return replacement all mean "no sbcs" - throw new Exception("SBCS is supported in Cp834 b2c"); - } - - if (cb834.canConvert(c)) - throw new Exception("SBCS can be converted in Cp834 c2b "); - - ca[0] = c; - if (cb834.convert(ca, 0, 1, ba2, 0, 2) != 2 || - ba2[0] != (byte)0xfe || ba2[1] != (byte)0xfe) { - throw new Exception("SBCS is supported in Cp834 c2b"); - } } } } diff --git a/test/sun/nio/cs/TestISCII91.java b/test/sun/nio/cs/TestISCII91.java deleted file mode 100644 index e043862bb..000000000 --- a/test/sun/nio/cs/TestISCII91.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* @test - @bug 6431650 - @summary Check charset ISCII91 and C2B/B2CISCII91 yield same encoding/decoding result - */ - - -import java.nio.*; -import java.nio.charset.*; -import sun.io.*; - -public class TestISCII91 { - public static void main(String[] args) throws Throwable{ - CharToByteConverter c2b = new CharToByteISCII91(); - ByteToCharConverter b2c = new ByteToCharISCII91(); - Charset cs = Charset.forName("ISCII91"); - String charsToEncode = getCharsForEncoding("ISCII91"); - - byte [] c2bBytes = c2b.convertAll(charsToEncode.toCharArray()); - byte [] csBytes = cs.encode(charsToEncode).array(); - for (int i = 0; i < c2bBytes.length; ++i) { - if (c2bBytes[i] != csBytes[i]) - throw new RuntimeException("ISCII91 encoding failed!"); - } - - char[] c2bChars = b2c.convertAll(c2bBytes); - char[] csChars = cs.decode(ByteBuffer.wrap(csBytes)).array(); - for (int i = 0; i < c2bChars.length; ++i) { - if (c2bChars[i] != csChars[i]) - throw new RuntimeException("ISCII91 decoding failed!"); - } - } - - - static String getCharsForEncoding(String encodingName) - throws CharacterCodingException{ - Charset set = Charset.forName(encodingName); - CharBuffer chars = CharBuffer.allocate(300); - CharsetEncoder encoder = set.newEncoder(); - for (int c = 0; chars.remaining() > 0 && c < Character.MAX_VALUE; ++c) { - if (Character.isDefined((char) c) && !Character.isISOControl((char) c) && encoder.canEncode((char) c)) { - chars.put((char) c); - } - } - chars.limit(chars.position()); - chars.rewind(); - return chars.toString(); - } -} |