RFR: 8269886: Inaccurate error message for compressed hprof test
Lin Zang
lzang at openjdk.java.net
Wed Jul 7 02:04:46 UTC 2021
On Tue, 6 Jul 2021 03:14:15 GMT, David Holmes <dholmes at openjdk.org> 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.
>
> 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. ???
>
> David
Hi @dholmes-ora
> Either deleting the out file needs to be handled correctly in all cases or it should left as-is and fixed in a different RFE that also handles stream closing *try-with-resources?) etc. to clean up the code.
I have created an issue in JBS (https://bugs.openjdk.java.net/browse/JDK-8269909) to use the try-with-resource for stream closing, and will submit a PR shortly.
For out.delete(), I prefer to fix it in this PR as the introduction of throwing exception in my last update makes the original out.delete() unreachable, so I have to add logic to handle it. I will update this PR with a finally block in a minute.
Thanks,
Lin
-------------
PR: https://git.openjdk.java.net/jdk/pull/4685
More information about the hotspot-runtime-dev
mailing list