-
Notifications
You must be signed in to change notification settings - Fork 150
Open
Description
The check should ascertain whether the class indeed has a constructor that accepts a Throwable.
RuntimeException accepts a throwable, so catching the illegalstateexception and not including it in the runtime is a violation
catch (IllegalStateException e) {
throw new RuntimeException("Runtime Exception!");
}correct code is
catch (IllegalStateException e) {
throw new RuntimeException("Runtime Exception!", e);
}But some throwables do not allow you to create them with a cause exception/throwable, like the legacy ParseException
The constructor does not accept a throwable:
public ParseException(String s, int errorOffset) {
super(s);
this.errorOffset = errorOffset;
}The rule should determine whether the exception actually accepts a cause exception before complaining about hiding the cause, since its impossible to construct the exception otherwise.
Metadata
Metadata
Assignees
Labels
No labels