From 4715278ee5e41c8a9dfccb4fe88e5b6ecdbe7336 Mon Sep 17 00:00:00 2001 From: Avgustin Marinov Date: Tue, 30 Sep 2025 09:30:23 +0300 Subject: [PATCH] Sonar Findings (#2708) Signed-off-by: Avgustin Marinov --- .../hawkbit/mgmt/json/model/action/MgmtAction.java | 2 +- .../eclipse/hawkbit/repository/jpa/ql/QLSupport.java | 12 +++++++----- .../src/test/resources/jpa-test.properties | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/action/MgmtAction.java b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/action/MgmtAction.java index 535e1b5bf..e2884afd4 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/action/MgmtAction.java +++ b/hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/action/MgmtAction.java @@ -93,10 +93,10 @@ public class MgmtAction extends MgmtBaseEntity { private Long id; @Schema(description = "Type of action", example = "update") private String type; - @Deprecated(since = "0.10.0") /** * @deprecated since 0.10.0 - use {@link #active} instead of {@link #status} */ + @Deprecated(since = "0.10.0") @Schema(description = "Status of action, use active", example = "finished", deprecated = true) private String status; @Schema(description = "Status of action") diff --git a/hawkbit-repository/hawkbit-repository-jpa-ql/src/main/java/org/eclipse/hawkbit/repository/jpa/ql/QLSupport.java b/hawkbit-repository/hawkbit-repository-jpa-ql/src/main/java/org/eclipse/hawkbit/repository/jpa/ql/QLSupport.java index c9692c3cb..b8cb6374b 100644 --- a/hawkbit-repository/hawkbit-repository-jpa-ql/src/main/java/org/eclipse/hawkbit/repository/jpa/ql/QLSupport.java +++ b/hawkbit-repository/hawkbit-repository-jpa-ql/src/main/java/org/eclipse/hawkbit/repository/jpa/ql/QLSupport.java @@ -100,7 +100,7 @@ public class QLSupport implements ApplicationListener { * If the database is declared as case-sensitive and ignoreCase is set to false the RSQL queries shall use strict * syntax - i.e. 'and' instead of 'AND' / 'aND'. Otherwise, the queries would be case-insensitive regarding operators. */ - @Value("${hawkbit.rsql.case-insensitive-db:false}") + @Value("${hawkbit.ql.case-insensitive-db:false}") private boolean caseInsensitiveDB; /** @@ -108,7 +108,7 @@ public class QLSupport implements ApplicationListener { */ @Setter // for tests only @Deprecated(forRemoval = true, since = "0.6.0") - @Value("${hawkbit.rsql.rsql-to-spec-builder:G3}") // + @Value("${hawkbit.ql.spec-builder:G3}") // private SpecBuilder specBuilder; @SuppressWarnings({ "rawtypes", "unchecked" }) @@ -167,8 +167,8 @@ public class QLSupport implements ApplicationListener { */ public & QueryField, T> Specification buildSpec(final String query, final Class queryFieldType) { if (specBuilder == SpecBuilder.G3) { - return new SpecificationBuilder(!caseInsensitiveDB && ignoreCase, database) - .specification(parseAndTransform(query, queryFieldType, caseInsensitiveDB || ignoreCase)); + return new SpecificationBuilder(ignoreCase && !caseInsensitiveDB , database) + .specification(parseAndTransform(query, queryFieldType, ignoreCase || caseInsensitiveDB)); } else { return new SpecificationBuilderLegacy(queryFieldType, virtualPropertyResolver, database).specification(query); } @@ -176,7 +176,7 @@ public class QLSupport implements ApplicationListener { @SuppressWarnings({ "java:S1117" }) // it is again ignoreCase public & QueryField> EntityMatcher entityMatcher(final String query, final Class queryFieldType) { - final boolean ignoreCase = caseInsensitiveDB || this.ignoreCase; // sync with DB and case sensitivity requirements + final boolean ignoreCase = this.ignoreCase || caseInsensitiveDB; // sync with DB and case sensitivity requirements return EntityMatcher.of(parseAndTransform(query, queryFieldType, ignoreCase), ignoreCase); } @@ -242,6 +242,7 @@ public class QLSupport implements ApplicationListener { } // just extension points for subclasses + @SuppressWarnings("java:S1172") // comparison and queryFieldType might be useful for subclasses protected & QueryField> Object transformKey( final String key, final Comparison comparison, final Class queryFieldType) { return key; @@ -267,6 +268,7 @@ public class QLSupport implements ApplicationListener { } // just extension points for subclasses + @SuppressWarnings("java:S1172") // comparison and queryFieldType might be useful for subclasses protected & QueryField> Object transformValueElement( final Object value, final Comparison comparison, final Class queryFieldType) { return value; diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/test/resources/jpa-test.properties b/hawkbit-repository/hawkbit-repository-jpa/src/test/resources/jpa-test.properties index 95058dba2..9a0cebec0 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/test/resources/jpa-test.properties +++ b/hawkbit-repository/hawkbit-repository-jpa/src/test/resources/jpa-test.properties @@ -56,7 +56,7 @@ logging.level.org.eclipse.persistence=${NOISE_SUPPRESS_LEVEL} ### Switch to MySQL or MariaDB - END ## enable / disable case sensitiveness of the DB when playing around -#hawkbit.rsql.caseInsensitiveDB=true +#hawkbit.ql.case-insensitive-db=true hawkbit.repository.cluster.lock.ttl=1000 hawkbit.repository.cluster.lock.refreshOnRemainMS=200