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

commit 7b2cf3ebebec826da86250cc4c8ba914ca2207ef
Author: James Bognar <[email protected]>
AuthorDate: Tue Feb 3 19:34:30 2026 -0500

    SonarQube bug fixes
---
 .../src/main/java/org/apache/juneau/cp/BasicBeanStore.java |  3 +--
 .../org/apache/juneau/serializer/SerializerSession.java    | 12 ++++++------
 .../java/org/apache/juneau/rest/client/RestRequest.java    |  5 ++---
 .../main/java/org/apache/juneau/http/header/Thrown.java    |  2 +-
 .../src/main/java/org/apache/juneau/rest/RestContext.java  | 14 +++++++-------
 .../org/apache/juneau/rest/matcher/RestMatcherList.java    |  3 +--
 .../java/org/apache/juneau/rest/stats/MethodExecStore.java |  2 +-
 .../java/org/apache/juneau/rest/stats/ThrownStore.java     |  5 ++---
 8 files changed, 21 insertions(+), 25 deletions(-)

diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicBeanStore.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicBeanStore.java
index 33f96834e4..3149e9156f 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicBeanStore.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicBeanStore.java
@@ -17,7 +17,6 @@
 package org.apache.juneau.cp;
 
 import static java.util.stream.Collectors.*;
-import static java.util.stream.Collectors.toList;
 import static org.apache.juneau.commons.reflect.ReflectionUtils.*;
 import static org.apache.juneau.commons.utils.AssertionUtils.*;
 import static org.apache.juneau.commons.utils.CollectionUtils.*;
