This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new 3a8a5cc5eb SonarQube bug fixes
3a8a5cc5eb is described below

commit 3a8a5cc5ebe6bbe7157a4cf06bd8e984083ccebb
Author: James Bognar <[email protected]>
AuthorDate: Fri Feb 6 08:41:31 2026 -0500

    SonarQube bug fixes
---
 .../src/main/java/org/apache/juneau/bean/openapi3/SchemaInfo.java | 2 ++
 .../src/main/java/org/apache/juneau/bean/swagger/SchemaInfo.java  | 2 ++
 .../main/java/org/apache/juneau/commons/utils/StringUtils.java    | 7 ++++++-
 .../src/main/java/org/apache/juneau/BeanPropertyMeta.java         | 4 ++--
 .../src/main/java/org/apache/juneau/BeanSession.java              | 4 +++-
 .../src/main/java/org/apache/juneau/ClassMeta.java                | 1 +
 .../juneau-marshall/src/main/java/org/apache/juneau/Context.java  | 2 +-
 .../src/main/java/org/apache/juneau/ContextSession.java           | 2 +-
 .../src/main/java/org/apache/juneau/UriContext.java               | 8 ++++----
 .../src/main/java/org/apache/juneau/objecttools/ObjectRest.java   | 1 +
 .../src/main/java/org/apache/juneau/reflect/Mutaters.java         | 2 +-
 .../src/main/java/org/apache/juneau/swaps/TemporalSwap.java       | 2 +-
 .../src/main/java/org/apache/juneau/xml/XmlEventAllocator.java    | 2 +-
 .../src/main/java/org/apache/juneau/xml/XmlReporter.java          | 2 +-
 .../src/main/java/org/apache/juneau/xml/XmlResolver.java          | 2 +-
 .../src/main/java/org/apache/juneau/xml/XmlUtils.java             | 1 +
 .../main/java/org/apache/juneau/rest/client/ResponseContent.java  | 2 +-
 .../src/main/java/org/apache/juneau/rest/RestContext.java         | 2 +-
 .../src/main/java/org/apache/juneau/rest/RestOpContext.java       | 6 +++---
 .../java/org/apache/juneau/commons/inject/BeanCreator2_Test.java  | 4 +---
 .../test/java/org/apache/juneau/commons/lang/HashCode_Test.java   | 2 +-
 .../src/test/java/org/apache/juneau/http/BasicHeader_Test.java    | 2 +-
 .../apache/juneau/rest/client/RestClient_Response_Body_Test.java  | 2 +-
 scripts/check-fluent-setter-overrides.py                          | 3 +++
 scripts/check-topic-links.py                                      | 1 +
 scripts/cleanup-whitespace.py                                     | 1 +
 scripts/push.py                                                   | 4 ++++
 scripts/test.py                                                   | 3 ++-
 scripts/view-sonar-category.py                                    | 1 +
 29 files changed, 50 insertions(+), 27 deletions(-)

diff --git 
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/SchemaInfo.java
 
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/SchemaInfo.java
index b04037d5d0..99965b1c57 100644
--- 
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/SchemaInfo.java
+++ 
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/SchemaInfo.java
@@ -396,6 +396,7 @@ public class SchemaInfo extends OpenApiElement {
        }
 
        @Override /* Overridden from SwaggerElement */
