Skip to content

[java] PreserveStackTrace false-positive #1747

@boris-petrov

Description

@boris-petrov

PMD version 6.13.0.

Rule: PreserveStackTrace

try {
	...
} catch (IOException exception) {
	if (exception.getMessage().contains("foobar")) {
		throw new SomeOtherUserDefinedException("Error", exception);
	}
	throw exception;
}

This code produces a PreserveStackTrace error but it shouldn't according to the documentation of PreserveStackTrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-positivePMD flags a piece of code that is not problematic

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions