title: Null Pointer exception within a try catch block
body: <p>Getting the following runtime error, causing my application to crash on launch</p>
  
  <blockquote>
    <p>E  FATAL EXCEPTION: MonitoringThread  13533         AndroidRuntime  E 
    Process: foo.com, PID: 13533  13533         AndroidRuntime  E 
    java.lang.NullPointerException  13533         AndroidRuntime  E   at
    foo.com$MonitoringThread.run(foo.java:125)  13533<br>
    AndroidRuntime  E     at java.lang.Thread.run(Thread.java:841)</p>
  </blockquote>
  
  <p>The offending line is</p>
  
  <pre><code>ret = mConnection.getInputStream().read(buffer);
  </code></pre>
  
  <p>in the following code snippet</p>
  
  <pre><code>try {
      ret = mConnection.getInputStream().read(buffer);
      } catch (IOException e) {
      break;
      }
  </code></pre>
  
  <p>Can anyone suggest next steps in trying to debug?
  I thought that use of a try catch block would eliminate any null pointer errors.</p>