RFR 15: 8243010: Test support: Customizable Hex Printer
Roger Riggs
Roger.Riggs at oracle.com
Fri Apr 17 14:11:51 UTC 2020
Hi Pavel,
On 4/17/20 8:27 AM, Pavel Rappo wrote:
> Hi Roger,
>
> First of all, many thanks for doing this. After skimming through that webrev I have two comments.
>
> 1. It might make sense to beef this up with more retrofitted tests, so people could more clearly see how applicable this API is. If you'd like I could help you with looking for those across the OpenJDK codebase.
There are fewer (tests) than you might think though I only grepped for
HexDumpEncoder.
I omitted a few that are dependent on parsing HexDumpEncoder formatted
strings and there are golden files to be considered.
A separate pass will be needed for those.
I didn't consider any uses in the src/... tree since at the moment this
is only considered for testing. If it passes muster, it deserves
further consideration for JDK.
>
> 2. Correct me if I'm wrong, but I couldn't find the complementary functionality of parsing in a hexdump in that webrev. I'm not sure how prevalent this is, but I can attest that there is an occasional need for it. For instance, when implementing the HPACK format I coded the tests from that RFC which use a two-byte hexadecimal representation. For example,
>
> 1008 7061 7373 776f 7264 0673 6563 7265 | ..password.secre
> 74 | t
>
> I'm sure that's not the only case where hex parsing might be needed.
I developed a corresponding parser but it needs more work.
Thanks, Roger
>
> Regardless of whether or not this functionality is already included in that webrev (I might've missed it), the hex printing in and of itself is valuable.
>
> -Pavel
>
>> On 16 Apr 2020, at 20:17, Roger Riggs <Roger.Riggs at oracle.com> wrote:
>>
>> Please review[2] and comment on a new Hex printing utility to support OpenJDK tests.
>> The usefulness of a hex printing has been discussed from time to time with
>> many suggestions as to the API shape and features.
>>
>> To get an idea of the API and features, take a look at the javadoc[1].
>> It covers the basic formatting of offset, and values, and extends the
>> descriptive part beyond simple ASCII or printable so that a custom formatter
>> can interpret the byte stream in parallel to the bytes.
>>
>> The webrev includes changes to existing tests that currently
>> use HexDumpEncoder to use HexPrinter.
>>
>> Comments appreciated, Roger
>>
>> [1]Javadoc:
>> http://cr.openjdk.java.net/~rriggs/webrev-hexprinter-8243010/javadoc
>>
>> [2] Webrev:
>> http://cr.openjdk.java.net/~rriggs/webrev-hexprinter-8243010/
>>
>> [3] Issue:
>> https://bugs.openjdk.java.net/browse/JDK-8243010
More information about the core-libs-dev
mailing list