fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [fineract] thesmallstar commented on a change in pull request #1079: Added and Enforced AvoidHidingCauseException Checkstyle (FINERACT-942)
Date Sat, 27 Jun 2020 14:03:49 GMT

thesmallstar commented on a change in pull request #1079:
URL: https://github.com/apache/fineract/pull/1079#discussion_r446529856



##########
File path: fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/exception/PlatformDataIntegrityException.java
##########
@@ -30,18 +33,39 @@
 
     public PlatformDataIntegrityException(final String globalisationMessageCode, final String
defaultUserMessage,
             final Object... defaultUserMessageArgs) {
+        super(findThrowableCause(defaultUserMessageArgs));
         this.globalisationMessageCode = globalisationMessageCode;
         this.defaultUserMessage = defaultUserMessage;
         this.parameterName = null;
-        this.defaultUserMessageArgs = defaultUserMessageArgs;
+        this.defaultUserMessageArgs = filterThrowableCause(defaultUserMessageArgs);
     }
 
     public PlatformDataIntegrityException(final String globalisationMessageCode, final String
defaultUserMessage,
             final String parameterName, final Object... defaultUserMessageArgs) {
+        super(findThrowableCause(defaultUserMessageArgs));
         this.globalisationMessageCode = globalisationMessageCode;
         this.defaultUserMessage = defaultUserMessage;
         this.parameterName = parameterName;
-        this.defaultUserMessageArgs = defaultUserMessageArgs;
+        this.defaultUserMessageArgs = filterThrowableCause(defaultUserMessageArgs);
+    }
+
+    private static Throwable findThrowableCause(Object[] defaultUserMessageArgs) {

Review comment:
       Agreed! I did not understand do we really need a constructor though(or you mean something
else here), an abstract class without any attributes and two static methods will do IMO. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message