Author: yoavs
Date: Sun Mar 25 08:56:39 2007
New Revision: 522289

URL: http://svn.apache.org/viewvc?view=rev&rev=522289
Log:
Bugzilla 39866: avoid duplicate cluster manager names being appended to each 
other.

Modified:
    
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
    tomcat/container/tc5.5.x/webapps/docs/changelog.xml

Modified: 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
URL: 
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java?view=diff&rev=522289&r1=522288&r2=522289
==============================================================================
--- 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
 (original)
+++ 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
 Sun Mar 25 08:56:39 2007
@@ -620,20 +620,36 @@
     }
 
     /**
-     * @param name
-     * @param manager
-     * @return
+     * Returns the name for the cluster manager.  This name
+     * depends on whether the cluster manager is defined inside
+     * a Host or an Engine.
+     *
+     * See also Bugzilla 39866:
+     * http://issues.apache.org/bugzilla/show_bug.cgi?id=39866
+     *
+     * @param name The current name
+     * @param manager The cluster manager implementation
+     * @return The name to use for the cluster manager
      */
     private String getManagerName(String name, Manager manager) {
-        String clusterName = name ;
-        if(getContainer() instanceof Engine) {
-            Container context = manager.getContainer() ;
-            if(context != null && context instanceof Context) {
+        String clusterName = name;
+
+        if (getContainer() instanceof Engine) {
+            Container context = manager.getContainer();
+
+            if (context instanceof Context) {
                 Container host = ((Context)context).getParent();
-                if(host != null && host instanceof Host)
-                    clusterName = host.getName()  + name ;
+
+                if (host instanceof Host) {
+                    // Bugzilla 39866 shows duplicate names
+                    // http://issues.apache.org/bugzilla/show_bug.cgi?id=39866
+                    if (! (host.getName().equals(name))) {
+                        clusterName = host.getName() + name;
+                    }
+                }
             }
         }
+
         return clusterName;
     }
 

Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?view=diff&rev=522289&r1=522288&r2=522289
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Sun Mar 25 08:56:39 2007
@@ -41,6 +41,13 @@
       </update>
     </changelog>
   </subsection>
+  <subsection name="Cluster">
+    <changelog>
+      <fix>
+        <bug>39866</bug> Duplicate names appended to cluster manager name. 
(yoavs)
+      </fix>
+    </changelog>
+  </subsection>   
 </section>
 
 <section name="Tomcat 5.5.23 (fhanik)">
@@ -467,7 +474,6 @@
       </add>
     </changelog>
   </subsection>   
-
 </section>
 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to