A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/2134 below:

[java] PreserveStackTrace not handling Throwable.addSuppressed(...) · Issue #2134 · pmd/pmd · GitHub

Affects PMD Version: 6.19.0

Rule: PreserveStackTrace

Description: The below code generates a false-positive PreserveStackTrace error while the outer exception really is preserved as part of the inner exception using addSuppressed.

This is really a rare case and I'm fine with suppressing it for now, but wanted to let you know about it and maybe this report even helps someone.

Code Sample demonstrating the issue:

try {
	return ...;
} catch (IOException outerException) {
	try {
		return ...;
	} catch (IOException innerException) {
		innerException.addSuppressed(outerException);
		throw new UncheckedIOException(innerException);
	}
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4