[PATCH] JDK-8216140: Correct UnicodeDecoder U+FFFE handling

Giovanni Gatti Pinheiro giovanni.gatti.pinheiro at gmail.com
Wed Jan 9 14:45:08 UTC 2019


Hello,

I’ve crossed this bug on the past and I would like to fix it. You will find
the patch with the fix attached to this message.

I have few questions around this subject.

1.    Where should the test be placed?
It is not clear to me which is the standard approach. I’ve spent about 1h
searching in the code base where it should be placed without success. Then
I’ve tried to « fix » the code and to run nio tests expecting to break
something (however no test failed). The closest I’ve got from a reasonable
place is TestUTF_16 class. In this class, there is a test for « Reversed
BOM in middle of stream Negative test. » `that is commented out, which is
the opposite to what I’m tried to do.

2.    What to do with UTF-8/UTF-32?
I’ve tested UTF-8/UTF-32 to see how these two implementations handle U+FFFE
in the middle of a byte stream. They are both compliant with Unicode
specification and it looks like that this bug applies only to UTF-16’s
implementation. It’s awkward that these three encodings do not behave the
same way, so I would like to confirm with you that I don’t have to do
anything special about it.

3.    What exactly should I test?
Technically I should’ve tested that all Unicode non-characters are not
reported as malformed input. Do I have to go that far or just testing
U+FFFE is enough?

4.    Do I have to sign OCA document to this contribution?
It’s really a small fix and I don’t really care about any credit. But
still, if I must, just let me know and I will do it ASAP.

So, let me know what to do exactly and I will do take care about it.

Thank you in advance.

Best regards,

Giovanni GATTI PINHEIRO
-------------- next part --------------
A non-text attachment was scrubbed...
Name: JDK-8216140.patch
Type: text/x-patch
Size: 2189 bytes
Desc: not available
URL: <https://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20190109/c32ba2ab/JDK-8216140.patch>


More information about the core-libs-dev mailing list