1 | package fr.sii.ogham.spring.general; | |
2 | ||
3 | import org.springframework.boot.context.properties.ConfigurationProperties; | |
4 | import org.springframework.boot.context.properties.NestedConfigurationProperty; | |
5 | ||
6 | import fr.sii.ogham.core.exception.MessagingException; | |
7 | import fr.sii.ogham.core.service.MessagingService; | |
8 | ||
9 | @ConfigurationProperties("ogham") | |
10 | public class MessagingProperties { | |
11 | @NestedConfigurationProperty | |
12 | private WrapUncaughtExceptionsProperties wrapUncaughtExceptions = new WrapUncaughtExceptionsProperties(); | |
13 | ||
14 | public WrapUncaughtExceptionsProperties getWrapUncaughtExceptions() { | |
15 |
2
1. getWrapUncaughtExceptions : replaced return value with null for fr/sii/ogham/spring/general/MessagingProperties::getWrapUncaughtExceptions → KILLED 2. getWrapUncaughtExceptions : replaced return value with null for fr/sii/ogham/spring/general/MessagingProperties::getWrapUncaughtExceptions → KILLED |
return wrapUncaughtExceptions; |
16 | } | |
17 | ||
18 | public void setWrapUncaughtExceptions(WrapUncaughtExceptionsProperties wrapUncaughtExceptions) { | |
19 | this.wrapUncaughtExceptions = wrapUncaughtExceptions; | |
20 | } | |
21 | ||
22 | public static class WrapUncaughtExceptionsProperties { | |
23 | /** | |
24 | * There are technical exceptions that are thrown by libraries used by | |
25 | * Ogham. Those exceptions are often {@link RuntimeException}s. It can | |
26 | * be difficult for developers of a big application to quickly identify | |
27 | * what caused this {@link RuntimeException}. The stack trace doesn't | |
28 | * always help to find the real source of the error. If enables, this | |
29 | * option ensures that work done by Ogham will always throw a | |
30 | * {@link MessagingException} even if it was a {@link RuntimeException} | |
31 | * thrown by any component. It then helps the developer to know that the | |
32 | * error comes from Ogham or a any used library and not something else | |
33 | * in its application. The other benefit is that in your code you only | |
34 | * catch a {@link MessagingException} and you are sure that it will | |
35 | * handle all cases, no surprise with an unchecked exception that could | |
36 | * make a big failure in your system because you didn't know this could | |
37 | * happen. Sending a message is often not critical (if message can't be | |
38 | * sent now, it can be sent later or manually). It it fails the whole | |
39 | * system must keep on working. With this option enabled, your system | |
40 | * will never fail due to an unchecked exception and you can handle the | |
41 | * failure the same way as with checked exceptions. | |
42 | * | |
43 | * Concretely, call of | |
44 | * {@link MessagingService#send(fr.sii.ogham.core.message.Message)} | |
45 | * catches all exceptions including {@link RuntimeException}. It wraps | |
46 | * any exceptions into a {@link MessagingException}. | |
47 | * | |
48 | */ | |
49 | private boolean enable = true; | |
50 | ||
51 | public boolean isEnable() { | |
52 |
2
1. isEnable : replaced boolean return with false for fr/sii/ogham/spring/general/MessagingProperties$WrapUncaughtExceptionsProperties::isEnable → SURVIVED 2. isEnable : replaced boolean return with true for fr/sii/ogham/spring/general/MessagingProperties$WrapUncaughtExceptionsProperties::isEnable → SURVIVED |
return enable; |
53 | } | |
54 | ||
55 | public void setEnable(boolean enable) { | |
56 | this.enable = enable; | |
57 | } | |
58 | } | |
59 | } | |
Mutations | ||
15 |
1.1 2.2 |
|
52 |
1.1 2.2 |