FINERACT-942 Added and enforced MutableException Checkstyle

This commit is contained in:
thesmallstar
2020-06-20 00:04:31 +02:00
committed by Michael Vorburger ⛑️
parent 00a8feea8f
commit b20de7bced
2 changed files with 8 additions and 3 deletions
@@ -160,6 +160,7 @@
<message key="name.invalidPattern" <message key="name.invalidPattern"
value="Method name ''{0}'' must match pattern ''{1}''."/> value="Method name ''{0}'' must match pattern ''{1}''."/>
</module> </module>
<module name="MutableException"/>
<module name="WhitespaceAround"> <module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/> <property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyMethods" value="true"/> <property name="allowEmptyMethods" value="true"/>
@@ -185,7 +186,7 @@
< ! - - TODO Checks for Exception Handling Anti-Patterns - - > < ! - - TODO Checks for Exception Handling Anti-Patterns - - >
<module name="IllegalCatch"/> <module name="IllegalCatch"/>
<module name="MutableException"/>
<module name="com.github.sevntu.checkstyle.checks.coding.AvoidHidingCauseExceptionCheck" /> <module name="com.github.sevntu.checkstyle.checks.coding.AvoidHidingCauseExceptionCheck" />
@@ -26,14 +26,16 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
*/ */
public class DuplicateClientIdentifierException extends AbstractPlatformDomainRuleException { public class DuplicateClientIdentifierException extends AbstractPlatformDomainRuleException {
private Long documentTypeId; private final Long documentTypeId;
private String identifierKey; private final String identifierKey;
private final String identifierType; private final String identifierType;
public DuplicateClientIdentifierException(final String identifierType) { public DuplicateClientIdentifierException(final String identifierType) {
super("error.msg.clientIdentifier.type.duplicate", super("error.msg.clientIdentifier.type.duplicate",
"Active Client identifier of type " + identifierType + " is already present for this client", identifierType); "Active Client identifier of type " + identifierType + " is already present for this client", identifierType);
this.identifierType = identifierType; this.identifierType = identifierType;
this.identifierKey = null;
this.documentTypeId = null;
} }
public DuplicateClientIdentifierException(final Long documentTypeId, final String identifierType, final String identifierKey) { public DuplicateClientIdentifierException(final Long documentTypeId, final String identifierType, final String identifierKey) {
@@ -51,6 +53,8 @@ public class DuplicateClientIdentifierException extends AbstractPlatformDomainRu
+ identifierType + " with unique key " + identifierKey, clientName, officeName, identifierType, identifierKey); + identifierType + " with unique key " + identifierKey, clientName, officeName, identifierType, identifierKey);
this.identifierType = identifierType; this.identifierType = identifierType;
this.identifierKey = identifierKey; this.identifierKey = identifierKey;
this.documentTypeId = null;
} }
public Long getDocumentTypeId() { public Long getDocumentTypeId() {