Search in sources :

Example 41 with MalformedInputException

use of java.nio.charset.MalformedInputException in project tomcat by apache.

the class TestB2CConverter method testBug54602c.

@Test
public void testBug54602c() throws Exception {
    // Check partial input is rejected once it is known to be all available
    B2CConverter conv = new B2CConverter(StandardCharsets.UTF_8);
    ByteChunk bc = new ByteChunk();
    CharChunk cc = new CharChunk();
    bc.append(UTF8_PARTIAL, 0, UTF8_PARTIAL.length);
    cc.allocate(bc.getLength(), -1);
    conv.convert(bc, cc, false);
    Exception e = null;
    try {
        conv.convert(bc, cc, true);
    } catch (MalformedInputException mie) {
        e = mie;
    }
    Assert.assertNotNull(e);
}
Also used : MalformedInputException(java.nio.charset.MalformedInputException) MalformedInputException(java.nio.charset.MalformedInputException) Test(org.junit.Test)

Aggregations

MalformedInputException (java.nio.charset.MalformedInputException)41 IOException (java.io.IOException)14 ByteBuffer (java.nio.ByteBuffer)12 CharBuffer (java.nio.CharBuffer)9 UnmappableCharacterException (java.nio.charset.UnmappableCharacterException)9 CharsetDecoder (java.nio.charset.CharsetDecoder)7 BufferedReader (java.io.BufferedReader)6 Path (java.nio.file.Path)6 File (java.io.File)5 InputStreamReader (java.io.InputStreamReader)5 Charset (java.nio.charset.Charset)5 Test (org.junit.Test)4 CharacterCodingException (java.nio.charset.CharacterCodingException)3 MalformedInputExceptionWithDetail (org.eclipse.wst.sse.core.internal.exceptions.MalformedInputExceptionWithDetail)3 JSONException (com.alibaba.fastjson.JSONException)2 BufferedWriter (java.io.BufferedWriter)2 FileInputStream (java.io.FileInputStream)2 InputStream (java.io.InputStream)2 UncheckedIOException (java.io.UncheckedIOException)2 StandardCharsets (java.nio.charset.StandardCharsets)2