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.
(I am trying to promote NetBeans as defacto IDE for our team and one of the reviewers came up with the following note. I thought I'd file an issue for this). If Current code block in surrounded with a try-catch and attempted to call an API which throws a checked Exception, NetBeans shows and error and offers two solutions 'add throws clause' and 'surround with try catch'. Which results in a nested try-catch block. However, it would be nice if it could provide an extra option 'Add catch clause to surrounding try'. PS: Eclipse do provide this extra option which is lot convenient to developers. Code Example: try { if (!conditionMet) { wait(); } /// Rest of Code. } catch (InterruptedException ex) { //handle interrupted. } if the above code is modified as: try { if (!conditionMet) { wait(); } /// Rest of Code. if (errorInReadingData) { throw new IOException("Error Reading Data"); } } catch (InterruptedException ex) { //handle interrupted. } NetBeans offers to modify code as: try { if (!conditionMet) { wait(); } /// Rest of Code. try { if (errorInReadingData) { throw new IOException("Error Reading Data"); } } catch (IOException ex) { //Handle ex. } } catch (InterruptedException ex) { //handle interrupted. } It would be good, if NetBeans offers to modify code as try { if (!conditionMet) { wait(); } /// Rest of Code. if (errorInReadingData) { throw new IOException("Error Reading Data"); } } catch (InterruptedException ex) { //handle interrupted. } catch (IOException ex) { // handle IOEx }
It's duplicate of issue 75741. This behaviour will be introduced in next version. *** This issue has been marked as a duplicate of 75741 ***
Reorganization of java component