Use setters when cloning attributes.
authorrjung <rjung@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 24 Sep 2011 11:02:41 +0000 (11:02 +0000)
committerrjung <rjung@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 24 Sep 2011 11:02:41 +0000 (11:02 +0000)
Should be more safe in most cases.

Example: setting name directly was wrong,
because name in base class was something else
then in the sub classes.

Not using the setter for maxActiveSessions,
because it will also call property change
listeners.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1175155 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/ha/session/ClusterManagerBase.java

index 8cf201f..542f94d 100644 (file)
@@ -181,10 +181,10 @@ public abstract class ClusterManagerBase extends ManagerBase
     }
 
     protected void clone(ClusterManagerBase copy) {
-        copy.name = "Clone-from-" + getName();
-        copy.cluster = getCluster();
+        copy.setName("Clone-from-" + getName());
+        copy.setCluster(getCluster());
         copy.maxActiveSessions = getMaxActiveSessions();
-        copy.notifyListenersOnReplication = isNotifyListenersOnReplication();
+        copy.setNotifyListenersOnReplication(isNotifyListenersOnReplication());
         copy.setSessionAttributeFilter(getSessionAttributeFilter());
     }