On Wed, 7 Jul 2021 02:39:10 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.
>
> Lin Zang has updated the pull request incrementally with one additional
> commit since the last revision:
>
> fix the out.delete() logic
There is still an inconsistency exception handling. For the outer bad
MAGIC_NUMBER handling you have:
186 throw new IOException("Unrecognized magic number: " + i);
But the decompressed handling results in:
178 throw new IOException("Unrecognized magic number of
decompressed data: " + i);
Which is caught and wrapped by:
181 throw new IOException("Cannot get stack trace from the
compressed hprof file", e);
Also, nothing is wrapping exceptions thrown by the following code:
143 HprofReader r
144 = new HprofReader(heapFile, in, dumpNumber,
145 true, debugLevel);
146 r.read();
147 return r.printStackTraces();
But any exception thrown by the following code is wrapped and rethrown at line
181:
172 HprofReader r
173 = new HprofReader(deCompressedFile, in2,
dumpNumber,
174 true, debugLevel);
175 r.read();
176 return r.printStackTraces();
-------------
PR: https://git.openjdk.java.net/jdk/pull/4685