title: Why is my NullPointerException not being caught in my catch block?
body: <p>I have a thread in which I catch all errors in a big, all-encompassing catch block. I do this so that I can report any error, not just expected ones, in my application. My Runnable looks like this:</p>
  
  <pre><code>public final void run()
  {
      try
      {
          System.out.println("Do things"); /* [1] */
  
          doUnsafeThings();
      }
      catch (Throwable t)
      {
          System.out.println("Catch"); /* [2] */
  
          recover();
      }
      finally
      {
          System.out.println("Finally"); /* [3] */
      }
  }
  </code></pre>
  
  <p>I would expect the NPE to be caught by the Throwable catch block. Instead, the output at [2] is not printed, and neither is [3]. The output at [1] is printed.</p>
  
  <p>What I do get on the console, is this:</p>
  
  <pre><code>Uncaught exception java/lang/NullPointerException.
  </code></pre>
  
  <p>What on earth is going on here?</p>
  
  <p>For the court records, I'm using J2ME, and this is running in Sun's WTK v2.5.2 emulator.</p>
  
  <p>I'm tempted to put it down to JVM implementation dodginess but I can't help feeling that I'm just missing something.</p>
  
  <p>To clarify for the avoidance of doubt (Since the example code is obviously altered from my production code)</p>
  
  <ul>
  <li>There is nothing outside of the try/catch/finally block in the run method.</li>
  <li>There is a System.out.println at the start of each of those blocks - What follows those console statements should not matter.</li>
  </ul>