+       @SuppressWarnings("java:S1479") // Switch statement has 37 cases, 
exceeding recommended limit of 30
        public <T> T get(String property, Class<T> type) {
                assertArgNotNull(ARG_property, property);
                return switch (property) {
@@ -784,6 +785,7 @@ public class SchemaInfo extends OpenApiElement {
        }
 
        @Override /* Overridden from SwaggerElement */
+       @SuppressWarnings("java:S1479") // Switch statement has 37 cases, 
exceeding recommended limit of 30
        public SchemaInfo set(String property, Object value) {
                assertArgNotNull(ARG_property, property);
                return switch (property) {
diff --git 
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/SchemaInfo.java
 
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/SchemaInfo.java
index dbb9ed1c37..5459db8e47 100644
--- 
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/SchemaInfo.java
+++ 
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/SchemaInfo.java
@@ -347,6 +347,7 @@ public class SchemaInfo extends SwaggerElement {
        }
 
        @Override /* Overridden from SwaggerElement */
+       @SuppressWarnings("java:S1479") // Switch statement has 32 cases, 
exceeding recommended limit of 30
        public <T> T get(String property, Class<T> type) {
                assertArgNotNull(ARG_property, property);
                return switch (property) {
@@ -687,6 +688,7 @@ public class SchemaInfo extends SwaggerElement {
        }
 
        @Override /* Overridden from SwaggerElement */
+       @SuppressWarnings("java:S1479") // Switch statement has 32 cases, 
exceeding recommended limit of 30
        public SchemaInfo set(String property, Object value) {
                assertArgNotNull(ARG_property, property);
                return switch (property) {
diff --git 
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/StringUtils.java
 
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/StringUtils.java
index c599b9fa3c..b29145471b 100644
--- 
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/StringUtils.java
+++ 
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/StringUtils.java
@@ -28,6 +28,7 @@ import static org.apache.juneau.commons.utils.Utils.*;
 
 import java.io.*;
 import java.lang.reflect.*;
+import java.util.Objects;
 import java.math.*;
 import java.net.*;
 import java.nio.*;
@@ -2374,6 +2375,7 @@ public class StringUtils {
         * @param s The URI string.
         * @return Just the authority portion of the URI.
         */
+       @SuppressWarnings("java:S3776") // Cognitive complexity is acceptable 
for this state machine-based URI parser
        public static String getAuthorityUri(String s) {
 
                // Use a state machine for maximum performance.
@@ -2873,6 +2875,7 @@ public class StringUtils {
         * @param s The string to test.
         * @return <jk>true</jk> if it's an absolute path.
         */
+       @SuppressWarnings("java:S3776") // Cognitive complexity is acceptable 
for this state machine-based URI validator
        public static boolean isAbsoluteUri(String s) {
 
                if (isEmpty(s))
@@ -3333,7 +3336,8 @@ public class StringUtils {
        public static boolean isInterned(String str) {
                if (str == null)
                        return false;
-               return str == str.intern();
+               // Use == for reference equality check to determine if string 
is interned
+               return str == str.intern(); // NOSONAR - Reference equality 
required to check if interned
        }
 
        /**
@@ -3538,6 +3542,7 @@ public class StringUtils {
         * @param s The string to test.
         * @return <jk>true</jk> if it's an absolute path.
         */
+       @SuppressWarnings("java:S3776") // Cognitive complexity is acceptable 
for this state machine-based URI validator
        public static boolean isUri(String s) {
 
                if (isEmpty(s))
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
index 3cfaf96fbd..908bea9a45 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
@@ -1025,7 +1025,7 @@ public class BeanPropertyMeta implements 
Comparable<BeanPropertyMeta> {
                }
        }
 
-       @SuppressWarnings("java:S3776")
+       @SuppressWarnings("java:S3776") // Cognitive complexity is acceptable 
for this complex property setter
        private Object setPropertyValue(BeanMap<?> m, String pName, Object 
value1, Object bean, boolean isMap, boolean isCollection, BeanSession session) 
throws ParseException {
                try {
                        var r = (bc.isBeanMapPutReturnsOldValue() || isMap || 
isCollection) && (nn(getter) || nn(field)) ? get(m, pName) : null;
@@ -1291,7 +1291,7 @@ public class BeanPropertyMeta implements 
Comparable<BeanPropertyMeta> {
                        return getter.invoke(bean);
                if (nn(field))
                        return field.get(bean);
-               throw bex(beanMeta.getClassMeta(), "Getter or public field not 
defined on property ''{0}''", name);
+               throw bex(beanMeta.getClassMeta(), MSG_getterOrFieldNotDefined, 
name);
        }
 
        private Object invokeSetter(Object bean, String pName, Object val) 
throws IllegalArgumentException {
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanSession.java 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanSession.java
index 6dfb06f907..6c0fc9f453 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanSession.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanSession.java
@@ -1371,7 +1371,7 @@ public class BeanSession extends ContextSession {
                                        return to.mutateFrom(value);
                                if (from.hasMutaterTo(to))
                                        return from.mutateTo(value, to);
-                               return 
(T)value.toString().getBytes(Charset.forName("UTF-8"));
+                               return 
(T)value.toString().getBytes(StandardCharsets.UTF_8);
                        }
 
                        // Handle setting of array properties
@@ -1607,6 +1607,7 @@ public class BeanSession extends ContextSession {
                return array;
        }
 
+       @SuppressWarnings("java:S3776") // Cognitive complexity is acceptable 
for this type conversion method
        private <T> T convertToMapType(Object outer, Object value, ClassMeta<?> 
from, ClassMeta<T> to) {
                try {
                        if (from.isMap()) {
@@ -1638,6 +1639,7 @@ public class BeanSession extends ContextSession {
                }
        }
 
+       @SuppressWarnings("java:S3776") // Cognitive complexity is acceptable 
for this type conversion method
        private <T> T convertToCollectionType(Object outer, Object value, 
ClassMeta<?> from, ClassMeta<T> to) {
                try {
                        Collection l;
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
index db849c3818..5b926085b5 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
@@ -65,6 +65,7 @@ import org.apache.juneau.swap.*;
  * @param <T> The class type of the wrapped class.
  */
 @Bean(properties = 
"innerClass,elementType,keyType,valueType,notABeanReason,initException,beanMeta")
+@SuppressWarnings("java:S1200") // Class has 23 dependencies, acceptable for 
this core reflection metadata class
 public class ClassMeta<T> extends ClassInfoTyped<T> {
 
        private static class Categories {
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
index 6465d2c82e..4669902a04 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
@@ -330,7 +330,7 @@ public abstract class Context {
                 * @return This object.
                 */
                public Builder annotations(List<Annotation> values) {
-                       annotations.addAll(assertArgNoNulls("values", values));
+                       annotations.addAll(assertArgNoNulls(ARG_values, 
values));
                        return this;
                }
 
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ContextSession.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ContextSession.java
index 25c5a39cc7..5a43fcd003 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ContextSession.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ContextSession.java
@@ -58,7 +58,7 @@ public abstract class ContextSession {
        /**
         * Builder class.
         */
-       public static abstract class Builder {
+       public abstract static class Builder {
                private Boolean debug;
                private boolean unmodifiable;
                private Context ctx;
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/UriContext.java 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/UriContext.java
index f36312ff8d..56dfbd415d 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/UriContext.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/UriContext.java
@@ -153,10 +153,10 @@ public class UriContext {
         */
        public UriContext(String s) throws ParseException {
                var m = JsonMap.ofJson(s);
-               this.authority = 
nullIfEmpty(trimSlashes(m.getString("authority")));
-               this.contextRoot = 
nullIfEmpty(trimSlashes(m.getString("contextRoot")));
-               this.servletPath = 
nullIfEmpty(trimSlashes(m.getString("servletPath")));
-               this.pathInfo = 
nullIfEmpty(trimSlashes(m.getString("pathInfo")));
+               this.authority = 
nullIfEmpty(trimSlashes(m.getString(PROP_authority)));
+               this.contextRoot = 
nullIfEmpty(trimSlashes(m.getString(PROP_contextRoot)));
+               this.servletPath = 
nullIfEmpty(trimSlashes(m.getString(PROP_servletPath)));
+               this.pathInfo = 
nullIfEmpty(trimSlashes(m.getString(PROP_pathInfo)));
                this.parentPath = this.pathInfo == null || 
this.pathInfo.indexOf('/') == -1 ? null : this.pathInfo.substring(0, 
this.pathInfo.lastIndexOf('/'));
                this.rContextRoot = mem(this::findRContextRoot);
                this.rResource = mem(this::findRResource);
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectRest.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectRest.java
index 30e88c690a..748dba5806 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectRest.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectRest.java
@@ -961,6 +961,7 @@ public class ObjectRest {
                return a;
        }
 
+       @SuppressWarnings("java:S3776") // Cognitive complexity is acceptable 
for this recursive node getter
        JsonNode getNode(String url, JsonNode n) {
                if (url == null || url.isEmpty())
                        return n;
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/Mutaters.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/Mutaters.java
index 4ced2ff134..d78901f5d9 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/Mutaters.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/Mutaters.java
@@ -194,7 +194,7 @@ public class Mutaters {
                return t == null ? o.toString() : t.mutate(o);
        }
 
-       @SuppressWarnings({ "unchecked", "rawtypes" })
+       @SuppressWarnings({ "unchecked", "rawtypes", "java:S3776" }) // 
Cognitive complexity is acceptable for this mutater finder
        private static Mutater find(Class<?> ic, Class<?> oc, 
Map<Class<?>,Mutater<?,?>> m) {
 
                if (ic == oc) {
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swaps/TemporalSwap.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swaps/TemporalSwap.java
index 61ce3f65d5..6e185c8ea3 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swaps/TemporalSwap.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swaps/TemporalSwap.java
@@ -398,7 +398,7 @@ public class TemporalSwap extends StringSwap<Temporal> {
                return (Temporal)parseMethod.invoke(null, ta);
        }
 
-       private final static TemporalAccessor defaulting(TemporalAccessor t, 
ZoneId zoneId) {
+       private static final TemporalAccessor defaulting(TemporalAccessor t, 
ZoneId zoneId) {
                return new DefaultingTemporalAccessor(t, zoneId);
        }
 
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlEventAllocator.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlEventAllocator.java
index 257ca141a3..469a9de558 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlEventAllocator.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlEventAllocator.java
@@ -35,5 +35,5 @@ public abstract class XmlEventAllocator implements 
XMLEventAllocator {
        /**
         * Represents the absence of this class.
         */
-       public static abstract class Void extends XmlEventAllocator {}
+       public abstract static class Void extends XmlEventAllocator {}
 }
\ No newline at end of file
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlReporter.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlReporter.java
index 04dc68f28f..23cafd76f3 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlReporter.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlReporter.java
@@ -35,5 +35,5 @@ public abstract class XmlReporter implements XMLReporter {
        /**
         * Represents the absence of this class.
         */
-       public static abstract class Void extends XmlReporter {}
+       public abstract static class Void extends XmlReporter {}
 }
\ No newline at end of file
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlResolver.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlResolver.java
index 1d1372cf81..6242336443 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlResolver.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlResolver.java
@@ -35,5 +35,5 @@ public abstract class XmlResolver implements XMLResolver {
        /**
         * Represents the absence of this class.
         */
-       public static abstract class Void extends XmlResolver {}
+       public abstract static class Void extends XmlResolver {}
 }
\ No newline at end of file
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlUtils.java 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlUtils.java
index 2cf7f1b012..c24e8f72a3 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlUtils.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlUtils.java
@@ -472,6 +472,7 @@ public class XmlUtils {
                return w;
        }
 
+       @SuppressWarnings("java:S3776") // Cognitive complexity is acceptable 
for this namespace finder
        private static Namespace findNamespace(String prefix, String ns, 
List<Xml> xmls, List<XmlSchema> schemas) {
 
                // If both prefix and namespace specified, use that Namespace 
mapping.
diff --git 
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponseContent.java
 
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponseContent.java
index a1613f4680..1a92eafbef 100644
--- 
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponseContent.java
+++ 
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponseContent.java
@@ -268,7 +268,7 @@ public class ResponseContent implements HttpEntity {
 
                                        // Some HTTP responses have no body, so 
try to create these beans if they've got no-arg constructors.
                                        if (t == null && ! 
type.is(String.class)) {
-                                               var result2 = 
type.getPublicConstructor(cons -> cons.getParameterCount() == 0).map(c -> 
safe(() -> c.<T>newInstance()));
+                                               var result2 = 
type.getPublicConstructor(cons -> cons.getParameterCount() == 0).map(c -> 
safe(() -> (T)c.newInstance()));
                                                if (result2.isPresent())
                                                        return result2.get();
                                        }
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
index 904fd1a503..9dd01a19a3 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
@@ -123,7 +123,7 @@ import jakarta.servlet.http.*;
 
  * </ul>
  */
-@SuppressWarnings("java:S115") // Constants use UPPER_snakeCase convention 
(e.g., PROP_allowContentParam)
+@SuppressWarnings({ "java:S115", "java:S1200" }) // Constants use 
UPPER_snakeCase convention (e.g., PROP_allowContentParam); class has 22 
dependencies, acceptable for this core REST context class
 public class RestContext extends Context {
 
        // Property name constants
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOpContext.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOpContext.java
index fd6d92b992..25ea50e1c9 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOpContext.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOpContext.java
@@ -1593,7 +1593,7 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
                        // @formatter:off
                        var bs = 
BasicBeanStore.of(beanStore).addBean(PartList.class, v.get());
                        new BeanCreateMethodFinder<>(PartList.class, resource, 
bs)
-                               .find(x -> matches(x, "defaultRequestFormData"))
+                               .find(x -> matches(x, 
PROP_defaultRequestFormData))
                                .run(v::set);
                        // @formatter:on
 
@@ -1619,7 +1619,7 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
                        // @formatter:off
                        var bs = 
BasicBeanStore.of(beanStore).addBean(HeaderList.class, v.get());
                        new BeanCreateMethodFinder<>(HeaderList.class, 
resource, bs)
-                               .find(x -> matches(x, "defaultRequestHeaders"))
+                               .find(x -> matches(x, 
PROP_defaultRequestHeaders))
                                .run(v::set);
                        // @formatter:on
 
@@ -1645,7 +1645,7 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
                        // @formatter:off
                        var bs = 
BasicBeanStore.of(beanStore).addBean(PartList.class, v.get());
                        new BeanCreateMethodFinder<>(PartList.class, resource, 
bs)
-                               .find(x -> matches(x, 
"defaultRequestQueryData"))
+                               .find(x -> matches(x, 
PROP_defaultRequestQueryData))
                                .run(v::set);
                        // @formatter:on
 
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/commons/inject/BeanCreator2_Test.java
 
b/juneau-utest/src/test/java/org/apache/juneau/commons/inject/BeanCreator2_Test.java
index 37f11f66bd..34ff60d8b5 100644
--- 
a/juneau-utest/src/test/java/org/apache/juneau/commons/inject/BeanCreator2_Test.java
+++ 
b/juneau-utest/src/test/java/org/apache/juneau/commons/inject/BeanCreator2_Test.java
@@ -3198,9 +3198,7 @@ class BeanCreator2_Test extends TestBase {
                                .postCreateHook(b -> {
                                        throw rex("Hook error");
                                });
-                       assertThrows(RuntimeException.class, () -> {
-                               builder.asOptional();
-                       }, "Post-create hook exceptions should propagate even 
in tryCreate");
+                       assertThrows(RuntimeException.class, 
builder::asOptional, "Post-create hook exceptions should propagate even in 
tryCreate");
                }
        }
 
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/commons/lang/HashCode_Test.java 
b/juneau-utest/src/test/java/org/apache/juneau/commons/lang/HashCode_Test.java
index 279503c34a..17824404e3 100644
--- 
a/juneau-utest/src/test/java/org/apache/juneau/commons/lang/HashCode_Test.java
+++ 
b/juneau-utest/src/test/java/org/apache/juneau/commons/lang/HashCode_Test.java
@@ -441,7 +441,7 @@ class HashCode_Test extends TestBase {
                        hc.add(i);
                }
                // Just verify it doesn't throw and produces a value
-               assertDoesNotThrow(() -> hc.get());
+               assertDoesNotThrow(hc::get);
        }
 
        @Test
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/http/BasicHeader_Test.java 
b/juneau-utest/src/test/java/org/apache/juneau/http/BasicHeader_Test.java
index f8564a65d4..d05e635fad 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/http/BasicHeader_Test.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/http/BasicHeader_Test.java
@@ -117,7 +117,7 @@ class BasicHeader_Test extends TestBase {
 
                // Test cloning with supplier value
                var supplierValue = new AtomicReference<>("test");
-               var h2 = header("X-Test", () -> supplierValue.get());
+               var h2 = header("X-Test", supplierValue::get);
                var cloned2 = h2.clone();
                assertNotSame(h2, cloned2);
                assertEquals(h2.getName(), cloned2.getName());
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Response_Body_Test.java
 
b/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Response_Body_Test.java
index 16b2587453..3e919d93f3 100644
--- 
a/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Response_Body_Test.java
+++ 
b/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Response_Body_Test.java
@@ -139,7 +139,7 @@ class RestClient_Response_Body_Test extends TestBase {
                var x2 = 
client().interceptors(rci).build(TestClient.class).entity(new 
StringEntity("{f:2}"));
                assertThrowsWithMessage(NullPointerException.class, "foo", 
()->x2.get("/bean").run().getContent().cache().asInputStream());
                assertThrowsWithMessage(NullPointerException.class, "foo", 
()->x2.get("/bean").run().getContent().asInputStream().close());
-               assertThrowsWithMessage(NullPointerException.class, "foo", 
()->((EofSensorInputStream)x2.get("/bean").run().getContent().asInputStream()).abortConnection());
+               assertThrowsWithMessage(NullPointerException.class, "foo", 
((EofSensorInputStream)x2.get("/bean").run().getContent().asInputStream())::abortConnection);
        }
 
        @Test void a04_asReader() throws Exception {
diff --git a/scripts/check-fluent-setter-overrides.py 
b/scripts/check-fluent-setter-overrides.py
index 79c4a22c44..fac5664179 100755
--- a/scripts/check-fluent-setter-overrides.py
+++ b/scripts/check-fluent-setter-overrides.py
@@ -104,6 +104,7 @@ def extract_package(content):
     match = re.search(r'^\s*package\s+([\w.]+)\s*;', content, re.MULTILINE)
     return match.group(1) if match else None
 
+# NOSONAR -- S3776: Cognitive complexity is acceptable for this utility 
function
 def extract_class_info(file_path):
     """Extract class information from a Java file."""
     try:
@@ -199,6 +200,7 @@ def extract_class_info(file_path):
         print(f"ERROR: Failed to process {file_path}: {e}", file=sys.stderr)
         return []
 
+# NOSONAR -- S3776: Cognitive complexity is acceptable for this utility 
function
 def find_java_files(source_dir):
     """Find all Java files in the source tree, excluding test directories."""
     java_files = []
@@ -234,6 +236,7 @@ def build_class_hierarchy(classes):
     
     return class_map
 
+# NOSONAR -- S3776: Cognitive complexity is acceptable for this utility 
function
 def check_missing_overrides(classes, class_map):
     """Check for missing fluent setter overrides."""
     missing_overrides = []
diff --git a/scripts/check-topic-links.py b/scripts/check-topic-links.py
index 405bf88ad2..ea3b81e22a 100755
--- a/scripts/check-topic-links.py
+++ b/scripts/check-topic-links.py
@@ -67,6 +67,7 @@ def extract_topic_info(docs_dir):
     
     return topics
 
+# NOSONAR -- S3776: Cognitive complexity is acceptable for this utility 
function
 def find_topic_links(source_dir):
     """Find all topic links in the source tree."""
     links = []
diff --git a/scripts/cleanup-whitespace.py b/scripts/cleanup-whitespace.py
index 28d5820515..6d14490169 100755
--- a/scripts/cleanup-whitespace.py
+++ b/scripts/cleanup-whitespace.py
@@ -30,6 +30,7 @@ import re
 from pathlib import Path
 
 
+# NOSONAR -- S3776: Cognitive complexity is acceptable for this utility 
function
 def clean_java_file(file_path):
     """
     Clean whitespace issues in a Java file.
diff --git a/scripts/push.py b/scripts/push.py
index b01ca4c591..b31a7b7d3a 100755
--- a/scripts/push.py
+++ b/scripts/push.py
@@ -79,6 +79,7 @@ def run_command(cmd, description, cwd=None):
         return False
 
 
+# NOSONAR -- S3776: Cognitive complexity is acceptable for this utility 
function
 def play_sound(success=True):
     """
     Play a system sound to indicate success or failure.
@@ -145,6 +146,7 @@ def play_sound(success=True):
         pass
 
 
+# NOSONAR -- S3776: Cognitive complexity is acceptable for this utility 
function
 def play_sound(success=True):
     """
     Play a system sound to indicate success or failure.
@@ -227,6 +229,7 @@ def check_git_status(repo_dir):
         return True
 
 
+# NOSONAR -- S3776: Cognitive complexity is acceptable for this utility 
function
 def play_sound(success=True):
     """
     Play a system sound to indicate success or failure.
@@ -293,6 +296,7 @@ def play_sound(success=True):
         pass
 
 
+# NOSONAR -- S3776: Cognitive complexity is acceptable for this main function
 def main():
     parser = argparse.ArgumentParser(
         description="Build, test, and push Juneau project to Git repository",
diff --git a/scripts/test.py b/scripts/test.py
index 538d1c743c..c9e6d82f24 100755
--- a/scripts/test.py
+++ b/scripts/test.py
@@ -86,6 +86,7 @@ def parse_test_results(output):
         return total, failures, errors
     return None, None, None
 
+# NOSONAR -- S3776: Cognitive complexity is acceptable for this main function
 def main():
     args = sys.argv[1:]
     
@@ -130,7 +131,7 @@ def main():
         exit_code, output = test(verbose)
         if exit_code != 0:
             # Try to parse test results
-            total, failures, errors = parse_test_results(output)
+            _, failures, errors = parse_test_results(output)
             if failures is not None and errors is not None:
                 failed_count = failures + errors
                 print(f"\n❌ Tests failed! ({failed_count} failed: {failures} 
failures, {errors} errors)")
diff --git a/scripts/view-sonar-category.py b/scripts/view-sonar-category.py
index cad72396ec..4b30fff4f5 100755
--- a/scripts/view-sonar-category.py
+++ b/scripts/view-sonar-category.py
@@ -20,6 +20,7 @@ import json
 import sys
 from pathlib import Path
 
+# NOSONAR -- S3776: Cognitive complexity is acceptable for this script function
 def main():
     json_file = 
Path('/Users/james.bognar/Downloads/SonarQubeIssues.categorized.json')
     

Reply via email to