Fix some issues found by qodana (#2083)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-11-19 17:04:19 +02:00
committed by GitHub
parent 9c8c82fd8b
commit a3468b2ba9
47 changed files with 124 additions and 98 deletions

View File

@@ -178,7 +178,7 @@ public class DdiRootController implements DdiRootControllerRestApi {
.orElseThrow(() -> new EntityNotFoundException(SoftwareModule.class, softwareModuleId)); .orElseThrow(() -> new EntityNotFoundException(SoftwareModule.class, softwareModuleId));
if (checkModule(fileName, module)) { if (checkModule(fileName, module)) {
log.warn("Software module with id {} could not be found.", softwareModuleId); log.warn("Software module with id {} could not be found (1).", softwareModuleId);
result = ResponseEntity.notFound().build(); result = ResponseEntity.notFound().build();
} else { } else {
// Artifact presence is ensured in 'checkModule' // Artifact presence is ensured in 'checkModule'
@@ -219,7 +219,7 @@ public class DdiRootController implements DdiRootControllerRestApi {
.orElseThrow(() -> new EntityNotFoundException(SoftwareModule.class, softwareModuleId)); .orElseThrow(() -> new EntityNotFoundException(SoftwareModule.class, softwareModuleId));
if (checkModule(fileName, module)) { if (checkModule(fileName, module)) {
log.warn("Software module with id {} could not be found.", softwareModuleId); log.warn("Software module with id {} could not be found (2).", softwareModuleId);
return ResponseEntity.notFound().build(); return ResponseEntity.notFound().build();
} }

View File

@@ -47,7 +47,7 @@ public class MgmtActionResource implements MgmtActionRestApi {
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting); final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
final Slice<Action> actions; final Slice<Action> actions;
final Long totalActionCount; final long totalActionCount;
if (rsqlParam != null) { if (rsqlParam != null) {
actions = this.deploymentManagement.findActions(rsqlParam, pageable); actions = this.deploymentManagement.findActions(rsqlParam, pageable);
totalActionCount = this.deploymentManagement.countActions(rsqlParam); totalActionCount = this.deploymentManagement.countActions(rsqlParam);

View File

@@ -9,6 +9,8 @@
*/ */
package org.eclipse.hawkbit.repository.event.remote.entity; package org.eclipse.hawkbit.repository.event.remote.entity;
import java.io.Serial;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.eclipse.hawkbit.repository.event.entity.EntityCreatedEvent; import org.eclipse.hawkbit.repository.event.entity.EntityCreatedEvent;
@@ -20,6 +22,7 @@ import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
@NoArgsConstructor(access = AccessLevel.PUBLIC) // for serialization libs like jackson @NoArgsConstructor(access = AccessLevel.PUBLIC) // for serialization libs like jackson
public class TargetFilterQueryCreatedEvent extends RemoteEntityEvent<TargetFilterQuery> implements EntityCreatedEvent { public class TargetFilterQueryCreatedEvent extends RemoteEntityEvent<TargetFilterQuery> implements EntityCreatedEvent {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**

View File

@@ -9,6 +9,7 @@
*/ */
package org.eclipse.hawkbit.repository.model; package org.eclipse.hawkbit.repository.model;
import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import lombok.Data; import lombok.Data;
@@ -20,6 +21,7 @@ import org.eclipse.hawkbit.repository.Identifiable;
@Data @Data
public class AssignedSoftwareModule implements Serializable, Identifiable<Long> { public class AssignedSoftwareModule implements Serializable, Identifiable<Long> {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final SoftwareModule softwareModule; private final SoftwareModule softwareModule;

View File

@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.repository.builder;
import java.util.Optional; import java.util.Optional;
import lombok.Getter;
import org.eclipse.hawkbit.repository.ValidString; import org.eclipse.hawkbit.repository.ValidString;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
@@ -22,6 +23,7 @@ import org.springframework.util.StringUtils;
public abstract class AbstractMetadataUpdateCreate<T> { public abstract class AbstractMetadataUpdateCreate<T> {
@ValidString @ValidString
@Getter
protected String key; protected String key;
@ValidString @ValidString
protected String value; protected String value;
@@ -31,10 +33,6 @@ public abstract class AbstractMetadataUpdateCreate<T> {
return (T) this; return (T) this;
} }
public String getKey() {
return key;
}
public T value(final String value) { public T value(final String value) {
this.value = StringUtils.trimWhitespace(value); this.value = StringUtils.trimWhitespace(value);
return (T) this; return (T) this;

View File

@@ -235,8 +235,7 @@ public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
// ValidatorFactory shall NOT be closed because after closing the generated Validator // ValidatorFactory shall NOT be closed because after closing the generated Validator
// methods shall not be called - we need the validator in future // methods shall not be called - we need the validator in future
processor.setValidator(Validation.byDefaultProvider().configure() processor.setValidator(Validation.byDefaultProvider().configure()
.addProperty(BaseHibernateValidatorConfiguration.ALLOW_PARALLEL_METHODS_DEFINE_PARAMETER_CONSTRAINTS, .addProperty(BaseHibernateValidatorConfiguration.ALLOW_PARALLEL_METHODS_DEFINE_PARAMETER_CONSTRAINTS,"true")
"true")
.buildValidatorFactory().getValidator()); .buildValidatorFactory().getValidator());
return processor; return processor;
} }

View File

@@ -120,7 +120,7 @@ public class AutoAssignChecker extends AbstractAutoAssignExecutor {
} catch (final PersistenceException | AbstractServerRtException e) { } catch (final PersistenceException | AbstractServerRtException e) {
log.error("Error during auto assign check of target filter query id {}", targetFilterQuery.getId(), e); log.error("Error during auto assign check of target filter query id {}", targetFilterQuery.getId(), e);
} }
log.debug("Auto assign check call for tenant {} and target filter query id {} finished", log.debug("Auto assign check call for tenant {} and target filter query id {} for device {} finished",
getContextAware().getCurrentTenant(), targetFilterQuery.getId()); getContextAware().getCurrentTenant(), targetFilterQuery.getId(), controllerId);
} }
} }

View File

@@ -36,7 +36,7 @@ public class AfterTransactionCommitDefaultServiceExecutor extends TransactionSyn
try { try {
afterCommitRunnable.run(); afterCommitRunnable.run();
} catch (final RuntimeException e) { } catch (final RuntimeException e) {
log.error("Failed to execute runnable " + afterCommitRunnable, e); log.error("Failed to execute runnable {}", afterCommitRunnable, e);
} }
} }
} }

View File

@@ -556,7 +556,7 @@ public class JpaDeploymentManagement extends JpaActionManagement implements Depl
try { try {
assertTargetUpdateAllowed(action); assertTargetUpdateAllowed(action);
forceQuitAction(action.getId()); forceQuitAction(action.getId());
log.debug("Action {} force canceled", action.getId()); log.debug("Action {} force canceled (force)", action.getId());
} catch (final InsufficientPermissionException e) { } catch (final InsufficientPermissionException e) {
log.trace("Could not cancel action {} due to insufficient permissions.", action.getId(), e); log.trace("Could not cancel action {} due to insufficient permissions.", action.getId(), e);
} catch (final EntityNotFoundException e) { } catch (final EntityNotFoundException e) {

View File

@@ -145,7 +145,7 @@ public class JpaTargetFilterQueryManagement implements TargetFilterQueryManageme
RSQLUtility.validateRsqlFor(query, TargetFields.class); RSQLUtility.validateRsqlFor(query, TargetFields.class);
return true; return true;
} catch (final RSQLParserException | RSQLParameterUnsupportedFieldException e) { } catch (final RSQLParserException | RSQLParameterUnsupportedFieldException e) {
log.debug("The RSQL query '" + query + "' is invalid.", e); log.debug("The RSQL query '{}}' is invalid.", query, e);
return false; return false;
} }
} }

View File

@@ -106,8 +106,8 @@ public class JpaTenantConfigurationManagement implements TenantConfigurationMana
} }
@Override @Override
public <T extends Serializable> TenantConfigurationValue<T> getConfigurationValue( @Cacheable(value = "tenantConfiguration", key = "#configurationKeyName")
final String configurationKeyName) { public <T extends Serializable> TenantConfigurationValue<T> getConfigurationValue(final String configurationKeyName) {
checkAccess(configurationKeyName); checkAccess(configurationKeyName);
final TenantConfigurationKey configurationKey = tenantConfigurationProperties.fromKeyName(configurationKeyName); final TenantConfigurationKey configurationKey = tenantConfigurationProperties.fromKeyName(configurationKeyName);
@@ -117,16 +117,15 @@ public class JpaTenantConfigurationManagement implements TenantConfigurationMana
@Override @Override
@Cacheable(value = "tenantConfiguration", key = "#configurationKeyName") @Cacheable(value = "tenantConfiguration", key = "#configurationKeyName")
public <T extends Serializable> TenantConfigurationValue<T> getConfigurationValue(final String configurationKeyName, public <T extends Serializable> TenantConfigurationValue<T> getConfigurationValue(
final Class<T> propertyType) { final String configurationKeyName, final Class<T> propertyType) {
checkAccess(configurationKeyName); checkAccess(configurationKeyName);
final TenantConfigurationKey configurationKey = tenantConfigurationProperties.fromKeyName(configurationKeyName); final TenantConfigurationKey configurationKey = tenantConfigurationProperties.fromKeyName(configurationKeyName);
validateTenantConfigurationDataType(configurationKey, propertyType); validateTenantConfigurationDataType(configurationKey, propertyType);
final TenantConfiguration tenantConfiguration = tenantConfigurationRepository final TenantConfiguration tenantConfiguration = tenantConfigurationRepository.findByKey(configurationKey.getKeyName());
.findByKey(configurationKey.getKeyName());
return buildTenantConfigurationValueByKey(configurationKey, propertyType, tenantConfiguration); return buildTenantConfigurationValueByKey(configurationKey, propertyType, tenantConfiguration);
} }

View File

@@ -9,6 +9,7 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.model; package org.eclipse.hawkbit.repository.jpa.model;
import java.io.Serial;
import java.util.Objects; import java.util.Objects;
import jakarta.persistence.Basic; import jakarta.persistence.Basic;
@@ -26,6 +27,7 @@ import org.eclipse.hawkbit.repository.model.MetaData;
@MappedSuperclass @MappedSuperclass
public abstract class AbstractJpaMetaData implements MetaData { public abstract class AbstractJpaMetaData implements MetaData {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id

View File

@@ -24,8 +24,7 @@ import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
* addition to their technical ID. * addition to their technical ID.
*/ */
@MappedSuperclass @MappedSuperclass
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for // exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for sub entities
// sub entities
@SuppressWarnings("squid:S2160") @SuppressWarnings("squid:S2160")
public abstract class AbstractJpaNamedEntity extends AbstractJpaTenantAwareBaseEntity implements NamedEntity { public abstract class AbstractJpaNamedEntity extends AbstractJpaTenantAwareBaseEntity implements NamedEntity {

View File

@@ -9,6 +9,8 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.model; package org.eclipse.hawkbit.repository.jpa.model;
import java.io.Serial;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.MappedSuperclass; import jakarta.persistence.MappedSuperclass;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
@@ -21,11 +23,11 @@ import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
* Extension for {@link NamedEntity} that are versioned. * Extension for {@link NamedEntity} that are versioned.
*/ */
@MappedSuperclass @MappedSuperclass
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for // exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for sub entities
// sub entities
@SuppressWarnings("squid:S2160") @SuppressWarnings("squid:S2160")
public abstract class AbstractJpaNamedVersionedEntity extends AbstractJpaNamedEntity implements NamedVersionedEntity { public abstract class AbstractJpaNamedVersionedEntity extends AbstractJpaNamedEntity implements NamedVersionedEntity {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Column(name = "version", nullable = false, length = NamedVersionedEntity.VERSION_MAX_SIZE) @Column(name = "version", nullable = false, length = NamedVersionedEntity.VERSION_MAX_SIZE)

View File

@@ -9,6 +9,8 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.model; package org.eclipse.hawkbit.repository.jpa.model;
import java.io.Serial;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.MappedSuperclass; import jakarta.persistence.MappedSuperclass;
import jakarta.persistence.PrePersist; import jakarta.persistence.PrePersist;
@@ -31,6 +33,7 @@ import org.eclipse.persistence.annotations.TenantDiscriminatorColumn;
@Multitenant(MultitenantType.SINGLE_TABLE) @Multitenant(MultitenantType.SINGLE_TABLE)
public abstract class AbstractJpaTenantAwareBaseEntity extends AbstractJpaBaseEntity implements TenantAwareBaseEntity { public abstract class AbstractJpaTenantAwareBaseEntity extends AbstractJpaBaseEntity implements TenantAwareBaseEntity {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Column(name = "tenant", nullable = false, insertable = false, updatable = false, length = 40) @Column(name = "tenant", nullable = false, insertable = false, updatable = false, length = 40)

View File

@@ -9,6 +9,7 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.model; package org.eclipse.hawkbit.repository.jpa.model;
import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import jakarta.persistence.Column; import jakarta.persistence.Column;
@@ -34,6 +35,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
@Table(name = "sp_ds_type_element") @Table(name = "sp_ds_type_element")
public class DistributionSetTypeElement implements Serializable { public class DistributionSetTypeElement implements Serializable {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@EmbeddedId @EmbeddedId

View File

@@ -9,6 +9,7 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.model; package org.eclipse.hawkbit.repository.jpa.model;
import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import jakarta.persistence.Column; import jakarta.persistence.Column;
@@ -20,6 +21,7 @@ import jakarta.persistence.Embeddable;
@Embeddable @Embeddable
public class DistributionSetTypeElementCompositeKey implements Serializable { public class DistributionSetTypeElementCompositeKey implements Serializable {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Column(name = "distribution_set_type", nullable = false, updatable = false) @Column(name = "distribution_set_type", nullable = false, updatable = false)

View File

@@ -9,6 +9,7 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.model; package org.eclipse.hawkbit.repository.jpa.model;
import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
/** /**
@@ -17,6 +18,7 @@ import java.io.Serializable;
*/ */
public final class DsMetadataCompositeKey implements Serializable { public final class DsMetadataCompositeKey implements Serializable {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String key; private String key;

View File

@@ -9,6 +9,8 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.model; package org.eclipse.hawkbit.repository.jpa.model;
import java.io.Serial;
import jakarta.persistence.CascadeType; import jakarta.persistence.CascadeType;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.ConstraintMode; import jakarta.persistence.ConstraintMode;
@@ -34,11 +36,11 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
@Index(name = "sp_idx_artifact_02", columnList = "tenant,sha1_hash"), @Index(name = "sp_idx_artifact_02", columnList = "tenant,sha1_hash"),
@Index(name = "sp_idx_artifact_prim", columnList = "tenant,id") }) @Index(name = "sp_idx_artifact_prim", columnList = "tenant,id") })
@Entity @Entity
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for // exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for sub entities
// sub entities
@SuppressWarnings("squid:S2160") @SuppressWarnings("squid:S2160")
public class JpaArtifact extends AbstractJpaTenantAwareBaseEntity implements Artifact { public class JpaArtifact extends AbstractJpaTenantAwareBaseEntity implements Artifact {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Column(name = "sha1_hash", length = 40, nullable = false, updatable = false) @Column(name = "sha1_hash", length = 40, nullable = false, updatable = false)

View File

@@ -66,8 +66,7 @@ import org.springframework.context.ApplicationEvent;
@Index(name = "sp_idx_distribution_set_prim", columnList = "tenant,id") }) @Index(name = "sp_idx_distribution_set_prim", columnList = "tenant,id") })
@NamedEntityGraph(name = "DistributionSet.detail", attributeNodes = { @NamedAttributeNode("modules"), @NamedEntityGraph(name = "DistributionSet.detail", attributeNodes = { @NamedAttributeNode("modules"),
@NamedAttributeNode("tags"), @NamedAttributeNode("type") }) @NamedAttributeNode("tags"), @NamedAttributeNode("type") })
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for // exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for sub entities
// sub entities
@SuppressWarnings("squid:S2160") @SuppressWarnings("squid:S2160")
public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implements DistributionSet, EventAwareEntity { public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implements DistributionSet, EventAwareEntity {

View File

@@ -9,6 +9,8 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.model; package org.eclipse.hawkbit.repository.jpa.model;
import java.io.Serial;
import jakarta.persistence.ConstraintMode; import jakarta.persistence.ConstraintMode;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
import jakarta.persistence.FetchType; import jakarta.persistence.FetchType;
@@ -30,6 +32,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
@Table(name = "sp_ds_metadata") @Table(name = "sp_ds_metadata")
public class JpaDistributionSetMetadata extends AbstractJpaMetaData implements DistributionSetMetadata { public class JpaDistributionSetMetadata extends AbstractJpaMetaData implements DistributionSetMetadata {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id

View File

@@ -9,6 +9,7 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.model; package org.eclipse.hawkbit.repository.jpa.model;
import java.io.Serial;
import java.util.List; import java.util.List;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
@@ -30,12 +31,14 @@ import org.eclipse.hawkbit.repository.model.helper.EventPublisherHolder;
* and use them also for filtering the DistributionSet list. * and use them also for filtering the DistributionSet list.
*/ */
@Entity @Entity
@Table(name = "sp_distributionset_tag", indexes = { @Table(name = "sp_distributionset_tag",
indexes = {
@Index(name = "sp_idx_distribution_set_tag_prim", columnList = "tenant,id"), @Index(name = "sp_idx_distribution_set_tag_prim", columnList = "tenant,id"),
@Index(name = "sp_idx_distribution_set_tag_01", columnList = "tenant,name") }, uniqueConstraints = @UniqueConstraint(columnNames = { @Index(name = "sp_idx_distribution_set_tag_01", columnList = "tenant,name") },
"name", "tenant" }, name = "uk_ds_tag")) uniqueConstraints = @UniqueConstraint(columnNames = { "name", "tenant" }, name = "uk_ds_tag"))
public class JpaDistributionSetTag extends JpaTag implements DistributionSetTag, EventAwareEntity { public class JpaDistributionSetTag extends JpaTag implements DistributionSetTag, EventAwareEntity {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ManyToMany(mappedBy = "tags", targetEntity = JpaDistributionSet.class, fetch = FetchType.LAZY) @ManyToMany(mappedBy = "tags", targetEntity = JpaDistributionSet.class, fetch = FetchType.LAZY)

View File

@@ -48,8 +48,7 @@ import org.springframework.util.CollectionUtils;
@Index(name = "sp_idx_distribution_set_type_prim", columnList = "tenant,id") }, uniqueConstraints = { @Index(name = "sp_idx_distribution_set_type_prim", columnList = "tenant,id") }, uniqueConstraints = {
@UniqueConstraint(columnNames = { "name", "tenant" }, name = "uk_dst_name"), @UniqueConstraint(columnNames = { "name", "tenant" }, name = "uk_dst_name"),
@UniqueConstraint(columnNames = { "type_key", "tenant" }, name = "uk_dst_key") }) @UniqueConstraint(columnNames = { "type_key", "tenant" }, name = "uk_dst_key") })
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for // exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for sub entities
// sub entities
@SuppressWarnings("squid:S2160") @SuppressWarnings("squid:S2160")
public class JpaDistributionSetType extends AbstractJpaTypeEntity implements DistributionSetType, EventAwareEntity { public class JpaDistributionSetType extends AbstractJpaTypeEntity implements DistributionSetType, EventAwareEntity {
@@ -136,11 +135,11 @@ public class JpaDistributionSetType extends AbstractJpaTypeEntity implements Dis
@Override @Override
public boolean checkComplete(final DistributionSet distributionSet) { public boolean checkComplete(final DistributionSet distributionSet) {
final List<SoftwareModuleType> smTypes = distributionSet.getModules().stream().map(SoftwareModule::getType) final List<SoftwareModuleType> smTypes = distributionSet.getModules().stream().map(SoftwareModule::getType)
.distinct().collect(Collectors.toList()); .distinct().toList();
if (smTypes.isEmpty()) { if (smTypes.isEmpty()) {
return false; return false;
} }
return smTypes.containsAll(getMandatoryModuleTypes()); return new HashSet<>(smTypes).containsAll(getMandatoryModuleTypes());
} }
public JpaDistributionSetType addOptionalModuleType(final SoftwareModuleType smType) { public JpaDistributionSetType addOptionalModuleType(final SoftwareModuleType smType) {

View File

@@ -61,8 +61,7 @@ import org.eclipse.hawkbit.repository.model.helper.EventPublisherHolder;
@Index(name = "sp_idx_base_sw_module_02", columnList = "tenant,deleted,module_type"), @Index(name = "sp_idx_base_sw_module_02", columnList = "tenant,deleted,module_type"),
@Index(name = "sp_idx_base_sw_module_prim", columnList = "tenant,id") }) @Index(name = "sp_idx_base_sw_module_prim", columnList = "tenant,id") })
@NamedEntityGraph(name = "SoftwareModule.artifacts", attributeNodes = { @NamedAttributeNode("artifacts") }) @NamedEntityGraph(name = "SoftwareModule.artifacts", attributeNodes = { @NamedAttributeNode("artifacts") })
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for // exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for sub entities
// sub entities
@SuppressWarnings("squid:S2160") @SuppressWarnings("squid:S2160")
public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implements SoftwareModule, EventAwareEntity { public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implements SoftwareModule, EventAwareEntity {

View File

@@ -9,6 +9,8 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.model; package org.eclipse.hawkbit.repository.jpa.model;
import java.io.Serial;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.ConstraintMode; import jakarta.persistence.ConstraintMode;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
@@ -31,6 +33,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
@Table(name = "sp_sw_metadata") @Table(name = "sp_sw_metadata")
public class JpaSoftwareModuleMetadata extends AbstractJpaMetaData implements SoftwareModuleMetadata { public class JpaSoftwareModuleMetadata extends AbstractJpaMetaData implements SoftwareModuleMetadata {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id

View File

@@ -33,8 +33,7 @@ import org.eclipse.hawkbit.repository.model.helper.EventPublisherHolder;
@Index(name = "sp_idx_software_module_type_prim", columnList = "tenant,id") }, uniqueConstraints = { @Index(name = "sp_idx_software_module_type_prim", columnList = "tenant,id") }, uniqueConstraints = {
@UniqueConstraint(columnNames = { "type_key", "tenant" }, name = "uk_smt_type_key"), @UniqueConstraint(columnNames = { "type_key", "tenant" }, name = "uk_smt_type_key"),
@UniqueConstraint(columnNames = { "name", "tenant" }, name = "uk_smt_name") }) @UniqueConstraint(columnNames = { "name", "tenant" }, name = "uk_smt_name") })
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for // exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for sub entities
// sub entities
@SuppressWarnings("squid:S2160") @SuppressWarnings("squid:S2160")
public class JpaSoftwareModuleType extends AbstractJpaTypeEntity implements SoftwareModuleType, EventAwareEntity { public class JpaSoftwareModuleType extends AbstractJpaTypeEntity implements SoftwareModuleType, EventAwareEntity {

View File

@@ -9,6 +9,8 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.model; package org.eclipse.hawkbit.repository.jpa.model;
import java.io.Serial;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.MappedSuperclass; import jakarta.persistence.MappedSuperclass;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
@@ -20,11 +22,11 @@ import org.eclipse.hawkbit.repository.model.Tag;
* kind of entity. * kind of entity.
*/ */
@MappedSuperclass @MappedSuperclass
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for // exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for sub entities
// sub entities
@SuppressWarnings("squid:S2160") @SuppressWarnings("squid:S2160")
public class JpaTag extends AbstractJpaNamedEntity implements Tag { public class JpaTag extends AbstractJpaNamedEntity implements Tag {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Column(name = "colour", nullable = true, length = Tag.COLOUR_MAX_SIZE) @Column(name = "colour", nullable = true, length = Tag.COLOUR_MAX_SIZE)

View File

@@ -76,8 +76,7 @@ import org.eclipse.hawkbit.security.SystemSecurityContext;
@Index(name = "sp_idx_target_05", columnList = "tenant,last_modified_at"), @Index(name = "sp_idx_target_05", columnList = "tenant,last_modified_at"),
@Index(name = "sp_idx_target_prim", columnList = "tenant,id") }, uniqueConstraints = @UniqueConstraint(columnNames = { @Index(name = "sp_idx_target_prim", columnList = "tenant,id") }, uniqueConstraints = @UniqueConstraint(columnNames = {
"controller_id", "tenant" }, name = "uk_tenant_controller_id")) "controller_id", "tenant" }, name = "uk_tenant_controller_id"))
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for // exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for sub entities
// sub entities
@SuppressWarnings("squid:S2160") @SuppressWarnings("squid:S2160")
@Slf4j @Slf4j
public class JpaTarget extends AbstractJpaNamedEntity implements Target, EventAwareEntity { public class JpaTarget extends AbstractJpaNamedEntity implements Target, EventAwareEntity {

View File

@@ -9,6 +9,8 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.model; package org.eclipse.hawkbit.repository.jpa.model;
import java.io.Serial;
import jakarta.persistence.ConstraintMode; import jakarta.persistence.ConstraintMode;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
import jakarta.persistence.FetchType; import jakarta.persistence.FetchType;
@@ -30,6 +32,7 @@ import org.eclipse.hawkbit.repository.model.TargetMetadata;
@Table(name = "sp_target_metadata") @Table(name = "sp_target_metadata")
public class JpaTargetMetadata extends AbstractJpaMetaData implements TargetMetadata { public class JpaTargetMetadata extends AbstractJpaMetaData implements TargetMetadata {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id

View File

@@ -9,6 +9,8 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.model; package org.eclipse.hawkbit.repository.jpa.model;
import java.io.Serial;
import jakarta.persistence.Basic; import jakarta.persistence.Basic;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
@@ -29,12 +31,11 @@ import org.eclipse.hawkbit.repository.model.helper.EventPublisherHolder;
@Entity @Entity
@Table(name = "sp_tenant_configuration", uniqueConstraints = @UniqueConstraint(columnNames = { "conf_key", @Table(name = "sp_tenant_configuration", uniqueConstraints = @UniqueConstraint(columnNames = { "conf_key",
"tenant" }, name = "uk_tenant_key")) "tenant" }, name = "uk_tenant_key"))
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for // exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for sub entities
// sub entities
@SuppressWarnings("squid:S2160") @SuppressWarnings("squid:S2160")
public class JpaTenantConfiguration extends AbstractJpaTenantAwareBaseEntity public class JpaTenantConfiguration extends AbstractJpaTenantAwareBaseEntity implements TenantConfiguration, EventAwareEntity {
implements TenantConfiguration, EventAwareEntity {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Column(name = "conf_key", length = TenantConfiguration.KEY_MAX_SIZE, nullable = false, updatable = false) @Column(name = "conf_key", length = TenantConfiguration.KEY_MAX_SIZE, nullable = false, updatable = false)

View File

@@ -9,6 +9,8 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.model; package org.eclipse.hawkbit.repository.jpa.model;
import java.io.Serial;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.ConstraintMode; import jakarta.persistence.ConstraintMode;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
@@ -38,11 +40,11 @@ import org.eclipse.hawkbit.repository.model.TenantMetaData;
@Index(name = "sp_idx_tenant_prim", columnList = "tenant,id") }, uniqueConstraints = { @Index(name = "sp_idx_tenant_prim", columnList = "tenant,id") }, uniqueConstraints = {
@UniqueConstraint(columnNames = { "tenant" }, name = "uk_tenantmd_tenant") }) @UniqueConstraint(columnNames = { "tenant" }, name = "uk_tenantmd_tenant") })
@Entity @Entity
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for // exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for sub entities
// sub entities
@SuppressWarnings("squid:S2160") @SuppressWarnings("squid:S2160")
public class JpaTenantMetaData extends AbstractJpaBaseEntity implements TenantMetaData { public class JpaTenantMetaData extends AbstractJpaBaseEntity implements TenantMetaData {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Column(name = "tenant", nullable = false, updatable = false, length = 40) @Column(name = "tenant", nullable = false, updatable = false, length = 40)

View File

@@ -9,6 +9,7 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.model; package org.eclipse.hawkbit.repository.jpa.model;
import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import org.eclipse.hawkbit.repository.model.RolloutGroup; import org.eclipse.hawkbit.repository.model.RolloutGroup;
@@ -19,6 +20,7 @@ import org.eclipse.hawkbit.repository.model.Target;
*/ */
public class RolloutTargetGroupId implements Serializable { public class RolloutTargetGroupId implements Serializable {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Long rolloutGroup; private Long rolloutGroup;

View File

@@ -9,30 +9,27 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.model; package org.eclipse.hawkbit.repository.jpa.model;
import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import lombok.NoArgsConstructor;
/** /**
* The Software Module meta data composite key which contains the meta data key * The Software Module meta-data composite key which contains the meta-data key
* and the ID of the software module itself. * and the ID of the software module itself.
*/ */
@NoArgsConstructor // Default constructor for JPA
public final class SwMetadataCompositeKey implements Serializable { public final class SwMetadataCompositeKey implements Serializable {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String key; private String key;
private Long softwareModule; private Long softwareModule;
/** /**
* Default constructor for JPA. * @param moduleId the software module for this meta-data
*/ * @param key the key of the meta-data
public SwMetadataCompositeKey() {
// Default constructor for JPA.
}
/**
* @param moduleId the software module for this meta data
* @param key the key of the meta data
*/ */
public SwMetadataCompositeKey(final Long moduleId, final String key) { public SwMetadataCompositeKey(final Long moduleId, final String key) {
this.softwareModule = moduleId; this.softwareModule = moduleId;

View File

@@ -9,28 +9,27 @@
*/ */
package org.eclipse.hawkbit.repository.jpa.model; package org.eclipse.hawkbit.repository.jpa.model;
import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
import lombok.NoArgsConstructor;
/** /**
* The Target Metadata composite key which contains the meta data key and the ID * The Target Metadata composite key which contains the meta-data key and the ID of the Target itself.
* of the Target itself.
*/ */
@NoArgsConstructor // Default constructor for JPA
public final class TargetMetadataCompositeKey implements Serializable { public final class TargetMetadataCompositeKey implements Serializable {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String key; private String key;
private Long target; private Long target;
public TargetMetadataCompositeKey() {
// Default constructor for JPA.
}
/** /**
* @param target the target Id for this meta data * @param target the target Id for this meta-data
* @param key the key of the meta data * @param key the key of the meta-data
*/ */
public TargetMetadataCompositeKey(final Long target, final String key) { public TargetMetadataCompositeKey(final Long target, final String key) {
this.target = target; this.target = target;

View File

@@ -77,7 +77,7 @@ public class RolloutGroupEvaluationManager {
final List<RolloutGroupActionEvaluator<T>> evaluators, final T action) { final List<RolloutGroupActionEvaluator<T>> evaluators, final T action) {
return evaluators.stream().filter(evaluator -> evaluator.getAction() == action).findFirst().orElseThrow(() -> { return evaluators.stream().filter(evaluator -> evaluator.getAction() == action).findFirst().orElseThrow(() -> {
log.warn("Could not find suitable evaluator for the '{}' action.", action.name()); log.warn("Could not find suitable evaluator for the '{}' action.", action.name());
throw new EvaluatorNotConfiguredException(action.name()); return new EvaluatorNotConfiguredException(action.name());
}); });
} }
@@ -86,7 +86,7 @@ public class RolloutGroupEvaluationManager {
return evaluators.stream().filter(evaluator -> evaluator.getCondition() == condition).findFirst() return evaluators.stream().filter(evaluator -> evaluator.getCondition() == condition).findFirst()
.orElseThrow(() -> { .orElseThrow(() -> {
log.warn("Could not find suitable evaluator for the '{}' condition.", condition.name()); log.warn("Could not find suitable evaluator for the '{}' condition.", condition.name());
throw new EvaluatorNotConfiguredException(condition.name()); return new EvaluatorNotConfiguredException(condition.name());
}); });
} }
} }

View File

@@ -39,7 +39,7 @@ public class ThresholdRolloutGroupErrorCondition
final Long error = actionRepository.countByRolloutIdAndRolloutGroupIdAndStatus(rollout.getId(), final Long error = actionRepository.countByRolloutIdAndRolloutGroupIdAndStatus(rollout.getId(),
rolloutGroup.getId(), Action.Status.ERROR); rolloutGroup.getId(), Action.Status.ERROR);
try { try {
final Integer threshold = Integer.valueOf(expression); final int threshold = Integer.parseInt(expression);
if (totalGroup == 0) { if (totalGroup == 0) {
// in case e.g. targets has been deleted we don't have any // in case e.g. targets has been deleted we don't have any
@@ -50,7 +50,7 @@ public class ThresholdRolloutGroupErrorCondition
// calculate threshold // calculate threshold
return ((float) error / (float) totalGroup) > ((float) threshold / 100F); return ((float) error / (float) totalGroup) > ((float) threshold / 100F);
} catch (final NumberFormatException e) { } catch (final NumberFormatException e) {
log.error("Cannot evaluate condition expression " + expression, e); log.error("Cannot evaluate condition expression {}", expression, e);
return false; return false;
} }
} }

View File

@@ -54,7 +54,7 @@ public class ThresholdRolloutGroupSuccessCondition
return ((float) finished / (float) totalGroup) >= ((float) threshold / 100F); return ((float) finished / (float) totalGroup) >= ((float) threshold / 100F);
} catch (final NumberFormatException e) { } catch (final NumberFormatException e) {
log.error("Cannot evaluate condition expression " + expression, e); log.error("Cannot evaluate condition expression {}", expression, e);
return false; return false;
} }
} }

View File

@@ -225,15 +225,15 @@ public class RsqlParserValidationOracle implements RsqlValidationOracle {
return builder; return builder;
} }
builder = message.substring(message.indexOf(':') + 1, message.length()); builder = message.substring(message.indexOf(':') + 1);
if (builder.indexOf("Was expecting") != -1) { if (builder.contains("Was expecting")) {
builder = builder.substring(0, builder.lastIndexOf("Was expecting")); builder = builder.substring(0, builder.lastIndexOf("Was expecting"));
} }
if (!CollectionUtils.isEmpty(expectedTokens)) { if (!CollectionUtils.isEmpty(expectedTokens)) {
final StringBuilder tokens = new StringBuilder(); final StringBuilder tokens = new StringBuilder();
expectedTokens.stream().forEach(value -> tokens.append(value.getSuggestion() + ",")); expectedTokens.stream().forEach(value -> tokens.append(value.getSuggestion()).append(","));
builder = builder.concat("Was expecting :" + tokens.toString().substring(0, tokens.length() - 1)); builder = builder.concat("Was expecting :" + tokens.substring(0, tokens.length() - 1));
} }
builder = builder.replace('\r', ' '); builder = builder.replace('\r', ' ');
builder = builder.replace('\n', ' '); builder = builder.replace('\n', ' ');
@@ -290,7 +290,7 @@ public class RsqlParserValidationOracle implements RsqlValidationOracle {
final String finalTmpTokenName = tmpTokenName; final String finalTmpTokenName = tmpTokenName;
return Arrays.stream(TargetFields.values()) return Arrays.stream(TargetFields.values())
.filter(field -> field.toString().equalsIgnoreCase(finalTmpTokenName)) .filter(field -> field.toString().equalsIgnoreCase(finalTmpTokenName))
.map(TargetFields::getSubEntityAttributes).flatMap(List::stream).count() > 0; .map(TargetFields::getSubEntityAttributes).mapToLong(List::size).sum() > 0;
} }
private static boolean isMap(final String tokenImageName) { private static boolean isMap(final String tokenImageName) {
@@ -316,16 +316,14 @@ public class RsqlParserValidationOracle implements RsqlValidationOracle {
private static boolean containsValue(final String imageName) { private static boolean containsValue(final String imageName) {
if (!imageName.contains(".")) { if (!imageName.contains(".")) {
return FIELD_NAMES.stream().filter(value -> value.equalsIgnoreCase(imageName)).count() > 0; return FIELD_NAMES.stream().anyMatch(value -> value.equalsIgnoreCase(imageName));
} }
final String[] split = imageName.split("\\."); final String[] split = imageName.split("\\.");
if (split.length > 1 && FIELD_NAMES.contains(split[0].toLowerCase())) { if (split.length > 1 && FIELD_NAMES.contains(split[0].toLowerCase())) {
return SUB_NAMES.get(split[0].toLowerCase()).stream() return SUB_NAMES.get(split[0].toLowerCase()).stream()
.filter(subname -> (split[0] + "." + subname).equalsIgnoreCase(imageName)).count() > 0; .anyMatch(subname -> (split[0] + "." + subname).equalsIgnoreCase(imageName));
} }
return FIELD_NAMES.stream().filter(value -> value.equalsIgnoreCase(imageName)).count() > 0; return FIELD_NAMES.stream().anyMatch(value -> value.equalsIgnoreCase(imageName));
} }
} }
} }

View File

@@ -578,7 +578,7 @@ public final class TargetSpecifications {
hasTagsPredicates.add(exp.isNull()); hasTagsPredicates.add(exp.isNull());
} }
if (isAtLeastOneTagActive(tagNames)) { if (isAtLeastOneTagActive(tagNames)) {
hasTagsPredicates.add(exp.in(tagNames)); hasTagsPredicates.add(exp.in((Object[]) tagNames));
} }
return hasTagsPredicates.stream().reduce(cb::or) return hasTagsPredicates.stream().reduce(cb::or)

View File

@@ -14,6 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
import java.io.Serial;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
@@ -175,11 +176,11 @@ public class EventVerifier extends AbstractTestExecutionListener {
private static final class ResetCounterMarkerEvent extends RemoteApplicationEvent { private static final class ResetCounterMarkerEvent extends RemoteApplicationEvent {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private ResetCounterMarkerEvent() { private ResetCounterMarkerEvent() {
super(new Object(), "resetcounter"); super(new Object(), "resetcounter");
} }
} }
} }

View File

@@ -10,6 +10,7 @@
package org.eclipse.hawkbit.rest.json.model; package org.eclipse.hawkbit.rest.json.model;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;
@@ -74,7 +75,7 @@ public class ResponseList<T> extends RepresentationModel<ResponseList<T>> implem
@Override @Override
public boolean containsAll(final Collection<?> c) { public boolean containsAll(final Collection<?> c) {
return content.containsAll(c); return new HashSet<>(content).containsAll(c);
} }
@Override @Override

View File

@@ -208,8 +208,8 @@ public final class FileStreamingUtil {
if (ifRangeTime != -1 && ifRangeTime + 1000 < lastModified) { if (ifRangeTime != -1 && ifRangeTime + 1000 < lastModified) {
ranges.add(full); ranges.add(full);
} }
} catch (final IllegalArgumentException ignore) { } catch (final IllegalArgumentException ignored) {
log.info("Invalid if-range header field", ignore); log.info("Invalid if-range header field", ignored);
ranges.add(full); ranges.add(full);
} }
} }

View File

@@ -74,7 +74,7 @@ public class DmfApp {
public void stopOne(@ShellOption("--id") final String controllerId) { public void stopOne(@ShellOption("--id") final String controllerId) {
dmfTenant.getController(controllerId).ifPresentOrElse( dmfTenant.getController(controllerId).ifPresentOrElse(
DmfController::stop, DmfController::stop,
() -> log.error("Controller with id " + controllerId + " not found!")); () -> log.error("Controller with id {} not found!", controllerId));
} }
@ShellMethod(key = "start") @ShellMethod(key = "start")

View File

@@ -108,7 +108,7 @@ public class MultiDeviceApp {
public void stopOne(@ShellOption("--id") final String controllerId) { public void stopOne(@ShellOption("--id") final String controllerId) {
ddiTenant.getController(controllerId).ifPresentOrElse( ddiTenant.getController(controllerId).ifPresentOrElse(
DdiController::stop, DdiController::stop,
() -> log.error("Controller with id " + controllerId + " not found!")); () -> log.error("Controller with id {} not found!", controllerId));
} }

View File

@@ -82,7 +82,7 @@ public class DmfController {
public void unregisterThing() { public void unregisterThing() {
log.debug(LOG_PREFIX + "Removing Controller...", getTenantId(), getControllerId()); log.debug(LOG_PREFIX + "Removing Controller...", getTenantId(), getControllerId());
dmfSender.removeThing(getTenantId(), getControllerId()); dmfSender.removeThing(getTenantId(), getControllerId());
log.debug(LOG_PREFIX + "Done. Create thing sent.", getTenantId(), getControllerId()); log.debug(LOG_PREFIX + "Done. Remove thing sent.", getTenantId(), getControllerId());
} }
public void stop() { public void stop() {

View File

@@ -10,6 +10,7 @@
package org.eclipse.hawkbit.security.controller; package org.eclipse.hawkbit.security.controller;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@@ -69,9 +70,7 @@ public class PreAuthTokenSourceTrustAuthenticationProvider implements Authentica
*/ */
public PreAuthTokenSourceTrustAuthenticationProvider(final String... authorizedSourceIps) { public PreAuthTokenSourceTrustAuthenticationProvider(final String... authorizedSourceIps) {
this.authorizedSourceIps = new ArrayList<>(); this.authorizedSourceIps = new ArrayList<>();
for (final String ip : authorizedSourceIps) { this.authorizedSourceIps.addAll(Arrays.asList(authorizedSourceIps));
this.authorizedSourceIps.add(ip);
}
} }
@Override @Override

View File

@@ -9,6 +9,7 @@
*/ */
package org.eclipse.hawkbit.security; package org.eclipse.hawkbit.security;
import java.io.Serial;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@@ -200,6 +201,7 @@ public class SystemSecurityContext {
*/ */
public static final class SystemCodeAuthentication implements Authentication { public static final class SystemCodeAuthentication implements Authentication {
@Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final List<SimpleGrantedAuthority> AUTHORITIES = Collections private static final List<SimpleGrantedAuthority> AUTHORITIES = Collections
.singletonList(new SimpleGrantedAuthority(SpringEvalExpressions.SYSTEM_ROLE)); .singletonList(new SimpleGrantedAuthority(SpringEvalExpressions.SYSTEM_ROLE));