Ok i have sinned, i wrote too much code like this

```
try {
   // my code
} catch (Exception ex) {
   // doesn't matter
}

```

Now i'm going to cleanup/refactor this.

I'm using NB 6.7 and code completion works fine on first writing, adding all Exception types, etc. Once i have done the above code NB do not give more help.

Do you know a way to say NB look again for all Exception types and make the proposal for handling them and do code completion again ?
['https://Stackoverflow.com/questions/2070933', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/114226/']
[PMD](http://pmd.sourceforge.net/) identifies all these places where you have empty `catch` blocks (PMD does much more actually). It has NetBeans integration, so give it a try.

After identifying all the places with empty `catch` blocks you will have to consider each one by itself:

* sometimes just log the message
* sometimes restructure nearby code. I.e. if you are catching a `NullPointerException`, add a `null` check instead.
* sometimes you will have to consider rethrowing (and declaring checked) exceptions.
I just can provide the eclipse approach and hope that it's somewhat similiar with netbeans:

1. remove the try/catch statements -> eclipse will show compiler errors
2. use eclipse's quick tip to refactor the correct try/catch (or throw) statements

You may save your existing exception handling code to paste it in after the refactoring.

**Edit**

Tom had a very good comment regarding RuntimeException. So the procedure should better look like this:

1. copy the existing catch clause and paste to a notepad/text editor
2. remove the try/catch statements -> eclipse will show compiler errors
3. use eclipse's quick tip to refactor the correct try/catch (or throw) statements
4. paste the stored catch clause at the end of sequence of catch statements

This will preserve your exception handling of RuntimeExceptions (and subtypes!).

So from 

```
try {
   Integer.parseInt("Force a RuntimeException");
   myInputStream.close();
} catch (Exception oops) {
   // catch both IOException and NumberFormatException
}

```

you go to

```
try {
   Integer.parseInt("Force a RuntimeException");
   myInputStream.close();
} catch (IOException oops) {
   // catch IOException
} catch (Exception oops) {
   // catch NumberFormatException
}

```

(although you could manually replace Exception by NumberFormatException in this case, but it's just an example)