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:52 UTC

[jspwiki] branch master updated (168cd47 -> 1ba2c7e)

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

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


    from 168cd47  2.11.0-M7-git-16
     new a5ee51c  Fix sonar issue: make isEnabled synchronized to match setEnabled
     new f34a799  Fix sonar issue: call remove on threadlocal variable c_guestSession when session is removed
     new 62e85b9  Fix sonar issue: (re)add equals method, as there's already a hashCode() one
     new 1ba2c7e  Fix bug detected by Sonar, command should be compared againsts PageCommand, not against the ContextEnum - No version bump

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/java/org/apache/wiki/WikiContext.java |  2 +-
 .../src/main/java/org/apache/wiki/WikiPage.java    | 27 +++++++---------------
 .../src/main/java/org/apache/wiki/WikiSession.java |  1 +
 .../org/apache/wiki/rss/DefaultRSSGenerator.java   |  2 +-
 4 files changed, 11 insertions(+), 21 deletions(-)


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

Posted by ju...@apache.org.
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}


[jspwiki] 04/04: Fix bug detected by Sonar, command should be compared againsts PageCommand, not against the ContextEnum - No version bump

Posted by ju...@apache.org.
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 1ba2c7e408153546106a6dc67f4672846256f7d5
Author: juanpablo <ju...@apache.org>
AuthorDate: Sun Mar 29 12:16:27 2020 +0200

    Fix bug detected by Sonar, command should be compared againsts PageCommand, not against the ContextEnum - No version bump
---
 jspwiki-main/src/main/java/org/apache/wiki/WikiContext.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/WikiContext.java b/jspwiki-main/src/main/java/org/apache/wiki/WikiContext.java
index 7df7b5b..2c7b8e3 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/WikiContext.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/WikiContext.java
@@ -211,7 +211,7 @@ public class WikiContext implements Context, Command {
         m_realPage = m_page;
 
         // Special case: retarget any empty 'view' PageCommands to the front page
-        if ( ContextEnum.PAGE_VIEW.equals( command ) && command.getTarget() == null ) {
+        if ( PageCommand.VIEW.equals( command ) && command.getTarget() == null ) {
             m_command = command.targetedCommand( m_page );
         }
 


[jspwiki] 01/04: Fix sonar issue: make isEnabled synchronized to match setEnabled

Posted by ju...@apache.org.
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 a5ee51c9478aca5a4e5b980dfcc041a2b86f6311
Author: juanpablo <ju...@apache.org>
AuthorDate: Sun Mar 29 12:11:50 2020 +0200

    Fix sonar issue: make isEnabled synchronized to match setEnabled
    
    in order to avoid 'inconsistent behavior at runtime as callers access an inconsistent method state'
---
 jspwiki-main/src/main/java/org/apache/wiki/rss/DefaultRSSGenerator.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/rss/DefaultRSSGenerator.java b/jspwiki-main/src/main/java/org/apache/wiki/rss/DefaultRSSGenerator.java
index 8790fcc..166d99a 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/rss/DefaultRSSGenerator.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/rss/DefaultRSSGenerator.java
@@ -198,7 +198,7 @@ public class DefaultRSSGenerator implements RSSGenerator {
 
     /** {@inheritDoc} */
     @Override
-    public boolean isEnabled() {
+    public synchronized boolean isEnabled() {
         return m_enabled;
     }
 


[jspwiki] 02/04: Fix sonar issue: call remove on threadlocal variable c_guestSession when session is removed

Posted by ju...@apache.org.
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 f34a799ed6c59804355fb4302b161d2551bfa3a9
Author: juanpablo <ju...@apache.org>
AuthorDate: Sun Mar 29 12:13:48 2020 +0200

    Fix sonar issue: call remove on threadlocal variable c_guestSession when session is removed
    
    thread could be reused on application servers, which may end up causing memory leaks
---
 jspwiki-main/src/main/java/org/apache/wiki/WikiSession.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/WikiSession.java b/jspwiki-main/src/main/java/org/apache/wiki/WikiSession.java
index 7c3a295..f9bfd90 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/WikiSession.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/WikiSession.java
@@ -467,6 +467,7 @@ public final class WikiSession implements Session {
         }
         final SessionMonitor monitor = SessionMonitor.getInstance( engine );
         monitor.remove( request.getSession() );
+        c_guestSession.remove();
     }
 
     /**