Synopsis: | A catch statement should never catch throwable since it includes errors |
Language: | Java |
Severity Level: | 1 |
Category: | StrictException |
Description: |
This is dangerous because it casts too wide a net; it can catch things like OutOfMemoryError.public class Foo { public void bar() { try { // do something } catch (Throwable th) { //Should not catch throwable th.printStackTrace(); } } } |