TSK-1710: Fixed a few code smells
This commit is contained in:
parent
c628426d0a
commit
2b7e7902a3
|
@ -163,8 +163,8 @@ public class DbSchemaCreator {
|
|||
|
||||
private boolean isSchemaPreexisting(Connection connection, String dbProductId) {
|
||||
ScriptRunner runner = getScriptRunnerInstance(connection);
|
||||
StringWriter errorWriter = new StringWriter();
|
||||
runner.setErrorLogWriter(new PrintWriter(errorWriter));
|
||||
StringWriter localErrorWriter = new StringWriter();
|
||||
runner.setErrorLogWriter(new PrintWriter(localErrorWriter));
|
||||
|
||||
String scriptPath = selectDbSchemaDetectionScript(dbProductId);
|
||||
try (InputStream resource = DbSchemaCreator.class.getResourceAsStream(scriptPath);
|
||||
|
@ -174,8 +174,8 @@ public class DbSchemaCreator {
|
|||
} catch (RuntimeSqlException | IOException e) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Schema does not exist.");
|
||||
if (!errorWriter.toString().trim().isEmpty()) {
|
||||
LOGGER.debug(errorWriter.toString());
|
||||
if (!localErrorWriter.toString().trim().isEmpty()) {
|
||||
LOGGER.debug(localErrorWriter.toString());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -4,7 +4,7 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
|
|||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class LogSanitizerTest {
|
||||
class LogSanitizerTest {
|
||||
|
||||
@Test
|
||||
void should_NotModifyInput_When_NothingHasToBeStripped() {
|
||||
|
|
|
@ -33,7 +33,6 @@ public class TaskHistoryQueryImpl implements TaskHistoryQuery {
|
|||
private final List<String> orderBy;
|
||||
private final List<String> orderColumns;
|
||||
|
||||
private TaskHistoryQueryColumnName columnName;
|
||||
private String[] idIn;
|
||||
private String[] businessProcessIdIn;
|
||||
private String[] parentBusinessProcessIdIn;
|
||||
|
@ -658,9 +657,8 @@ public class TaskHistoryQueryImpl implements TaskHistoryQuery {
|
|||
public List<String> listValues(
|
||||
TaskHistoryQueryColumnName dbColumnName, SortDirection sortDirection) {
|
||||
List<String> result = new ArrayList<>();
|
||||
this.columnName = dbColumnName;
|
||||
this.orderBy.clear();
|
||||
this.addOrderCriteria(columnName.toString(), sortDirection);
|
||||
this.addOrderCriteria(dbColumnName.toString(), sortDirection);
|
||||
|
||||
try {
|
||||
taskanaHistoryEngine.openConnection();
|
||||
|
@ -694,7 +692,7 @@ public class TaskHistoryQueryImpl implements TaskHistoryQuery {
|
|||
|
||||
@Override
|
||||
public long count() {
|
||||
Long rowCount = null;
|
||||
Long rowCount;
|
||||
try {
|
||||
taskanaHistoryEngine.openConnection();
|
||||
rowCount = taskanaHistoryEngine.getSqlSession().selectOne(LINK_TO_COUNTER, this);
|
||||
|
|
|
@ -31,7 +31,6 @@ public class WorkbasketHistoryQueryImpl implements WorkbasketHistoryQuery {
|
|||
|
||||
private TaskanaHistoryEngineImpl taskanaHistoryEngine;
|
||||
|
||||
private WorkbasketHistoryQueryColumnName columnName;
|
||||
private List<String> orderBy;
|
||||
private List<String> orderColumns;
|
||||
|
||||
|
@ -499,10 +498,9 @@ public class WorkbasketHistoryQueryImpl implements WorkbasketHistoryQuery {
|
|||
public List<String> listValues(
|
||||
WorkbasketHistoryQueryColumnName dbColumnName, SortDirection sortDirection) {
|
||||
List<String> result = new ArrayList<>();
|
||||
this.columnName = dbColumnName;
|
||||
List<String> cacheOrderBy = this.orderBy;
|
||||
this.orderBy.clear();
|
||||
this.addOrderCriteria(columnName.toString(), sortDirection);
|
||||
this.addOrderCriteria(dbColumnName.toString(), sortDirection);
|
||||
|
||||
try {
|
||||
taskanaHistoryEngine.openConnection();
|
||||
|
@ -513,7 +511,6 @@ public class WorkbasketHistoryQueryImpl implements WorkbasketHistoryQuery {
|
|||
return result;
|
||||
} finally {
|
||||
this.orderBy = cacheOrderBy;
|
||||
this.columnName = null;
|
||||
this.orderColumns.remove(orderColumns.size() - 1);
|
||||
taskanaHistoryEngine.returnConnection();
|
||||
}
|
||||
|
@ -537,7 +534,7 @@ public class WorkbasketHistoryQueryImpl implements WorkbasketHistoryQuery {
|
|||
|
||||
@Override
|
||||
public long count() {
|
||||
Long rowCount = null;
|
||||
Long rowCount;
|
||||
try {
|
||||
taskanaHistoryEngine.openConnection();
|
||||
rowCount = taskanaHistoryEngine.getSqlSession().selectOne(LINK_TO_COUNTER, this);
|
||||
|
|
|
@ -20,7 +20,7 @@ public abstract class AbstractTaskanaJob implements TaskanaJob {
|
|||
protected final ScheduledJob scheduledJob;
|
||||
private final boolean async;
|
||||
|
||||
public AbstractTaskanaJob(
|
||||
protected AbstractTaskanaJob(
|
||||
TaskanaEngine taskanaEngine,
|
||||
TaskanaTransactionProvider txProvider,
|
||||
ScheduledJob job,
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
import pro.taskana.common.rest.QueryParameter;
|
||||
|
||||
public class SpringArchitectureTest {
|
||||
class SpringArchitectureTest {
|
||||
private static JavaClasses importedClasses;
|
||||
|
||||
@BeforeAll
|
||||
|
|
Loading…
Reference in New Issue