On Tue, 6 Jul 2021 02:55:37 GMT, Lin Zang <[email protected]> wrote:
> The current implementation of hprof Reader for testing always prompts "Can
> not decompress the compressed hprof file" when there is error for testing
> gzipped heap dump. This is inaccurate if the gzipped file was decompressed
> successfully but the hprof file format is incorrect. So the inaccurate error
> message could be misleading for issue analysis.
>
> This trivial PR refine the error message by simply print "Can not get stack
> trace from the compressed hprof file", the underlying exception from
> GZIPInputStream() or HprofReader() would give accurate error info.
Hi David,
Thanks for review and comments.
> The existing message is a generic message covering the general operation of
> the whole try block. It seems far more appropriate than your new message,
> which only seems to apply to the final step. ???
IMO, the whole method named getStack() is used to get the stack trace for the
hprof file. And the try block could throw exceptions by serveral reasons as
decribed, so IMHO printing "Can not decompress the compressed hprof file" is
not accurate. The proposed change is to print a generic error message that the
getStack() fail when processing compressed hprof. And the extra 'e' argument
in the changed line would give detailed reason.
So may be change error message to "Can not process the compressed hprof file"
is better? what do you think?
BRs,
Lin
-------------
PR: https://git.openjdk.java.net/jdk/pull/4685