@@ -504,7 +503,7 @@ public class BasicBeanStore {
        protected FluentMap<String,Object> properties() {
                // @formatter:off
                return filteredBeanPropertyMap()
-                       .a("entries", 
entries.stream().map(Entry::properties).collect(toList()))
+                       .a("entries", 
entries.stream().map(Entry::properties).toList())
                        .a("identity", id(this))
                        .a("parent", 
parent.map(BasicBeanStore::properties).orElse(null))
                        .ai(readOnly, "readOnly", readOnly)
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSession.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSession.java
index a812aa297a..8087b67e3d 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSession.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSession.java
@@ -401,7 +401,7 @@ public class SerializerSession extends BeanTraverseSession {
        public final <E> void forEachEntry(Collection<E> c, Consumer<E> 
consumer) {
                if (c == null || c.isEmpty())
                        return;
-               if (isSortCollections() && ! SortedSet.class.isInstance(c) && 
isSortable(c))
+               if (isSortCollections() && !(c instanceof SortedSet) && 
isSortable(c))
                        c.stream().sorted().forEach(consumer);
                else
                        c.forEach(consumer);
@@ -419,7 +419,7 @@ public class SerializerSession extends BeanTraverseSession {
        public final <K,V> void forEachEntry(Map<K,V> m, 
Consumer<Map.Entry<K,V>> consumer) {
                if (m == null || m.isEmpty())
                        return;
-               if (isSortMaps() && ! SortedMap.class.isInstance(m) && 
isSortable(m.keySet()))
+               if (isSortMaps() && !(m instanceof SortedMap) && 
isSortable(m.keySet()))
                        
((Map)m).entrySet().stream().sorted(Map.Entry.comparingByKey()).forEach(x -> 
consumer.accept((Map.Entry<K,V>)x));
                else
                        m.entrySet().forEach(consumer);
@@ -589,10 +589,10 @@ public class SerializerSession extends 
BeanTraverseSession {
         * @return A new sorted {@link TreeSet}.
         */
        public final <E> Collection<E> sort(Collection<E> c) {
-               if (c == null || c.isEmpty() || SortedSet.class.isInstance(c))
+               if (c == null || c.isEmpty() || c instanceof SortedSet)
                        return c;
                if (isSortCollections() && isSortable(c))
-                       return c.stream().sorted().collect(Collectors.toList());
+                       return c.stream().sorted().toList();
                return c;
        }
 
@@ -607,7 +607,7 @@ public class SerializerSession extends BeanTraverseSession {
                if (c == null || c.isEmpty())
                        return c;
                if (isSortCollections() && isSortable(c))
-                       return c.stream().sorted().collect(Collectors.toList());
+                       return c.stream().sorted().toList();
                return c;
        }
 
@@ -620,7 +620,7 @@ public class SerializerSession extends BeanTraverseSession {
         * @return A new sorted {@link TreeMap}.
         */
        public final <K,V> Map<K,V> sort(Map<K,V> m) {
-               if (m == null || m.isEmpty() || SortedMap.class.isInstance(m))
+               if (m == null || m.isEmpty() || m instanceof SortedMap)
                        return m;
                if (isSortMaps() && isSortable(m.keySet()))
                        return new TreeMap<>(m);
diff --git 
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequest.java
 
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequest.java
index 734d9bcf23..937b3f4f67 100644
--- 
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequest.java
+++ 
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.juneau.rest.client;
 
-import static java.util.stream.Collectors.toList;
 import static org.apache.juneau.commons.utils.AssertionUtils.*;
 import static org.apache.juneau.commons.utils.CollectionUtils.*;
 import static org.apache.juneau.commons.utils.IoUtils.*;
@@ -1928,7 +1927,7 @@ public class RestRequest extends BeanSession implements 
HttpUriRequest, Configur
                                if (content != NO_BODY) {
                                        input2 = content;
                                } else {
-                                       input2 = new 
UrlEncodedFormEntity(formData.stream().map(SimpleFormData::new).filter(SimplePart::isValid).collect(toList()));
+                                       input2 = new 
UrlEncodedFormEntity(formData.stream().map(SimpleFormData::new).filter(SimplePart::isValid).toList());
                                }
 
                                if (input2 instanceof Supplier<?> s)
@@ -1936,7 +1935,7 @@ public class RestRequest extends BeanSession implements 
HttpUriRequest, Configur
 
                                var entity = (HttpEntity)null;
                                if (input2 instanceof PartList input22)
-                                       entity = new 
UrlEncodedFormEntity(input22.stream().map(SimpleFormData::new).filter(SimplePart::isValid).collect(toList()));
+                                       entity = new 
UrlEncodedFormEntity(input22.stream().map(SimpleFormData::new).filter(SimplePart::isValid).toList());
                                else if (input2 instanceof HttpResource 
input23) {
                                        
input23.getHeaders().forEach(request::addHeader);
                                        entity = (HttpEntity)input2;
diff --git 
a/juneau-rest/juneau-rest-common/src/main/java/org/apache/juneau/http/header/Thrown.java
 
b/juneau-rest/juneau-rest-common/src/main/java/org/apache/juneau/http/header/Thrown.java
index 59378e2cc0..f20d5fc24b 100644
--- 
a/juneau-rest/juneau-rest-common/src/main/java/org/apache/juneau/http/header/Thrown.java
+++ 
b/juneau-rest/juneau-rest-common/src/main/java/org/apache/juneau/http/header/Thrown.java
@@ -144,7 +144,7 @@ public class Thrown extends BasicCsvHeader {
         * @return A new header bean, or <jk>null</jk> if the value is 
<jk>null</jk>.
         */
        public static Thrown of(Throwable...values) {
-               return new 
Thrown(l(values).stream().map(Part::new).collect(Collectors.toList()));
+               return new Thrown(l(values).stream().map(Part::new).toList());
        }
 
        private final List<Part> value;
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 2d2c7d203d..12e829a906 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
@@ -4064,7 +4064,7 @@ public class RestContext extends Context {
                protected MethodList createDestroyMethods(BasicBeanStore 
beanStore, Supplier<?> resource) {
 
                        // Default value.
-                       var v = 
Value.of(MethodList.of(getAnnotatedMethods(resource, 
RestDestroy.class).collect(Collectors.toList())));
+                       var v = 
Value.of(MethodList.of(getAnnotatedMethods(resource, 
RestDestroy.class).toList()));
 
                        // Replace with bean from:  
@RestInject(name="destroyMethods") public [static] MethodList xxx(<args>)
                        new BeanCreateMethodFinder<>(MethodList.class, 
resource.get(), beanStore).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "destroyMethods")).run(x -> v.set(x));
@@ -4116,7 +4116,7 @@ public class RestContext extends Context {
                protected MethodList createEndCallMethods(BasicBeanStore 
beanStore, Supplier<?> resource) {
 
                        // Default value.
-                       Value<MethodList> v = 
Value.of(MethodList.of(getAnnotatedMethods(resource, 
RestEndCall.class).collect(Collectors.toList())));
+                       Value<MethodList> v = 
Value.of(MethodList.of(getAnnotatedMethods(resource, 
RestEndCall.class).toList()));
 
                        // Replace with bean from:  
@RestInject(name="endCallMethods") public [static] MethodList xxx(<args>)
                        new BeanCreateMethodFinder<>(MethodList.class, 
resource.get(), beanStore).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "endCallMethods")).run(x -> v.set(x));
@@ -4356,7 +4356,7 @@ public class RestContext extends Context {
                protected MethodList createPostCallMethods(BasicBeanStore 
beanStore, Supplier<?> resource) {
 
                        // Default value.
-                       Value<MethodList> v = 
Value.of(MethodList.of(getAnnotatedMethods(resource, 
RestPostCall.class).collect(Collectors.toList())));
+                       Value<MethodList> v = 
Value.of(MethodList.of(getAnnotatedMethods(resource, 
RestPostCall.class).toList()));
 
                        // Replace with bean from:  
@RestInject(name="postCallMethods") public [static] MethodList xxx(<args>)
                        new BeanCreateMethodFinder<>(MethodList.class, 
resource.get(), beanStore).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "postCallMethods")).run(x -> v.set(x));
@@ -4384,7 +4384,7 @@ public class RestContext extends Context {
                                                .map(AnnotationInfo::inner)
                                                
.anyMatch(RestPostInit::childFirst);
                                })
-                               .collect(Collectors.toList())));
+                               .toList()));
 
                        // Replace with bean from:  
@RestInject(name="postInitChildFirstMethods") public [static] MethodList 
xxx(<args>)
                        new BeanCreateMethodFinder<>(MethodList.class, 
resource.get(), beanStore).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "postInitChildFirstMethods")).run(x -> v.set(x));
@@ -4412,7 +4412,7 @@ public class RestContext extends Context {
                                                .map(AnnotationInfo::inner)
                                                .anyMatch(x -> ! 
x.childFirst());
                                })
-                               .collect(Collectors.toList())));
+                               .toList()));
 
                        // Replace with bean from:  
