Inspectopedia Help

Error handling

'Error' not rethrown  

Reports try statements that catch java.lang.Error or any of its subclasses and do not rethrow the error.

'ThreadDeath' not rethrown  

Reports try statements that catch java.lang.ThreadDeath and do not rethrow the exception.

'continue' or 'break' inside 'finally' block  

Reports break or continue statements inside of finally blocks.

'finally' block which can not complete normally  

Reports return, throw, break, continue, and yield statements that are used inside finally blocks.

'instanceof' on 'catch' parameter  

Reports cases in which an instanceof expression is used for testing the type of a parameter in a catch block.

'null' thrown  

Reports null literals that are used as the argument of a throw statement.

'return' inside 'finally' block  

Reports return statements inside of finally blocks.

'throw' caught by containing 'try' statement  

Reports throw statements whose exceptions are always caught by containing try statements.

'throw' inside 'catch' block which ignores the caught exception  

Reports exceptions that are thrown from inside catch blocks but do not "wrap" the caught exception.

'throw' inside 'finally' block  

Reports throw statements inside finally blocks.

Catch block may ignore exception  

Reports catch blocks that are empty or may ignore an exception.

Caught exception is immediately rethrown  

Reports catch blocks that immediately rethrow the caught exception without performing any action on it.

Checked exception class  

Reports checked exception classes (that is, subclasses of java.lang.Exception that are not subclasses of java.lang.RuntimeException).

Class directly extends 'Throwable'  

Reports classes that directly extend java.lang.Throwable.

Empty 'finally' block  

Reports empty finally blocks.

Empty 'try' block  

Reports empty try blocks, including try-with-resources statements.

Exception constructor called without arguments  

Reports creation of a exception instance without any arguments specified.

Nested 'try' statement  

Reports nested try statements.

Non-final field of 'Exception' class  

Reports fields in subclasses of java.lang.Exception that are not declared final.

Overly broad 'catch' block  

Reports catch blocks with parameters that are more generic than the exception thrown by the corresponding try block.

Overly broad 'throws' clause  

Reports throws clauses with exceptions that are more generic than the exceptions that the method actually throws.

Prohibited 'Exception' caught  

Reports catch clauses that catch an inappropriate exception.

Prohibited exception declared  

Reports methods that declare an inappropriate exception in their throws clause.

Prohibited exception thrown  

Reports throw statements that throw an inappropriate exception.

Throwable supplier never returns a value  

Reports Supplier lambdas in Optional.orElseThrow() calls that throw an exception, instead of returning it.

Unchecked 'Exception' class  

Reports subclasses of java.lang.RuntimeException.

Unchecked exception declared in 'throws' clause  

Reports declaration of an unchecked exception (java.lang.RuntimeException or one of its subclasses) in the throws clause of a method.

Unnecessary call to 'Throwable.initCause()'  

Reports calls to Throwable.initCause() where an exception constructor also takes a Throwable cause argument.

Last modified: 18 June 2024