2023-05-03 11:06:20 +02:00
|
|
|
=== Noncompliant code example
|
2020-12-21 15:38:52 +01:00
|
|
|
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,text]
|
2020-12-21 15:38:52 +01:00
|
|
|
----
|
|
|
|
try {
|
|
|
|
/* ... */
|
|
|
|
} catch (Exception e) { // Noncompliant - exception is lost
|
|
|
|
LOGGER.info("context");
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
/* ... */
|
|
|
|
} catch (Exception e) { // Noncompliant - exception is lost (only message is preserved)
|
|
|
|
LOGGER.info(e.getMessage());
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
/* ... */
|
|
|
|
} catch (Exception e) { // Noncompliant - original exception is lost
|
|
|
|
throw new RuntimeException("context");
|
|
|
|
}
|
|
|
|
----
|