Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Spring has nothing to do with this, what you obtain is a behavior as required by <strong><a href="http://docs.oracle.com/javase/specs/jls/se5.0/html/statements.html#14.20.2" rel="nofollow" title="Java Language Specification">JLS 14.20.2 Execution of try-catch-finally</a></strong>:</p> <blockquote> <p>A <code>try</code> statement with a <code>finally</code> block is executed by first executing the <code>try</code> block. Then there is a choice...</p> <ul> <li>If execution of the <code>try</code> block completes abruptly because of a <code>throw</code> of a value <em>V</em>, then there is a choice:<br> If the run-time type of <em>V</em> is assignable to the parameter of any <code>catch</code> clause of the <code>try</code> statement, then the first (leftmost) such <code>catch</code> clause is selected. The value <em>V</em> is assigned to the parameter of the selected <code>catch</code> clause, and the <em>Block</em> of that <code>catch</code> clause is executed. Then there is a choice... <ul> <li>If the <code>catch</code> block completes abruptly for reason <em>R</em>, then the <code>finally</code> block is executed... </li> </ul></li> </ul> </blockquote> <p>In your code snippet, <code>RuntimeException</code> corresponds to "value <em>V</em>" in above quote.</p> <p>Exception is thrown and caught in respective catch block, which then "completes abruptly" by re-throwing the exception - that is, <code>throw e</code> in your snippet corresponds to "reason <em>R</em>" in above quote.</p> <p>Then, as required by language specification, "<code>finally</code> block is executed".</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload