Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java] AvoidCatchingThrowable should flag catch (Error e) #2583

Open
wuchiuwong opened this issue Jun 14, 2020 · 0 comments
Open

[java] AvoidCatchingThrowable should flag catch (Error e) #2583

wuchiuwong opened this issue Jun 14, 2020 · 0 comments
Labels
an:enhancement An improvement on existing features / rules

Comments

@wuchiuwong
Copy link

Affects PMD Version:
6.22.0

Rule:
AvoidCatchingThrowable

Description:
It is recommended to have AvoidCatchingThrowable additionally check catch (Error e)
Similar to Throwable, Error is the superclass of all errors, which are not meant to be caught by applications.

Code Sample demonstrating the suggestion:

try {
	listener.connected();
}
catch (Error e) {		//detect this case
	e.printStackTrace();
}	

Type:
Suggestions for rule improvement

Running PMD through:
CLI

@wuchiuwong wuchiuwong added the an:enhancement An improvement on existing features / rules label Jun 14, 2020
@oowekyala oowekyala changed the title [java]It is recommended to have AvoidCatchingThrowable additionally check catch (Error e) [java] AvoidCatchingThrowable should flag catch (Error e) Jun 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
an:enhancement An improvement on existing features / rules
Projects
None yet
Development

No branches or pull requests

1 participant