This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Surround with try-catch handles exceptions in wrong order. Consider the follwing code : package com.dj; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author Deepak */ public class Test { /** * @param args the command line arguments */ public static void main(String[] args) { BufferedInputStream bis = null; try { File file = new File("a.txt"); bis = new BufferedInputStream(new FileInputStream(file)); while(bis.read()!=-1){ } } catch (IOException ex) { Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex); } finally { try { bis.close(); } catch (IOException ex) { Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex); } } } } for the line " bis = new BufferedInputStream(new FileInputStream(file));" surround with try/catch ---> generates FileNotFoundException catch block. for the loop " while(bis.read()!=-1){ } " surround with try/catch ---> generates IOException catch block . But IDE places IOException catch block over FileNotFoundException try/catch bloc which generates a compile time error.
Duplicate of issue #86483. *** This issue has been marked as a duplicate of 86483 ***