FINERACT-822 Enforce NonCanonicalType check
This commit is contained in:
committed by
Michael Vorburger ⛑️
parent
e1e230d660
commit
fde3d9f83e
@@ -397,7 +397,6 @@ tasks.withType(JavaCompile) {
|
|||||||
"ProtectedMembersInFinalClass",
|
"ProtectedMembersInFinalClass",
|
||||||
"StaticAssignmentInConstructor",
|
"StaticAssignmentInConstructor",
|
||||||
"InvalidBlockTag",
|
"InvalidBlockTag",
|
||||||
"NonCanonicalType",
|
|
||||||
"InvalidInlineTag",
|
"InvalidInlineTag",
|
||||||
)
|
)
|
||||||
//TODO gradually enable these checks
|
//TODO gradually enable these checks
|
||||||
@@ -456,6 +455,7 @@ tasks.withType(JavaCompile) {
|
|||||||
"PublicConstructorForAbstractClass",
|
"PublicConstructorForAbstractClass",
|
||||||
"UnescapedEntity",
|
"UnescapedEntity",
|
||||||
"ModifyCollectionInEnhancedForLoop",
|
"ModifyCollectionInEnhancedForLoop",
|
||||||
|
"NonCanonicalType",
|
||||||
"OperatorPrecedence",
|
"OperatorPrecedence",
|
||||||
"EqualsGetClass",
|
"EqualsGetClass",
|
||||||
"EqualsUnsafeCast",
|
"EqualsUnsafeCast",
|
||||||
|
|||||||
+3
-2
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.batch.command;
|
package org.apache.fineract.batch.command;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import org.apache.fineract.batch.command.internal.UnknownCommandStrategy;
|
import org.apache.fineract.batch.command.internal.UnknownCommandStrategy;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -36,7 +37,7 @@ import org.springframework.stereotype.Component;
|
|||||||
public class CommandStrategyProvider {
|
public class CommandStrategyProvider {
|
||||||
|
|
||||||
private final ApplicationContext applicationContext;
|
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
|
* 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));
|
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())) {
|
if (commandContext.matcher(entry.getKey())) {
|
||||||
return (CommandStrategy) this.applicationContext.getBean(this.commandStrategies.get(entry.getKey()));
|
return (CommandStrategy) this.applicationContext.getBean(this.commandStrategies.get(entry.getKey()));
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -54,7 +54,7 @@ public class ColumnValidator {
|
|||||||
connection = this.jdbcTemplate.getDataSource().getConnection();
|
connection = this.jdbcTemplate.getDataSource().getConnection();
|
||||||
DatabaseMetaData dbMetaData = connection.getMetaData();
|
DatabaseMetaData dbMetaData = connection.getMetaData();
|
||||||
ResultSet resultSet = null;
|
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();
|
Set<String> columns = entry.getValue();
|
||||||
resultSet = dbMetaData.getColumns(null, null, entry.getKey(), null);
|
resultSet = dbMetaData.getColumns(null, null, entry.getKey(), null);
|
||||||
Set<String> tableColumns = getTableColumns(resultSet);
|
Set<String> tableColumns = getTableColumns(resultSet);
|
||||||
|
|||||||
@@ -48,10 +48,12 @@ public class RestAssuredFixture {
|
|||||||
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("TypeParameterUnusedInFormals")
|
||||||
public <T> T httpGet(String apiPath, String jsonAttributeToGetBack) {
|
public <T> T httpGet(String apiPath, String jsonAttributeToGetBack) {
|
||||||
return Utils.performServerGet(this.requestSpec, this.responseSpec, getApiPath(apiPath), jsonAttributeToGetBack);
|
return Utils.performServerGet(this.requestSpec, this.responseSpec, getApiPath(apiPath), jsonAttributeToGetBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("TypeParameterUnusedInFormals")
|
||||||
public <T> T httpGet(String apiPath) {
|
public <T> T httpGet(String apiPath) {
|
||||||
return httpGet(apiPath, "");
|
return httpGet(apiPath, "");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("TypeParameterUnusedInFormals")
|
||||||
public static <T> T performServerGet(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
public static <T> T performServerGet(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
||||||
final String getURL, final String jsonAttributeToGetBack) {
|
final String getURL, final String jsonAttributeToGetBack) {
|
||||||
final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(getURL).andReturn().asString();
|
final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(getURL).andReturn().asString();
|
||||||
|
|||||||
Reference in New Issue
Block a user