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 9225e67eab SonarQube bug fixes
9225e67eab is described below

commit 9225e67eabc9b28412dbd66e6f5f6a4e367c2048
Author: James Bognar <[email protected]>
AuthorDate: Wed Feb 18 15:49:06 2026 -0500

    SonarQube bug fixes
---
 .../java/org/apache/juneau/commons/reflect/AnnotationProvider.java  | 2 +-
 .../src/main/java/org/apache/juneau/json/JsonParserSession.java     | 6 +++++-
 .../java/org/apache/juneau/msgpack/MsgPackSerializerSession.java    | 4 +---
 .../src/main/java/org/apache/juneau/svl/VarResolverSession.java     | 2 +-
 .../src/main/java/org/apache/juneau/uon/UonParserSession.java       | 1 +
 .../org/apache/juneau/urlencoding/UrlEncodingParserSession.java     | 1 +
 .../src/main/java/org/apache/juneau/xml/XmlBeanPropertyMeta.java    | 2 +-
 7 files changed, 11 insertions(+), 7 deletions(-)

diff --git 
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/reflect/AnnotationProvider.java
 
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/reflect/AnnotationProvider.java
index d8c8fbefd6..6b823c6419 100644
--- 
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/reflect/AnnotationProvider.java
+++ 
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/reflect/AnnotationProvider.java
@@ -372,7 +372,7 @@ public class AnnotationProvider {
                 * @return A new immutable {@link AnnotationProvider} instance.
                 */
                public AnnotationProvider build() {
-                       if (e(runtimeAnnotations) && INSTANCE != null)  // HTT
+                       if (e(runtimeAnnotations))
                                return INSTANCE;
                        return new AnnotationProvider(this);
                }
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
index 8d7c207601..0f581ed807 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
@@ -366,6 +366,7 @@ public class JsonParserSession extends ReaderParserSession {
 
        @SuppressWarnings({
                "java:S1168",    // Compiler-satisfying return: all paths 
return m or throw. S1168 flags null returns; here null is unreachable.
+               "java:S2583",    // State variables persist across loop 
iterations
                "java:S3776"     // Cognitive complexity acceptable for parser 
state machine
        })
        private <T> BeanMap<T> parseIntoBeanMap2(ParserReader r, BeanMap<T> m) 
throws IOException, ParseException, ExecutableException {
@@ -461,6 +462,7 @@ public class JsonParserSession extends ReaderParserSession {
        @SuppressWarnings({
                "java:S1168",    // Compiler-satisfying return: all paths 
return l or throw. S1168 flags null returns; here null is unreachable.
                "java:S135",     // Multiple break statements necessary for 
state machine error handling
+               "java:S2583",    // State variables persist across loop 
iterations
                "java:S3776"     // Cognitive complexity acceptable for parser 
state machine
        })
        private <E> Collection<E> parseIntoCollection2(ParserReader r, 
Collection<E> l, ClassMeta<?> type, BeanPropertyMeta pMeta) throws IOException, 
ParseException, ExecutableException {
@@ -528,6 +530,7 @@ public class JsonParserSession extends ReaderParserSession {
        @SuppressWarnings({
                "java:S1168",    // Compiler-satisfying return: all paths 
return m or throw. S1168 flags null returns; here null is unreachable.
                "java:S135",     // Multiple break statements necessary for 
state machine error handling
+               "java:S2583",    // State variables persist across loop 
iterations
                "java:S3776"     // Cognitive complexity acceptable for parser 
state machine
        })
        private <K,V> Map<K,V> parseIntoMap2(ParserReader r, Map<K,V> m, 
ClassMeta<K> keyType, ClassMeta<V> valueType, BeanPropertyMeta pMeta) throws 
IOException, ParseException, ExecutableException {
@@ -837,7 +840,8 @@ public class JsonParserSession extends ReaderParserSession {
         * the @Json(wrapperAttr) annotation is used on a class.
         */
        @SuppressWarnings({
-               "java:S3776" // Cognitive complexity acceptable for wrapper 
attribute parsing
+               "java:S2583",    // State variables persist across loop 
iterations
+               "java:S3776"     // Cognitive complexity acceptable for wrapper 
attribute parsing
        })
        private void skipWrapperAttrStart(ParserReader r, String wrapperAttr) 
throws IOException, ParseException {
 
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerSession.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerSession.java
index 9076a5ff49..d44e76aea8 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerSession.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/msgpack/MsgPackSerializerSession.java
@@ -226,7 +226,6 @@ public class MsgPackSerializerSession extends 
OutputStreamSerializerSession {
                ClassMeta<?> sType = null;                      // The 
serialized type
 
                aType = push2(attrName, o, eType);
-               boolean isRecursion = aType == null;
 
                // Handle recursion
                if (aType == null)
@@ -283,8 +282,7 @@ public class MsgPackSerializerSession extends 
OutputStreamSerializerSession {
                } else
                        out.appendString(toString(o));
 
-               if (! isRecursion)
-                       pop();
+               pop();
                return out;
        }
 
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolverSession.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolverSession.java
index bcdeb58da9..708f45b191 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolverSession.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolverSession.java
@@ -388,7 +388,7 @@ public class VarResolverSession {
                                        state = S1;
                                        hasInnerEscapes = false;
                                }
-                       } else if (state == S3) {
+                       } else if (state == S3) {  // NOSONAR - State check 
necessary for state machine
                                if (isInEscape) {
                                        isInEscape = false;
                                } else if (c == '\\') {
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserSession.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserSession.java
index 735195bb94..daf0d8f534 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserSession.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserSession.java
@@ -580,6 +580,7 @@ public class UonParserSession extends ReaderParserSession 
implements HttpPartPar
 
        @SuppressWarnings({
                "java:S1168",    // TODO: null for EOF/AMP. Parser state 
machine.
+               "java:S2583",    // State variables persist across loop 
iterations
                "java:S3776"     // Cognitive complexity acceptable for parser 
state machine
        })
        private <E> Collection<E> parseIntoCollection(UonReader r, 
Collection<E> l, ClassMeta<E> type, boolean isUrlParamValue, BeanPropertyMeta 
pMeta)
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java
index 49f32404a9..8f0918a64a 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java
@@ -304,6 +304,7 @@ public class UrlEncodingParserSession extends 
UonParserSession {
                "java:S1168",    // TODO: null when currAttr is '%00'. Parser 
state machine.
                "java:S1213",    // Method name matches private method in 
parent class by design
                "java:S125",     // State-machine comments (S1: ..., S2: ...)
+               "java:S2583",    // State variables persist across loop 
iterations
                "java:S3776",
                "java:S6541"
        })
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlBeanPropertyMeta.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlBeanPropertyMeta.java
index 03f528969f..46f3ecda38 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlBeanPropertyMeta.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlBeanPropertyMeta.java
@@ -141,7 +141,7 @@ public class XmlBeanPropertyMeta extends 
ExtendedBeanPropertyMeta {
                        } else {
                                throw bex(cmBean.inner(), "Annotation error on 
property ''{0}''.  @Xml.format=COLLAPSED can only be specified on collections 
and arrays.", name);
                        }
-                       if (cen.isEmpty() && isCollection)
+                       if (cen.isEmpty())
                                cen = cmProperty.getBeanDictionaryName();
                }
 

Reply via email to