Reviewing Eclipse warnings I noticed a bug in this commit.

2011/9/22  <rj...@apache.org>:
> Author: rjung
> Date: Thu Sep 22 15:01:08 2011
> New Revision: 1174181
>
> URL: http://svn.apache.org/viewvc?rev=1174181&view=rev
> Log:
> - Pull up members "cluster" and "notifyListenersOnReplication"
>  to common base class.
> - Pull up common clone code to base class.
> - Add sessionAttributeFilter to clone method
> - Reduce visibility of notifyListenersOnReplication
>
> Backport of r1173088, r1173090, r1173461 from trunk.
>
> Modified:
>    tomcat/tc7.0.x/trunk/   (props changed)
>    tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/BackupManager.java
>    
> tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/ClusterManagerBase.java
>    tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/DeltaManager.java
>    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
>
(..)
> @@ -259,12 +225,9 @@ public class BackupManager extends Clust
>     @Override
>     public ClusterManager cloneFromTemplate() {
>         BackupManager result = new BackupManager();
> +        clone(result);
>         result.mExpireSessionsOnShutdown = mExpireSessionsOnShutdown;
> -        result.name = "Clone-from-"+name;
> -        result.cluster = cluster;
> -        result.notifyListenersOnReplication = notifyListenersOnReplication;
>         result.mapSendOptions = mapSendOptions;
> -        result.maxActiveSessions = maxActiveSessions;
>         result.rpcTimeout = rpcTimeout;
>         return result;
>     }



> +    protected void clone(ClusterManagerBase copy) {
> +        copy.name = "Clone-from-" + getName();

The above assignment is wrong.
It assigns to ManagerBase.name which is a static field.
(Why that field exists and why it is not final is another question).

The old code was assigning the value to BackupManager.name, which is
an instance field.

> +        copy.cluster = getCluster();
> +        copy.maxActiveSessions = getMaxActiveSessions();
> +        copy.notifyListenersOnReplication = isNotifyListenersOnReplication();
> +        copy.setSessionAttributeFilter(getSessionAttributeFilter());
> +    }

In Eclipse the warning was:
The static field ManagerBase.name should be accessed in a static way    

Also there are several missing @Override annotations in the new methods.

Best regards,
Konstantin Kolinko

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

Reply via email to