[ 
https://issues.apache.org/jira/browse/JOHNZON-16?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14188420#comment-14188420
 ] 

Hendrik Saly commented on JOHNZON-16:
-------------------------------------

Thanks for the patch but will not apply the RFC4627AwareInputStreamReader 
stuff, new Testcase is ok, thanks for that.
The patch removes BOM detection, so UTF which comes with BOM's are then not 
correctly handled.

For example a test like 
{code}
@Test
    public void testUTF16Stream() {
        //this writes UTF 16 with Byte Order Mark (BOM)
        ByteArrayInputStream bin = new 
ByteArrayInputStream("[\"UTF16\"]".getBytes(UTF_16));
        JsonParser parser = Json.createParser(bin);
        parser.next();
        parser.next();
        assertEquals("UTF16", parser.getString());
        parser.next();
        assertTrue(!parser.hasNext());
        parser.close();
    }
{code}
fails with the patch applied.

But during review i found that we not handle UTF-8 well with BOM. Will fix this 
and add also more test cases that checks BOMs (to check functionality and to 
increase coverage)


> RFC4627AwareInputStreamReader has unreachable code
> --------------------------------------------------
>
>                 Key: JOHNZON-16
>                 URL: https://issues.apache.org/jira/browse/JOHNZON-16
>             Project: Johnzon
>          Issue Type: Improvement
>            Reporter: Thiago Veronezi
>            Assignee: Hendrik Saly
>            Priority: Minor
>         Attachments: remove_unreachable_improve_test_coverage.patch
>
>
> The RFC4627AwareInputStreamReader#getCharset method has some unreachable 
> branches. Therefore, it is not 100% covered by the unit tests.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to