Fix sonar findings on 21 style (#3020)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2026-04-15 16:57:10 +03:00
committed by GitHub
parent 643e96b7b1
commit 82ee1cc4e6
12 changed files with 284 additions and 273 deletions

View File

@@ -81,7 +81,7 @@ public class JpaConfiguration extends JpaBaseConfiguration {
@Override
protected Map<String, Object> getVendorProperties(final DataSource dataSource) {
final Map<String, Object> properties = new HashMap<>(7);
final Map<String, Object> properties = HashMap.newHashMap(7);
// Turn off dynamic weaving to disable LTW lookup in static weaving mode
properties.put(PersistenceUnitProperties.WEAVING, "false");
// needed for reports

View File

@@ -34,6 +34,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;
/**
@@ -154,13 +155,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();
@@ -198,9 +199,9 @@ public abstract class AbstractJpaBaseEntity implements BaseEntity {
}
protected boolean isController() {
return SecurityContextHolder.getContext().getAuthentication() != null &&
SecurityContextHolder.getContext().getAuthentication().getDetails()
instanceof TenantAwareAuthenticationDetails tenantAwareDetails &&
tenantAwareDetails.controller();
final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
return authentication != null
&& authentication.getDetails() instanceof TenantAwareAuthenticationDetails tenantAwareDetails
&& tenantAwareDetails.controller();
}
}