8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /* @test
25 @bug 7040220
26 @summary Test if StringCoding and NIO result have the same de/encoding result for UTF-8
27 * @run main/othervm/timeout=2000 TestStringCodingUTF8
28 */
29
30 import java.util.*;
31 import java.nio.*;
32 import java.nio.charset.*;
33
34 public class TestStringCodingUTF8 {
35 public static void main(String[] args) throws Throwable {
36 test("UTF-8");
37 test("CESU-8");
38 // security manager on
39 System.setSecurityManager(new PermissiveSecurityManger());
40 test("UTF-8");
41 test("CESU-8");
42 }
43
44 static void test(String csn) throws Throwable {
45 Charset cs = Charset.forName(csn);
46 char[] bmp = new char[0x10000];
47 for (int i = 0; i < 0x10000; i++) {
|
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /* @test
25 @bug 7040220
26 @summary Test if StringCoding and NIO result have the same de/encoding result for UTF-8
27 * @run main/othervm/timeout=2000 TestStringCodingUTF8
28 * @key randomness
29 */
30
31 import java.util.*;
32 import java.nio.*;
33 import java.nio.charset.*;
34
35 public class TestStringCodingUTF8 {
36 public static void main(String[] args) throws Throwable {
37 test("UTF-8");
38 test("CESU-8");
39 // security manager on
40 System.setSecurityManager(new PermissiveSecurityManger());
41 test("UTF-8");
42 test("CESU-8");
43 }
44
45 static void test(String csn) throws Throwable {
46 Charset cs = Charset.forName(csn);
47 char[] bmp = new char[0x10000];
48 for (int i = 0; i < 0x10000; i++) {
|