Integrated: 8261938: ASN1Formatter.annotate should not return in the finally block
Jie Fu
jiefu at openjdk.java.net
Fri Feb 19 23:48:40 UTC 2021
On Thu, 18 Feb 2021 02:28:01 GMT, Jie Fu <jiefu at openjdk.org> wrote:
> Hi all,
>
> ASN1Formatter.annotate should be able to throw an IOException according to this comment [1].
> But it fails to do so due to the return [2] in the finally block, which would swallow the IOException.
>
> Generally, it seems not good to put a return statement in a finally block because it would overwrite other return-statements or Exceptions [3].
>
> Thanks.
> Best regards,
> Jie
>
> [1] https://github.com/openjdk/jdk/blob/master/test/lib/jdk/test/lib/hexdump/ASN1Formatter.java#L113
> [2] https://github.com/openjdk/jdk/blob/master/test/lib/jdk/test/lib/hexdump/ASN1Formatter.java#L120
> [3] https://stackoverflow.com/questions/17481251/finally-block-does-not-complete-normally-eclipse-warning
This pull request has now been integrated.
Changeset: b10376ba
Author: Jie Fu <jiefu at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/b10376ba
Stats: 15 lines in 1 file changed: 10 ins; 1 del; 4 mod
8261938: ASN1Formatter.annotate should not return in the finally block
Reviewed-by: rriggs
-------------
PR: https://git.openjdk.java.net/jdk/pull/2620
More information about the core-libs-dev
mailing list