Fix sonar findings (#3015)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2026-04-15 13:14:31 +03:00
committed by GitHub
parent 0a0ab18fa2
commit a00374f455
32 changed files with 168 additions and 234 deletions

View File

@@ -36,6 +36,7 @@ import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
/**
@@ -159,13 +160,13 @@ public abstract class AbstractJpaBaseEntity implements BaseEntity {
return false;
}
final BaseEntity other = (BaseEntity) obj;
final Long id = getId();
final Long thisId = getId();
final Long otherId = other.getId();
if (id == null) {
if (thisId == null) {
if (otherId != null) {
return false;
}
} else if (!id.equals(otherId)) {
} else if (!thisId.equals(otherId)) {
return false;
}
return getOptLockRevision() == other.getOptLockRevision();
@@ -203,9 +204,9 @@ public abstract class AbstractJpaBaseEntity implements BaseEntity {
}
protected boolean isController() {
return SecurityContextHolder.getContext().getAuthentication() != null
&& SecurityContextHolder.getContext().getAuthentication()
.getDetails() instanceof TenantAwareAuthenticationDetails tenantAwareDetails
final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
return authentication != null
&& authentication.getDetails() instanceof TenantAwareAuthenticationDetails tenantAwareDetails
&& tenantAwareDetails.controller();
}
}