2023-05-03 11:06:20 +02:00
|
|
|
=== Compliant solution
|
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) {
|
|
|
|
LOGGER.info(e); // exception is logged
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
/* ... */
|
|
|
|
} catch (Exception e) {
|
|
|
|
throw new RuntimeException(e); // exception stack trace is propagated
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
/* ... */
|
|
|
|
} catch (RuntimeException e) {
|
|
|
|
doSomething();
|
|
|
|
throw e; // original exception passed forward
|
|
|
|
} catch (Exception e) {
|
|
|
|
throw new RuntimeException(e); // Conversion into unchecked exception is also allowed
|
|
|
|
}
|
|
|
|
----
|