FINERACT-822 Enforce NonCanonicalType check

This commit is contained in:
percyashu
2020-06-29 22:28:17 +02:00
committed by Michael Vorburger ⛑️
parent e1e230d660
commit fde3d9f83e
5 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -397,7 +397,6 @@ tasks.withType(JavaCompile) {
"ProtectedMembersInFinalClass",
"StaticAssignmentInConstructor",
"InvalidBlockTag",
"NonCanonicalType",
"InvalidInlineTag",
)
//TODO gradually enable these checks
@@ -456,6 +455,7 @@ tasks.withType(JavaCompile) {
"PublicConstructorForAbstractClass",
"UnescapedEntity",
"ModifyCollectionInEnhancedForLoop",
"NonCanonicalType",
"OperatorPrecedence",
"EqualsGetClass",
"EqualsUnsafeCast",
@@ -18,6 +18,7 @@
*/
package org.apache.fineract.batch.command;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.fineract.batch.command.internal.UnknownCommandStrategy;
import org.springframework.beans.factory.annotation.Autowired;
@@ -36,7 +37,7 @@ import org.springframework.stereotype.Component;
public class CommandStrategyProvider {
private final ApplicationContext applicationContext;
private final ConcurrentHashMap<CommandContext, String> commandStrategies = new ConcurrentHashMap<>();
private final Map<CommandContext, String> commandStrategies = new ConcurrentHashMap<>();
/**
* Constructs a CommandStrategyProvider with argument of ApplicationContext type. It also initialize
@@ -68,7 +69,7 @@ public class CommandStrategyProvider {
return (CommandStrategy) this.applicationContext.getBean(this.commandStrategies.get(commandContext));
}
for (ConcurrentHashMap.Entry<CommandContext, String> entry : this.commandStrategies.entrySet()) {
for (Map.Entry<CommandContext, String> entry : this.commandStrategies.entrySet()) {
if (commandContext.matcher(entry.getKey())) {
return (CommandStrategy) this.applicationContext.getBean(this.commandStrategies.get(entry.getKey()));
}
@@ -54,7 +54,7 @@ public class ColumnValidator {
connection = this.jdbcTemplate.getDataSource().getConnection();
DatabaseMetaData dbMetaData = connection.getMetaData();
ResultSet resultSet = null;
for (HashMap.Entry<String, Set<String>> entry : tableColumnMap.entrySet()) {
for (Map.Entry<String, Set<String>> entry : tableColumnMap.entrySet()) {
Set<String> columns = entry.getValue();
resultSet = dbMetaData.getColumns(null, null, entry.getKey(), null);
Set<String> tableColumns = getTableColumns(resultSet);
@@ -48,10 +48,12 @@ public class RestAssuredFixture {
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
}
@SuppressWarnings("TypeParameterUnusedInFormals")
public <T> T httpGet(String apiPath, String jsonAttributeToGetBack) {
return Utils.performServerGet(this.requestSpec, this.responseSpec, getApiPath(apiPath), jsonAttributeToGetBack);
}
@SuppressWarnings("TypeParameterUnusedInFormals")
public <T> T httpGet(String apiPath) {
return httpGet(apiPath, "");
}
@@ -69,6 +69,7 @@ public class Utils {
}
}
@SuppressWarnings("TypeParameterUnusedInFormals")
public static <T> T performServerGet(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String getURL, final String jsonAttributeToGetBack) {
final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(getURL).andReturn().asString();