You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2020/03/29 10:16:55 UTC

[jspwiki] 03/04: Fix sonar issue: (re)add equals method, as there's already a hashCode() one

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

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 62e85b9279f116c344072c906f3530fe7f5565be
Author: juanpablo <ju...@apache.org>
AuthorDate: Sun Mar 29 12:15:15 2020 +0200

    Fix sonar issue: (re)add equals method, as there's already a hashCode() one
    
    caching problems should be fixed some releases ago, so it should be safe to re-add the method. We'll see...
---
 .../src/main/java/org/apache/wiki/WikiPage.java    | 27 +++++++---------------
 1 file changed, 8 insertions(+), 19 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/WikiPage.java b/jspwiki-main/src/main/java/org/apache/wiki/WikiPage.java
index ce38d23..ec581b7 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/WikiPage.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/WikiPage.java
@@ -209,7 +209,7 @@ public class WikiPage implements Page {
     /**
      * Sets the Acl for this page. Note that method does <em>not</em> persist the Acl itself to back-end storage or in page markup;
      * it merely sets the internal field that stores the Acl. To persist the Acl, callers should invoke
-     * {@link org.apache.wiki.auth.acl.AclManager#setPermissions(WikiPage, Acl)}.
+     * {@link org.apache.wiki.auth.acl.AclManager#setPermissions(Page, org.apache.wiki.api.core.Acl)}.
      *
      * @param acl The Acl to set
      * @deprecated use {@link #setAcl(org.apache.wiki.api.core.Acl)}
@@ -223,7 +223,7 @@ public class WikiPage implements Page {
     /**
      * Sets the Acl for this page. Note that method does <em>not</em> persist the Acl itself to back-end storage or in page markup;
      * it merely sets the internal field that stores the Acl. To persist the Acl, callers should invoke
-     * {@link org.apache.wiki.auth.acl.AclManager#setPermissions(WikiPage, Acl)}.
+     * {@link org.apache.wiki.auth.acl.AclManager#setPermissions(Page, org.apache.wiki.api.core.Acl)}.
      *
      * @param acl The Acl to set
      */
@@ -355,27 +355,16 @@ public class WikiPage implements Page {
      *  
      *  {@inheritDoc}
      */
-    // TODO: I have a suspicion that defining this method causes some problems
-    //       with page attributes and caching.  So as of 2.7.32, it's disabled.
-    /*
-    public boolean equals( Object o )
-    {
-        if( o != null && o instanceof WikiPage )
-        {
-            WikiPage oo = (WikiPage) o;
-        
-            if( oo.getName().equals( getName() ) )
-            {
-                if( oo.getVersion() == getVersion() )
-                {
-                    return true;
-                }
+    public boolean equals( final Object o ) {
+        if( o instanceof WikiPage ) {
+            final WikiPage wp = ( WikiPage )o;
+            if( wp.getName().equals( getName() ) ) {
+                return wp.getVersion() == getVersion();
             }
         }
-        
+
         return false;
     }
-    */
 
     /**
      * {@inheritDoc}