RFR: 8325945: Error reporting should limit the number of String characters printed [v2]

David Holmes dholmes at openjdk.org
Wed Jul 17 05:40:53 UTC 2024


On Wed, 17 Jul 2024 05:21:57 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> David Holmes has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fixed grammar
>
> src/hotspot/share/classfile/javaClasses.cpp line 785:
> 
>> 783:       index = length - (max_length / 2);
>> 784:       abridge = false; // only do this once
>> 785:     }
> 
> Instead of the trailing "abridged", in similar cases I printed out the number of omitted characters. E.g.
> 
> "Very long long long ... (53 characters omitted) ... long long string"
> 
> Makes it obvious how much has been cut, and no danger of confusing the ellipse with naturally occurring dots.
> 
> Additionally, I would only do this if length > max_length + X, with X being at least as long as the middle part (3 characters if you only print an ellipse). You end up with printed strings that may be slightly longer than maxlen, but OTOH the output is clearer. Otherwise you may indicate omission where none happened (if length == max_length)

@tstuefe  - thanks for looking at this Thomas. I don't get your second point. First I only abridge when length > max_length. Second adding in the X fudge factor just means max_length should have been set differently.

To your first point, there will be similar changes to this coming so it would be good to standardise on how to report them. I like the idea you propose, but I couldn't find the code you mention. ??

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20150#discussion_r1680433575


More information about the hotspot-dev mailing list