Sonar issue fixed

Signed-off-by: Dominic Schabel <dominic.schabel@bosch-si.com>
This commit is contained in:
Dominic Schabel
2019-05-24 11:14:31 +02:00
parent c88e7bb06e
commit 509693d0ae
23 changed files with 97 additions and 94 deletions

View File

@@ -43,7 +43,7 @@ public interface Action extends TenantAwareBaseEntity {
* otherwise
*/
default boolean isCancelingOrCanceled() {
return Status.CANCELING.equals(getStatus()) || Status.CANCELED.equals(getStatus());
return Status.CANCELING == getStatus() || Status.CANCELED == getStatus();
}
/**
@@ -112,7 +112,7 @@ public interface Action extends TenantAwareBaseEntity {
* {@code false}
*/
default boolean isHitAutoForceTime(final long hitTimeMillis) {
if (ActionType.TIMEFORCED.equals(getActionType())) {
if (ActionType.TIMEFORCED == getActionType()) {
return hitTimeMillis >= getForcedTime();
}
return false;
@@ -139,7 +139,7 @@ public interface Action extends TenantAwareBaseEntity {
* @return true when action is forced, false otherwise
*/
default boolean isForced() {
return ActionType.FORCED.equals(getActionType());
return ActionType.FORCED == getActionType();
}
/**

View File

@@ -147,7 +147,7 @@ public class TotalTargetCountStatus {
// Exception squid:MethodCyclomaticComplexity - simple state conversion, not
// really complex.
@SuppressWarnings("squid:MethodCyclomaticComplexity")
private Status convertStatus(final Action.Status status){
private Status convertStatus(final Action.Status status) {
switch (status) {
case SCHEDULED:
return Status.SCHEDULED;
@@ -164,10 +164,9 @@ public class TotalTargetCountStatus {
case CANCELING:
return Status.RUNNING;
case DOWNLOADED:
return Action.ActionType.DOWNLOAD_ONLY.equals(rolloutType) ? Status.FINISHED : Status.RUNNING;
return Action.ActionType.DOWNLOAD_ONLY == rolloutType ? Status.FINISHED : Status.RUNNING;
default:
throw new IllegalArgumentException("State " + status + "is not valid");
}
}
}