You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by vo...@apache.org on 2020/06/09 18:42:19 UTC

[fineract] branch develop updated: FINERACT-822 enable DoubleBraceInitialization error

This is an automated email from the ASF dual-hosted git repository.

vorburger pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git


The following commit(s) were added to refs/heads/develop by this push:
     new 4c004f0  FINERACT-822 enable DoubleBraceInitialization error
4c004f0 is described below

commit 4c004f0a873818956630fca0a4056b20c3973e60
Author: percyashu <pe...@gmail.com>
AuthorDate: Mon Jun 8 00:14:27 2020 +0100

    FINERACT-822 enable DoubleBraceInitialization error
---
 fineract-provider/build.gradle                     |  2 +-
 .../service/ReadWriteNonCoreDataServiceImpl.java   | 24 ++++++++++------------
 .../security/exception/ResetPasswordException.java | 14 +++++--------
 .../SpringSecurityPlatformSecurityContext.java     |  9 +++-----
 4 files changed, 20 insertions(+), 29 deletions(-)

diff --git a/fineract-provider/build.gradle b/fineract-provider/build.gradle
index 440f8a6..fc6b7dd 100644
--- a/fineract-provider/build.gradle
+++ b/fineract-provider/build.gradle
@@ -328,7 +328,6 @@ tasks.withType(JavaCompile) {
                 "ModifiedButNotUsed",
                 "JodaPlusMinusLong",
                 "TypeParameterUnusedInFormals",
-                "DoubleBraceInitialization",
                 "UnusedNestedClass",
                 "UndefinedEquals",
         )
@@ -374,6 +373,7 @@ tasks.withType(JavaCompile) {
                 "OperatorPrecedence",
                 "EqualsGetClass",
                 "JdkObsolete",
+                "DoubleBraceInitialization",
 //                "ReturnMissingNullable",
 //                "InconsistentOverloads",
 //                "MethodCanBeStatic",
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java
index e1eb06e..2544237 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java
@@ -18,6 +18,7 @@
  */
 package org.apache.fineract.infrastructure.dataqueries.service;
 
+import com.google.common.collect.ImmutableMap;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
@@ -89,19 +90,16 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
     private final static String CODE_VALUES_TABLE = "m_code_value";
 
     private final static Logger LOG = LoggerFactory.getLogger(ReadWriteNonCoreDataServiceImpl.class);
-    private final static HashMap<String, String> apiTypeToMySQL = new HashMap<String, String>() {
-
-        {
-            put("string", "VARCHAR");
-            put("number", "INT");
-            put("boolean", "BIT");
-            put("decimal", "DECIMAL");
-            put("date", "DATE");
-            put("datetime", "DATETIME");
-            put("text", "TEXT");
-            put("dropdown", "INT");
-        }
-    };
+    private final static ImmutableMap<String, String> apiTypeToMySQL = ImmutableMap.<String, String>builder()
+            .put("string", "VARCHAR")
+            .put("number", "INT")
+            .put("boolean", "BIT")
+            .put("decimal", "DECIMAL")
+            .put("date", "DATE")
+            .put("datetime", "DATETIME")
+            .put("text", "TEXT")
+            .put("dropdown", "INT")
+            .build();
 
     private final static List<String> stringDataTypes = Arrays.asList("char", "varchar", "blob", "text", "tinyblob", "tinytext",
             "mediumblob", "mediumtext", "longblob", "longtext");
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/exception/ResetPasswordException.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/exception/ResetPasswordException.java
index 4f8ecbb..b5f69b8 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/exception/ResetPasswordException.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/exception/ResetPasswordException.java
@@ -19,6 +19,7 @@
 package org.apache.fineract.infrastructure.security.exception;
 
 import java.util.ArrayList;
+import java.util.List;
 import org.apache.fineract.infrastructure.core.data.ApiParameterError;
 import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
 
@@ -31,17 +32,12 @@ public class ResetPasswordException extends PlatformApiDataValidationException {
     public ResetPasswordException(final Long userId) {
 
         super("error.msg.password.outdated", "The password of the user with id " + userId + " has expired, please reset it",
-                new ArrayList<ApiParameterError>() {
-
-                    {
-                        add(ApiParameterError.parameterError("error.msg.password.outdated", "The password of the user with id " + userId
-                                + " has expired, please reset it", "userId", userId));
-
-                    }
-                }
+                new ArrayList<ApiParameterError> (List.of(
+                        ApiParameterError.parameterError("error.msg.password.outdated", "The password of the user with id " + userId
+                                + " has expired, please reset it", "userId", userId)))
 
         );
 
     }
 
-}
\ No newline at end of file
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/SpringSecurityPlatformSecurityContext.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/SpringSecurityPlatformSecurityContext.java
index 6b9df79..9dcde6c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/SpringSecurityPlatformSecurityContext.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/SpringSecurityPlatformSecurityContext.java
@@ -49,12 +49,9 @@ public class SpringSecurityPlatformSecurityContext implements PlatformSecurityCo
 
     private final ConfigurationDomainService configurationDomainService;
 
-    protected static final List<CommandWrapper> EXEMPT_FROM_PASSWORD_RESET_CHECK = new ArrayList<CommandWrapper>() {
-
-        {
-            add(new CommandWrapperBuilder().updateUser(null).build());
-        }
-    };
+    protected static final List<CommandWrapper> EXEMPT_FROM_PASSWORD_RESET_CHECK = new ArrayList<CommandWrapper>(List.of(
+            new CommandWrapperBuilder().updateUser(null).build())
+    );
 
     @Autowired
     SpringSecurityPlatformSecurityContext(final ConfigurationDomainService configurationDomainService) {