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

markt 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 8618c293cf Fix BZ 66822. Use same name format for Connector and 
ProtocolHandler
8618c293cf is described below

commit 8618c293cf4c0104d84c2abba425f7d5d5f83323
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Aug 3 14:40:03 2023 +0100

    Fix BZ 66822. Use same name format for Connector and ProtocolHandler
    
    https://bz.apache.org/bugzilla/show_bug.cgi?id=66822
---
 java/org/apache/catalina/connector/Connector.java | 27 ++++++++++++++---------
 webapps/docs/changelog.xml                        |  4 ++++
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/java/org/apache/catalina/connector/Connector.java 
b/java/org/apache/catalina/connector/Connector.java
index 1c06a724f2..190c3aa3fa 100644
--- a/java/org/apache/catalina/connector/Connector.java
+++ b/java/org/apache/catalina/connector/Connector.java
@@ -1097,19 +1097,24 @@ public class Connector extends LifecycleMBeanBase {
     public String toString() {
         // Not worth caching this right now
         StringBuilder sb = new StringBuilder("Connector[");
-        sb.append(getProtocol());
-        sb.append('-');
-        String id = (protocolHandler != null) ? protocolHandler.getId() : null;
-        if (id != null) {
-            sb.append(id);
-        } else {
-            int port = getPortWithOffset();
-            if (port > 0) {
-                sb.append(port);
+        String name = (String) getProperty("name");
+        if (name == null) {
+            sb.append(getProtocol());
+            sb.append('-');
+            String id = (protocolHandler != null) ? protocolHandler.getId() : 
null;
+            if (id != null) {
+                sb.append(id);
             } else {
-                sb.append("auto-");
-                sb.append(getProperty("nameIndex"));
+                int port = getPortWithOffset();
+                if (port > 0) {
+                    sb.append(port);
+                } else {
+                    sb.append("auto-");
+                    sb.append(getProperty("nameIndex"));
+                }
             }
+        } else {
+            sb.append(name);
         }
         sb.append(']');
         return sb.toString();
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index cf09e49a8a..620ee71966 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -124,6 +124,10 @@
         presistence process, do not log a warning that null Principals are not
         serializable. Pull request <pr>638</pr> provided by tsryo. (markt)
       </fix>
+      <fix>
+        <bug>66822</bug>: Use the same naming format in log messages for
+        Connector instances as the associated ProtocolHandler instance. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to