RFR: 8269886: Inaccurate error message for compressed hprof test [v4]

Lin Zang lzang at openjdk.java.net
Wed Jul 7 22:40:51 UTC 2021


On Wed, 7 Jul 2021 17:45:10 GMT, Chris Plummer <cjplummer at openjdk.org> 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,
    Thanks for point it out! I think the throw at line 181 could be removed and the `new = HprofReader(); r.read()` code should be in try block consistently in both situation (compressed/uncompressed). I will make the change.
-Lin

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

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


More information about the hotspot-runtime-dev mailing list