title: Why is eclipse complaining when I try to close BufferedReader in finally block?
body: <p>Here is my code:</p>
  
  <pre><code>public static String readFile()
      {
  
          BufferedReader br = null;
          String line;
          String dump="";
  
          try
          {
              br = new BufferedReader(new FileReader("dbDumpTest.txt"));
          }
          catch (FileNotFoundException fnfex)
          {
              System.out.println(fnfex.getMessage());
              System.exit(0);
          }
  
          try
          {
              while( (line = br.readLine()) != null)
              {
                  dump += line + "\r\n";
              }
          }
          catch (IOException e)
          {
              System.out.println(e.getMessage() + " Error reading file");
          }
          finally
          {
              br.close();
          }
          return dump;
  </code></pre>
  
  <p>So eclipse is complaining about an unhandled IO exception caused by <code>br.close();</code></p>
  
  <p>Why would this cause an IO exception?</p>
  
  <p>My second question is why eclipse doesn't complain about the following code:</p>
  
  <pre><code>InputStream is = null; 
        InputStreamReader isr = null;
        BufferedReader br = null;
  
        try{
           // open input stream test.txt for reading purpose.
           is = new FileInputStream("c:/test.txt");
  
           // create new input stream reader
           isr = new InputStreamReader(is);
  
           // create new buffered reader
           br = new BufferedReader(isr);
  
           // releases any system resources associated with reader
           br.close();
  
           // creates error
           br.read();
  
        }catch(IOException e){
  
           // IO error
           System.out.println("The buffered reader is closed");
        }finally{
  
           // releases any system resources associated
           if(is!=null)
              is.close();
           if(isr!=null)
              isr.close();
           if(br!=null)
              br.close();
        }
     }
  }
  </code></pre>
  
  <p>I'd appreciate it if you kept the explanation in Laymen's terms if possible. Thanks for the help in advance</p>