Is it good practice to have return statement in try block when returned value from finally block is concerned
<p>I was wondering, is it good practice to <code>return</code> from <code>try</code> block?</p>

<pre><code>package debug;

/**
 *
 * @author Owner
 */
public class Main {

  public static void main(String[] args) {
    System.out.println(fun());
  }

  static boolean cleanup() {
    // Fail to cleanup.
    return false;
  }

  static boolean fun() {
    boolean everything_is_fine = true;
    try {
      System.out.println("open file stream");
      return everything_is_fine;
    } finally {
      everything_is_fine = cleanup();
    }
  }
}
</code></pre>

<hr>

<p>I first thought <code>false</code> will be printed. However, here is the output :</p>

<pre><code>open file stream
true
</code></pre>

<p>As you can see, if I am having <code>return</code> statement within <code>try</code> block, I will miss the fail status during <code>finally</code> cleanup.</p>

<p>Shall I have the code as :</p>

<pre><code>  static boolean fun() {
    boolean everything_is_fine = true;
    try {
      System.out.println("open file stream");      
    } finally {
      everything_is_fine = cleanup();
    }
    return everything_is_fine;
  }
</code></pre>

<p><strong>As long as the returned value from finally block is concerned, shall I avoid return from try?</strong></p>
