Never use {{Wiki Markup return}}, {{break}}, {{continue}}, or {{throw}} statements within a {{finally}} block. When program execution enters a {{try}} block that has a {{finally}} block, the {{finally}} block always executes, regardless of whether the {{try}} block (or any associated {{catch}} blocks) executes to normal completion. Statements that cause the {{finally}} block to complete abruptly also cause the {{try}} block to complete abruptly and consequently suppress any exception thrown from the {{try}} or {{catch}} blocks. According to the _Java Language Specification_, [§14, §14.20.2, Execution of try-catch-finally|http://java.sun.com/docs/books/jls/third_edition/html/statements.html#14.20.2] \[ [JLS 2005|AA. References#JLS 05]\]:
If execution of the try block completes abruptly for any other reason R, then the finally block is executed. Then there is a choice:
- If the finally block completes normally, then the try statement completes abruptly for reason R.
- If the finally block completes abruptly for reason S, then the try statement completes abruptly for reason S (and reason R is discarded).
...
Bibliography
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="74907188-1548-4a76-b607-6609a16356aa"><ac:plain-text-body><![CDATA[ | [[Bloch 2005AA. References#Bloch 05]] | Puzzle 36. Indecision ]]></ac:plain-text-body></ac:structured-macro><ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="a1c847e7-6a71-4878-af6d-ae796e2b3083"><ac:plain-text-body><! | |
[CDATA[ [[Chess 2007AA. References#Chess 07] ] | 8.2, Managing Exceptions, The Vanishing Exception ]]></ac:plain-text-body></ac:structured-macro> | ||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="698c92ad-0054-40d6-be3c-d8879ad9afe2"><ac:plain-text-body><! [CDATA[ [[JLS 2005AA. References#JLS 05] ] | http://java.sun.com/docs/books/jls/third_edition/html/statements.html#14.20.2] | ]]></ac:plain-text-body></ac:structured-macro> |
...