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

rmaucher pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 7fb84b85d2 Additional code review minor fixes
7fb84b85d2 is described below

commit 7fb84b85d205d99dd9ae6dbb36d48356b62c8d3c
Author: remm <[email protected]>
AuthorDate: Mon Jun 1 23:08:55 2026 +0200

    Additional code review minor fixes
---
 java/org/apache/catalina/core/StandardContext.java |  2 +-
 .../tomcat/util/descriptor/tld/TldRuleSet.java     |  4 ++--
 .../tomcat/util/descriptor/web/ContextService.java | 10 +++++++--
 .../tomcat/util/descriptor/web/ErrorPage.java      | 10 +++++++++
 .../util/descriptor/web/MessageDestinationRef.java |  2 +-
 .../util/descriptor/web/SecurityRoleRef.java       | 25 ++++++++++++++++++++++
 .../tomcat/util/http/ConcurrentDateFormat.java     | 18 ++++++++++------
 7 files changed, 58 insertions(+), 13 deletions(-)

diff --git a/java/org/apache/catalina/core/StandardContext.java 
b/java/org/apache/catalina/core/StandardContext.java
index cb83b90086..fc75266a7a 100644
--- a/java/org/apache/catalina/core/StandardContext.java
+++ b/java/org/apache/catalina/core/StandardContext.java
@@ -2817,7 +2817,7 @@ public class StandardContext extends ContainerBase 
implements Context, Notificat
                 if (log.isDebugEnabled()) {
                     
log.debug(sm.getString("standardContext.errorPage.warning", location));
                 }
-                errorPage.setLocation("/" + location);
+                errorPage.setDecodedLocation("/" + location);
             } else {
                 throw new 
IllegalArgumentException(sm.getString("standardContext.errorPage.error", 
location));
             }
diff --git a/java/org/apache/tomcat/util/descriptor/tld/TldRuleSet.java 
b/java/org/apache/tomcat/util/descriptor/tld/TldRuleSet.java
index 251608c6a0..a652d87ae6 100644
--- a/java/org/apache/tomcat/util/descriptor/tld/TldRuleSet.java
+++ b/java/org/apache/tomcat/util/descriptor/tld/TldRuleSet.java
@@ -134,8 +134,8 @@ public class TldRuleSet implements RuleSet {
 
     private void addDescriptionGroup(Digester digester, String prefix) {
         digester.addCallMethod(prefix + "/info", "setInfo", 0);
-        digester.addCallMethod(prefix + "small-icon", "setSmallIcon", 0);
-        digester.addCallMethod(prefix + "large-icon", "setLargeIcon", 0);
+        digester.addCallMethod(prefix + "/small-icon", "setSmallIcon", 0);
+        digester.addCallMethod(prefix + "/large-icon", "setLargeIcon", 0);
 
         digester.addCallMethod(prefix + "/description", "setInfo", 0);
         digester.addCallMethod(prefix + "/display-name", "setDisplayName", 0);
diff --git a/java/org/apache/tomcat/util/descriptor/web/ContextService.java 
b/java/org/apache/tomcat/util/descriptor/web/ContextService.java
index dc35cba42e..690ff3fb1a 100644
--- a/java/org/apache/tomcat/util/descriptor/web/ContextService.java
+++ b/java/org/apache/tomcat/util/descriptor/web/ContextService.java
@@ -378,9 +378,15 @@ public class ContextService extends ResourceBase {
             sb.append(", service-qname/localpart=");
             sb.append(serviceqname[1]);
         }
-        if (this.getServiceendpoints() != null) {
+        Iterator<String> serviceEndpoints = getServiceendpoints();
+        if (serviceEndpoints.hasNext()) {
             sb.append(", port-component/service-endpoint-interface=");
-            sb.append(this.getServiceendpoints());
+            while (serviceEndpoints.hasNext()) {
+                sb.append(serviceEndpoints.next());
+                if (serviceEndpoints.hasNext()) {
+                    sb.append(',');
+                }
+            }
         }
         if (!handlers.isEmpty()) {
             sb.append(", handler=");
diff --git a/java/org/apache/tomcat/util/descriptor/web/ErrorPage.java 
b/java/org/apache/tomcat/util/descriptor/web/ErrorPage.java
index 3f9f816aaa..0a2662dd5b 100644
--- a/java/org/apache/tomcat/util/descriptor/web/ErrorPage.java
+++ b/java/org/apache/tomcat/util/descriptor/web/ErrorPage.java
@@ -135,6 +135,16 @@ public class ErrorPage extends XmlEncodingBase implements 
Serializable {
     }
 
 
+    /**
+     * Set the already URL decoded location.
+     *
+     * @param location The new location
+     */
+    public void setDecodedLocation(String location) {
+        this.location = location;
+    }
+
+
     // --------------------------------------------------------- Public Methods
 
 
diff --git 
a/java/org/apache/tomcat/util/descriptor/web/MessageDestinationRef.java 
b/java/org/apache/tomcat/util/descriptor/web/MessageDestinationRef.java
index 1498483616..f2c0ac2232 100644
--- a/java/org/apache/tomcat/util/descriptor/web/MessageDestinationRef.java
+++ b/java/org/apache/tomcat/util/descriptor/web/MessageDestinationRef.java
@@ -89,7 +89,7 @@ public class MessageDestinationRef extends ResourceBase {
      */
     @Override
     public String toString() {
-        StringBuilder sb = new StringBuilder("MessageDestination[");
+        StringBuilder sb = new StringBuilder("MessageDestinationRef[");
         sb.append("name=");
         sb.append(getName());
         if (link != null) {
diff --git a/java/org/apache/tomcat/util/descriptor/web/SecurityRoleRef.java 
b/java/org/apache/tomcat/util/descriptor/web/SecurityRoleRef.java
index 63b736c5ff..d5dda48605 100644
--- a/java/org/apache/tomcat/util/descriptor/web/SecurityRoleRef.java
+++ b/java/org/apache/tomcat/util/descriptor/web/SecurityRoleRef.java
@@ -17,6 +17,7 @@
 package org.apache.tomcat.util.descriptor.web;
 
 import java.io.Serializable;
+import java.util.Objects;
 
 
 /**
@@ -108,4 +109,28 @@ public class SecurityRoleRef implements Serializable {
     }
 
 
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((link == null) ? 0 : link.hashCode());
+        result = prime * result + ((name == null) ? 0 : name.hashCode());
+        return result;
+    }
+
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        SecurityRoleRef other = (SecurityRoleRef) obj;
+        if (!Objects.equals(link, other.link)) {
+            return false;
+        }
+        return Objects.equals(name, other.name);
+    }
 }
diff --git a/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java 
b/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java
index 5dbaf49b10..ce38872686 100644
--- a/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java
+++ b/java/org/apache/tomcat/util/http/ConcurrentDateFormat.java
@@ -61,9 +61,11 @@ public class ConcurrentDateFormat {
         if (sdf == null) {
             sdf = createInstance();
         }
-        String result = sdf.format(date);
-        queue.add(sdf);
-        return result;
+        try {
+            return sdf.format(date);
+        } finally {
+            queue.add(sdf);
+        }
     }
 
     /**
@@ -78,10 +80,12 @@ public class ConcurrentDateFormat {
         if (sdf == null) {
             sdf = createInstance();
         }
-        Date result = sdf.parse(source);
-        sdf.setTimeZone(timezone);
-        queue.add(sdf);
-        return result;
+        try {
+            return sdf.parse(source);
+        } finally {
+            sdf.setTimeZone(timezone);
+            queue.add(sdf);
+        }
     }
 
     private SimpleDateFormat createInstance() {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to