RFR: JDK-8280004: DCmdArgument<jlong>::parse_value() should handle NULL input [v2]
Thomas Stuefe
stuefe at openjdk.java.net
Thu Jan 27 09:18:06 UTC 2022
> Hi,
>
> may I have eyes please on this simple fix (Sonarcloud-inspired) which sanitizes the error output of DCmdArgument<jlong>::parse_value():
> - since the input can be NULL, we should handle NULL
> - we also limit parroting of invalid input to 64 chars max
> - we also do not need a temporary RA buffer to assemble the output
>
> Example output with patch, first a short, then a long invalid numeric parameter:
>
>
> thomas at starfish:~$ jcmd Simple GC.class_histogram -parallel=hallo
> 399746:
> java.lang.IllegalArgumentException: Integer parsing error in command argument '-parallel'. Could not parse: "hallo".
> thomas at starfish:~$ jcmd Simple GC.class_histogram -parallel=hallo012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
> 399746:
> java.lang.IllegalArgumentException: Integer parsing error in command argument '-parallel'. Could not parse: "hallo01234567890123456789012345678901234567890123456789012345678...".
>
>
> Thanks, Thomas
Thomas Stuefe has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
- remove quotes to avoid disturbing parsing tests
- Merge
- sanitize error message
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/7079/files
- new: https://git.openjdk.java.net/jdk/pull/7079/files/c016f795..8af94135
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=7079&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=7079&range=00-01
Stats: 14158 lines in 751 files changed: 9347 ins; 2577 del; 2234 mod
Patch: https://git.openjdk.java.net/jdk/pull/7079.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/7079/head:pull/7079
PR: https://git.openjdk.java.net/jdk/pull/7079
More information about the hotspot-runtime-dev
mailing list