RFR: 8269909: getStack method in hprof.parser.Reader should use try-with-resource [v3]

David Holmes david.holmes at oracle.com
Wed Jul 14 05:04:02 UTC 2021


On 14/07/2021 2:48 pm, Lin Zang wrote:
> On Wed, 14 Jul 2021 04:19:56 GMT, David Holmes <dholmes at openjdk.org> wrote:
> 
>>> Lin Zang has updated the pull request incrementally with one additional commit since the last revision:
>>>
>>>    revise code to handle the closing of embeded streams
>>
>> test/lib/jdk/test/lib/hprof/parser/Reader.java line 100:
>>
>>> 98:                 in.close();
>>> 99:                 try (BufferedInputStream bis2 = new BufferedInputStream(access.asStream(0));
>>> 100:                         PositionDataInputStream in2 = new PositionDataInputStream(bis2)) {
>>
>> Please fix indentation so that the type names align.
>>
>> Also minor nit: the '2' suffix is not needed for any of the variables now as they are scoped to the try-block.
> 
> Hi David,
>       Removing the `2` suffix here makes build error, as they are conflict with the outer try() at line 88.  Thanks.

Ah okay. I didn't spot the nesting from the diff view - sorry.

David

> -------------
> 
> PR: https://git.openjdk.java.net/jdk/pull/4717
> 


More information about the serviceability-dev mailing list