TSK-520: Replaced code smells found by FindBugs
This commit is contained in:
parent
2b1ee855cf
commit
dd0ad1253a
|
|
@ -98,7 +98,7 @@ public class ClassificationServiceImpl implements ClassificationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addClassificationToRootDomain(ClassificationImpl classificationImpl) {
|
private void addClassificationToRootDomain(ClassificationImpl classificationImpl) {
|
||||||
if (classificationImpl.getDomain() != "") {
|
if (!classificationImpl.getDomain().equals("")) {
|
||||||
boolean doesExist = true;
|
boolean doesExist = true;
|
||||||
String idBackup = classificationImpl.getId();
|
String idBackup = classificationImpl.getId();
|
||||||
String domainBackup = classificationImpl.getDomain();
|
String domainBackup = classificationImpl.getDomain();
|
||||||
|
|
@ -178,7 +178,14 @@ public class ClassificationServiceImpl implements ClassificationService {
|
||||||
}
|
}
|
||||||
classificationMapper.update(classificationImpl);
|
classificationMapper.update(classificationImpl);
|
||||||
boolean priorityChanged = oldClassification.getPriority() != classification.getPriority();
|
boolean priorityChanged = oldClassification.getPriority() != classification.getPriority();
|
||||||
boolean serviceLevelChanged = oldClassification.getServiceLevel() != classification.getServiceLevel();
|
boolean serviceLevelChanged = true;
|
||||||
|
if (oldClassification.getServiceLevel() == null) {
|
||||||
|
if (classification.getServiceLevel() == null) {
|
||||||
|
serviceLevelChanged = false;
|
||||||
|
}
|
||||||
|
} else if (oldClassification.getServiceLevel().equals(classification.getServiceLevel())) {
|
||||||
|
serviceLevelChanged = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (priorityChanged || serviceLevelChanged) {
|
if (priorityChanged || serviceLevelChanged) {
|
||||||
Map<String, String> args = new HashMap<>();
|
Map<String, String> args = new HashMap<>();
|
||||||
|
|
|
||||||
|
|
@ -297,7 +297,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
TaskImpl task = (TaskImpl) taskToCreate;
|
TaskImpl task = (TaskImpl) taskToCreate;
|
||||||
try {
|
try {
|
||||||
taskanaEngine.openConnection();
|
taskanaEngine.openConnection();
|
||||||
if (task.getId() != "" && task.getId() != null) {
|
if (task.getId() != null && !task.getId().equals("")) {
|
||||||
throw new TaskAlreadyExistException(task.getId());
|
throw new TaskAlreadyExistException(task.getId());
|
||||||
} else {
|
} else {
|
||||||
LOGGER.debug("Task {} cannot be be found, so it can be created.", task.getId());
|
LOGGER.debug("Task {} cannot be be found, so it can be created.", task.getId());
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import java.security.Principal;
|
||||||
import java.security.acl.Group;
|
import java.security.acl.Group;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -16,6 +17,7 @@ public class GroupPrincipal implements Group {
|
||||||
|
|
||||||
public GroupPrincipal(String name) {
|
public GroupPrincipal(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
this.members = new HashSet<Principal>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,9 @@ public class TestDataGenerator {
|
||||||
.forEach(runner::runScript);
|
.forEach(runner::runScript);
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
runner.closeConnection();
|
if (runner != null) {
|
||||||
|
runner.closeConnection();
|
||||||
|
}
|
||||||
LOGGER.debug(outWriter.toString());
|
LOGGER.debug(outWriter.toString());
|
||||||
if (!errorWriter.toString().trim().isEmpty()) {
|
if (!errorWriter.toString().trim().isEmpty()) {
|
||||||
LOGGER.error(errorWriter.toString());
|
LOGGER.error(errorWriter.toString());
|
||||||
|
|
@ -109,8 +111,9 @@ public class TestDataGenerator {
|
||||||
new ByteArrayInputStream(
|
new ByteArrayInputStream(
|
||||||
sqlReplacer.monitoringTestDataSql.getBytes(StandardCharsets.UTF_8))));
|
sqlReplacer.monitoringTestDataSql.getBytes(StandardCharsets.UTF_8))));
|
||||||
} finally {
|
} finally {
|
||||||
|
if (runner != null) {
|
||||||
runner.closeConnection();
|
runner.closeConnection();
|
||||||
|
}
|
||||||
LOGGER.debug(outWriter.toString());
|
LOGGER.debug(outWriter.toString());
|
||||||
if (!errorWriter.toString().trim().isEmpty()) {
|
if (!errorWriter.toString().trim().isEmpty()) {
|
||||||
LOGGER.error(errorWriter.toString());
|
LOGGER.error(errorWriter.toString());
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,9 @@ public abstract class AbstractPagingController {
|
||||||
|
|
||||||
protected String[] extractCommaSeparatedFields(List<String> list) {
|
protected String[] extractCommaSeparatedFields(List<String> list) {
|
||||||
List<String> values = new ArrayList<>();
|
List<String> values = new ArrayList<>();
|
||||||
list.forEach(item -> values.addAll(Arrays.asList(item.split(","))));
|
if (list != null) {
|
||||||
|
list.forEach(item -> values.addAll(Arrays.asList(item.split(","))));
|
||||||
|
}
|
||||||
return values.toArray(new String[0]);
|
return values.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue