This is an automated email from the ASF dual-hosted git repository.
rmaucher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 33d5615fce Additional code review minor fixes
33d5615fce is described below
commit 33d5615fce7ad05372b216f63ad8987b4b433d32
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 da57146c13..1d7ba6ed8f 100644
--- a/java/org/apache/catalina/core/StandardContext.java
+++ b/java/org/apache/catalina/core/StandardContext.java
@@ -2862,7 +2862,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 d44f5b17df..d53753a575 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 d2372fd1c7..80c0852494 100644
--- a/java/org/apache/tomcat/util/descriptor/web/ContextService.java
+++ b/java/org/apache/tomcat/util/descriptor/web/ContextService.java
@@ -380,9 +380,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 3425904264..d118698a57 100644
--- a/java/org/apache/tomcat/util/descriptor/web/ErrorPage.java
+++ b/java/org/apache/tomcat/util/descriptor/web/ErrorPage.java
@@ -138,6 +138,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 112121c758..dbd4586c15 100644
--- a/java/org/apache/tomcat/util/descriptor/web/MessageDestinationRef.java
+++ b/java/org/apache/tomcat/util/descriptor/web/MessageDestinationRef.java
@@ -92,7 +92,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 01e89a09f4..c0ca4b9e17 100644
--- a/java/org/apache/tomcat/util/descriptor/web/SecurityRoleRef.java
+++ b/java/org/apache/tomcat/util/descriptor/web/SecurityRoleRef.java
@@ -18,6 +18,7 @@ package org.apache.tomcat.util.descriptor.web;
import java.io.Serial;
import java.io.Serializable;
+import java.util.Objects;
/**
@@ -110,4 +111,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]