You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@johnzon.apache.org by "Hendrik Saly (JIRA)" <ji...@apache.org> on 2014/10/29 16:07:34 UTC

[jira] [Commented] (JOHNZON-16) RFC4627AwareInputStreamReader has unreachable code

    [ 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)