@RestInject(name="postInitMethods") public [static] MethodList xxx(<args>)
                        new BeanCreateMethodFinder<>(MethodList.class, 
resource.get(), beanStore).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "postInitMethods")).run(x -> v.set(x));
@@ -4432,7 +4432,7 @@ public class RestContext extends Context {
                protected MethodList createPreCallMethods(BasicBeanStore 
beanStore, Supplier<?> resource) {
 
                        // Default value.
-                       Value<MethodList> v = 
Value.of(MethodList.of(getAnnotatedMethods(resource, 
RestPreCall.class).collect(Collectors.toList())));
+                       Value<MethodList> v = 
Value.of(MethodList.of(getAnnotatedMethods(resource, 
RestPreCall.class).toList()));
 
                        // Replace with bean from:  
@RestInject(name="preCallMethods") public [static] MethodList xxx(<args>)
                        new BeanCreateMethodFinder<>(MethodList.class, 
resource.get(), beanStore).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "preCallMethods")).run(x -> v.set(x));
@@ -4727,7 +4727,7 @@ public class RestContext extends Context {
                protected MethodList createStartCallMethods(BasicBeanStore 
beanStore, Supplier<?> resource) {
 
                        // Default value.
-                       Value<MethodList> v = 
Value.of(MethodList.of(getAnnotatedMethods(resource, 
RestStartCall.class).collect(Collectors.toList())));
+                       Value<MethodList> v = 
Value.of(MethodList.of(getAnnotatedMethods(resource, 
RestStartCall.class).toList()));
 
                        // Replace with bean from:  
@RestInject(name="startCallMethods") public [static] MethodList xxx(<args>)
                        new BeanCreateMethodFinder<>(MethodList.class, 
resource.get(), beanStore).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "startCallMethods")).run(x -> v.set(x));
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/matcher/RestMatcherList.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/matcher/RestMatcherList.java
index d6b33b6cd6..26553cb023 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/matcher/RestMatcherList.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/matcher/RestMatcherList.java
@@ -16,7 +16,6 @@
  */
 package org.apache.juneau.rest.matcher;
 
