On Wed, 7 Jul 2021 17:45:10 GMT, Chris Plummer <[email protected]> wrote:

>> 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();

Hi @plummercj,
    I just found that maybe there is no need to catch exception from 
`HprofReader` in this method, just keep it as what it originally did -  throw 
any exception from HprofReader directly. The information from HprofReader's 
exception is enough for root cause analysis in this case.
    I will test it and make the change.

BRs,
Lin

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

PR: https://git.openjdk.java.net/jdk/pull/4685

Reply via email to