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

David Holmes dholmes at openjdk.java.net
Wed Jul 14 04:25:13 UTC 2021


On Wed, 14 Jul 2021 02:38:38 GMT, Lin Zang <lzang at openjdk.org> wrote:

>> 8269909: getStack method in hprof.parser.Reader should use try-with-resource
>
> 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

Looks complete now - thanks.

Please fix alignment issues flagged before integrating.

Thanks,
David

test/lib/jdk/test/lib/hprof/parser/Reader.java line 90:

> 88:         try (FileInputStream fis = new FileInputStream(heapFile);
> 89:                 BufferedInputStream bis = new BufferedInputStream(fis);
> 90:                 PositionDataInputStream in = new PositionDataInputStream(bis)) {

Please fix indentation so that the type names align.

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.

test/lib/jdk/test/lib/hprof/parser/Reader.java line 142:

> 140:         try (FileInputStream fis= new FileInputStream(heapFile);
> 141:                 BufferedInputStream bis = new BufferedInputStream(fis);
> 142:                 PositionDataInputStream in = new PositionDataInputStream(bis)) {

Please fix indentation so that the type names align.

test/lib/jdk/test/lib/hprof/parser/Reader.java line 158:

> 156:                 try (FileInputStream fis2 = new FileInputStream(heapFile);
> 157:                         GZIPInputStream gis = new GZIPInputStream(fis2);
> 158:                         FileOutputStream fos = new FileOutputStream(out)) {

Please fix indentation so that the type names align.

test/lib/jdk/test/lib/hprof/parser/Reader.java line 171:

> 169:                 try (FileInputStream fis3 = new FileInputStream(out);
> 170:                         BufferedInputStream bis2 = new BufferedInputStream(fis3);
> 171:                         PositionDataInputStream in2 = new PositionDataInputStream(bis2)) {

Please fix indentation so that the type names align.

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

Marked as reviewed by dholmes (Reviewer).

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


More information about the hotspot-runtime-dev mailing list