-import static java.util.stream.Collectors.toList;
 import static org.apache.juneau.commons.utils.CollectionUtils.*;
 
 import java.util.*;
@@ -112,7 +111,7 @@ public class RestMatcherList {
         * @param builder The builder containing the contents for this list.
         */
        protected RestMatcherList(Builder builder) {
-               List<RestMatcher> l = 
builder.entries.stream().map(BeanCreator::run).collect(toList());
+               List<RestMatcher> l = 
builder.entries.stream().map(BeanCreator::run).toList();
                optionalEntries = l.stream().filter(x -> ! 
x.required()).toArray(RestMatcher[]::new);
                requiredEntries = 
l.stream().filter(RestMatcher::required).toArray(RestMatcher[]::new);
        }
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/stats/MethodExecStore.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/stats/MethodExecStore.java
index c57e089e04..0b0cc974c1 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/stats/MethodExecStore.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/stats/MethodExecStore.java
@@ -205,7 +205,7 @@ public class MethodExecStore {
         *
         * @return A list of timing statistics ordered by average execution 
time descending.
         */
-       public List<MethodExecStats> getStatsByTotalTime() { return 
getStats().stream().sorted(Comparator.comparingLong(MethodExecStats::getTotalTime).reversed()).collect(toList());
 }
+       public List<MethodExecStats> getStatsByTotalTime() { return 
getStats().stream().sorted(Comparator.comparingLong(MethodExecStats::getTotalTime).reversed()).toList();
 }
 
        /**
         * Returns the thrown exception store being used by this store.
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/stats/ThrownStore.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/stats/ThrownStore.java
index f5cac71d1a..516cebd567 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/stats/ThrownStore.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/stats/ThrownStore.java
@@ -17,7 +17,6 @@
 package org.apache.juneau.rest.stats;
 
 import static java.util.Comparator.*;
-import static java.util.stream.Collectors.toList;
 import static java.util.stream.Collectors.toSet;
 import static org.apache.juneau.commons.utils.CollectionUtils.*;
 import static org.apache.juneau.commons.utils.Utils.*;
@@ -190,7 +189,7 @@ public class ThrownStore {
         *
         * @return The list of all stack traces in this database, cloned and 
sorted by count descending.
         */
-       public List<ThrownStats> getStats() { return 
db.values().stream().map(ThrownStats::clone).sorted(comparingInt(ThrownStats::getCount).reversed()).collect(toList());
 }
+       public List<ThrownStats> getStats() { return 
db.values().stream().map(ThrownStats::clone).sorted(comparingInt(ThrownStats::getCount).reversed()).toList();
 }
 
        /**
         * Retrieves the stack trace information for the exception with the 
specified hash as calculated by {@link #hash(Throwable)}.
@@ -259,7 +258,7 @@ public class ThrownStore {
         * @return A modifiable list of strings.
         */
        protected List<String> createStackTrace(Throwable t) {
-               return 
l(t.getStackTrace()).stream().filter(this::include).map(this::normalize).collect(toList());
+               return 
l(t.getStackTrace()).stream().filter(this::include).map(this::normalize).toList();
        }
 
        /**

Reply via email to