test/sun/nio/cs/TestUTF8.java
Print this page
*** 21,31 ****
* questions.
*/
/*
* @test
! * @bug 4486841 7040220 7096080
* @summary Test UTF-8 charset
*/
import java.nio.charset.*;
import java.nio.*;
--- 21,31 ----
* questions.
*/
/*
* @test
! * @bug 4486841 7040220 7096080 8039751
* @summary Test UTF-8 charset
*/
import java.nio.charset.*;
import java.nio.*;
*** 289,306 ****
--- 289,310 ----
{1, (byte)0xE0, (byte)0x9F, (byte)0xBF }, // U+07FF zero-padded
{1, (byte)0xE0, (byte)0xC0, (byte)0xBF }, // invalid second byte
{2, (byte)0xE0, (byte)0xA0, (byte)0x7F }, // invalid third byte
{2, (byte)0xE0, (byte)0xA0, (byte)0xC0 }, // invalid third byte
+ {2, (byte)0xE1, (byte)0x80, (byte)0x42}, // invalid third byte
+
{1, (byte)0xFF, (byte)0xFF, (byte)0xFF }, // all ones
{1, (byte)0xE0, (byte)0xC0, (byte)0x80 }, // invalid second byte
{1, (byte)0xE0, (byte)0x80, (byte)0xC0 }, // invalid first byte
{1, (byte)0xE0, (byte)0x41,}, // invalid second byte & 2 bytes
+ {1, (byte)0xE1, (byte)0x40,}, // invalid second byte & 2 bytes
{3, (byte)0xED, (byte)0xAE, (byte)0x80 }, // 3 bytes surrogate
{3, (byte)0xED, (byte)0xB0, (byte)0x80 }, // 3 bytes surrogate
+
// Four-byte sequences
{1, (byte)0xF0, (byte)0x80, (byte)0x80, (byte)0x80 }, // U+0000 zero-padded
{1, (byte)0xF0, (byte)0x80, (byte)0x81, (byte)0xBF }, // U+007F zero-padded
{1, (byte)0xF0, (byte)0x80, (byte)0x9F, (byte)0xBF }, // U+007F zero-padded
{1, (byte)0xF0, (byte)0x8F, (byte)0xBF, (byte)0xBF }, // U+07FF zero-padded
*** 321,330 ****
--- 325,360 ----
{3, (byte)0xF1, (byte)0x80, (byte)0x80, (byte)0xC0 }, // invalid forth byte
{1, (byte)0xF4, (byte)0x90, (byte)0x80, (byte)0xC0 }, // out-range 4-byte
{1, (byte)0xF4, (byte)0xC0, (byte)0x80, (byte)0xC0 }, // out-range 4-byte
{1, (byte)0xF5, (byte)0x80, (byte)0x80, (byte)0xC0 }, // out-range 4-byte
+ // #8039751
+ {1, (byte)0xF6, (byte)0x80, (byte)0x80, (byte)0x80 }, // out-range 1st byte
+ {1, (byte)0xF6, (byte)0x80, (byte)0x80, },
+ {1, (byte)0xF6, (byte)0x80, },
+ {1, (byte)0xF6, },
+ {1, (byte)0xF5, (byte)0x80, (byte)0x80, (byte)0x80 }, // out-range 1st byte
+ {1, (byte)0xF5, (byte)0x80, (byte)0x80, },
+ {1, (byte)0xF5, (byte)0x80, },
+ {1, (byte)0xF5 },
+
+ {1, (byte)0xF4, (byte)0x90, (byte)0x80, (byte)0x80 }, // out-range 2nd byte
+ {1, (byte)0xF4, (byte)0x90, (byte)0x80 },
+ {1, (byte)0xF4, (byte)0x90 },
+
+ {1, (byte)0xF4, (byte)0x7f, (byte)0x80, (byte)0x80 }, // out-range/ascii 2nd byte
+ {1, (byte)0xF4, (byte)0x7f, (byte)0x80 },
+ {1, (byte)0xF4, (byte)0x7f },
+
+ {1, (byte)0xF0, (byte)0x80, (byte)0x80, (byte)0x80 }, // out-range 2nd byte
+ {1, (byte)0xF0, (byte)0x80, (byte)0x80 },
+ {1, (byte)0xF0, (byte)0x80 },
+
+ {1, (byte)0xF0, (byte)0xc0, (byte)0x80, (byte)0x80 }, // out-range 2nd byte
+ {1, (byte)0xF0, (byte)0xc0, (byte)0x80 },
+ {1, (byte)0xF0, (byte)0xc0 },
+
// Five-byte sequences
{1, (byte)0xF8, (byte)0x80, (byte)0x80, (byte)0x80, (byte)0x80}, // invalid first byte
{1, (byte)0xF8, (byte)0x80, (byte)0x80, (byte)0x80, (byte)0x80 }, // U+0000 zero-padded
{1, (byte)0xF8, (byte)0x80, (byte)0x80, (byte)0x81, (byte)0xBF }, // U+007F zero-padded
{1, (byte)0xF8, (byte)0x80, (byte)0x80, (byte)0x9F, (byte)0xBF }, // U+07FF zero-padded
*** 551,561 ****
public static void main(String[] args) throws Exception {
checkRoundtrip("UTF-8");
check4ByteSurrs("UTF-8");
checkMalformed("UTF-8", malformed);
checkUnderOverflow("UTF-8");
-
checkRoundtrip("CESU-8");
check6ByteSurrs("CESU-8");
checkMalformed("CESU-8", malformed_cesu8);
}
}
--- 581,590 ----