2020-12-21 15:38:52 +01:00
|
|
|
== Noncompliant Code Example
|
|
|
|
|
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");
|
|
|
|
}
|
|
|
|
----
|