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 43b1a87b44f42db1cc32d8ef06a65366edcfa10c
Author: juanpablo <[email protected]>
AuthorDate: Sat May 2 18:34:37 2020 +0200

    WikiEventManager: addWikiEventListener equality check inline with 
removeWikiEventListener equality check
    
    Fix javadocs typos + formatting suggested by IntelliJ
---
 .../org/apache/wiki/event/WikiEventManager.java    |  3 +-
 .../java/org/apache/wiki/event/WorkflowEvent.java  |  5 +-
 .../src/main/java/org/apache/wiki/WikiEngine.java  |  2 +-
 .../org/apache/wiki/filters/FilterManager.java     |  2 +-
 .../org/apache/wiki/workflow/DecisionQueue.java    | 13 ++--
 .../java/org/apache/wiki/workflow/Outcome.java     | 78 ++++++++--------------
 .../org/apache/wiki/workflow/SystemPrincipal.java  | 13 ++--
 .../src/test/java/org/apache/wiki/TestEngine.java  | 31 ++++-----
 8 files changed, 60 insertions(+), 87 deletions(-)

diff --git 
a/jspwiki-event/src/main/java/org/apache/wiki/event/WikiEventManager.java 
b/jspwiki-event/src/main/java/org/apache/wiki/event/WikiEventManager.java
index 95728fd..c737158 100644
--- a/jspwiki-event/src/main/java/org/apache/wiki/event/WikiEventManager.java
+++ b/jspwiki-event/src/main/java/org/apache/wiki/event/WikiEventManager.java
@@ -29,7 +29,6 @@ import java.util.ConcurrentModificationException;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Objects;
 import java.util.Set;
 import java.util.TreeSet;
 import java.util.Vector;
@@ -396,7 +395,7 @@ public final class WikiEventManager {
             synchronized( m_listenerList ) {
                 final boolean listenerAlreadyContained = 
m_listenerList.stream()
                                                                        .map( 
WeakReference::get )
-                                                                       
.anyMatch( ref -> Objects.equals( ref, listener ) );
+                                                                       
.anyMatch( ref -> ref == listener );
                 if( !listenerAlreadyContained ) {
                     return m_listenerList.add( new WeakReference<>( listener ) 
);
                 }
diff --git 
a/jspwiki-event/src/main/java/org/apache/wiki/event/WorkflowEvent.java 
b/jspwiki-event/src/main/java/org/apache/wiki/event/WorkflowEvent.java
index 7542790..6f40978 100644
--- a/jspwiki-event/src/main/java/org/apache/wiki/event/WorkflowEvent.java
+++ b/jspwiki-event/src/main/java/org/apache/wiki/event/WorkflowEvent.java
@@ -19,7 +19,6 @@
 
 package org.apache.wiki.event;
 
-
 /**
  * <p>
  * WorkflowEvent indicates that a state change to a Workflow: started, 
running, waiting, completed, aborted. 
@@ -43,8 +42,8 @@ public final class WorkflowEvent extends WikiEvent {
     public static final int STARTED = 10;
 
     /**
-     * fter the Workflow has been started (or re-started) using the
-     * {@link org.apache.wiki.workflow.Workflow#start()} method, 
+     * After the Workflow has been started (or re-started) using the
+     * {@link org.apache.wiki.workflow.Workflow#start()} method,
      * but before it has finished processing all Steps.
      */
     public static final int RUNNING = 20;
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java 
b/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java
index 4780b90..1e91e7b 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java
@@ -657,7 +657,7 @@ public class WikiEngine implements Engine {
     }
 
     /**
-     * Returns the {@link org.apache.wiki.workflow.WorkflowManager} associated 
with this WikiEngine. If the WIkiEngine has not been
+     * Returns the {@link org.apache.wiki.workflow.WorkflowManager} associated 
with this WikiEngine. If the WikiEngine has not been
      * initialized, this method will return <code>null</code>.
      *
      * @return the task queue
diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/filters/FilterManager.java 
b/jspwiki-main/src/main/java/org/apache/wiki/filters/FilterManager.java
index 889c2e0..d6be6f1 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/filters/FilterManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/filters/FilterManager.java
@@ -108,7 +108,7 @@ public interface FilterManager extends ModuleManager {
     List< PageFilter > getFilterList();
     
     /**
-     * Notifies PageFilters to clean up their ressources.
+     * Notifies PageFilters to clean up their resources.
      */
     void destroy();
 
diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/workflow/DecisionQueue.java 
b/jspwiki-main/src/main/java/org/apache/wiki/workflow/DecisionQueue.java
index 12cc0c1..37d8925 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/workflow/DecisionQueue.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/workflow/DecisionQueue.java
@@ -36,7 +36,7 @@ public class DecisionQueue implements Serializable {
 
     private static final long serialVersionUID = -7172912793410302533L;
 
-    private LinkedList< Decision > m_queue = new LinkedList<>();
+    private final LinkedList< Decision > m_queue = new LinkedList<>();
 
     private volatile int m_next;
 
@@ -61,9 +61,8 @@ public class DecisionQueue implements Serializable {
      *
      * @return the pending decisions 
      */
-    protected Decision[] decisions()
-    {
-        return m_queue.toArray( new Decision[m_queue.size()] );
+    protected Decision[] decisions() {
+        return m_queue.toArray( new Decision[ m_queue.size() ] );
     }
 
     /**
@@ -71,8 +70,7 @@ public class DecisionQueue implements Serializable {
      *
      * @param decision the decision to remove
      */
-    protected synchronized void remove( final Decision decision )
-    {
+    protected synchronized void remove( final Decision decision ) {
         m_queue.remove( decision );
     }
 
@@ -109,8 +107,7 @@ public class DecisionQueue implements Serializable {
 
     /**
      * Attempts to complete a Decision by calling {@link 
Decision#decide(Outcome)}. This will cause the Step immediately following the
-     * Decision (if any) to start. If the decision completes successfully, 
this method also removes the completed decision from the
-     * queue.
+     * Decision (if any) to start. If the decision completes successfully, 
this method also removes the completed decision from the queue.
      *
      * @param decision the Decision for which the Outcome will be supplied
      * @param outcome the Outcome of the Decision
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/workflow/Outcome.java 
b/jspwiki-main/src/main/java/org/apache/wiki/workflow/Outcome.java
index f39983f..589361b 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/workflow/Outcome.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/workflow/Outcome.java
@@ -21,13 +21,11 @@ package org.apache.wiki.workflow;
 import java.io.Serializable;
 
 /**
- * Resolution of a workflow Step, such as "approve," "deny," "hold," "task
- * error," or other potential resolutions.
+ * Resolution of a workflow Step, such as "approve," "deny," "hold," "task 
error," or other potential resolutions.
  *
  * @since 2.5
  */
-public final class Outcome implements Serializable
-{
+public final class Outcome implements Serializable {
 
     private static final long serialVersionUID = -338361947886288073L;
 
@@ -56,7 +54,7 @@ public final class Outcome implements Serializable
     public static final Outcome DECISION_REASSIGN = new Outcome( 
"outcome.decision.reassign", false );
 
     private static final Outcome[] OUTCOMES = new Outcome[] { STEP_COMPLETE, 
STEP_ABORT, STEP_CONTINUE, DECISION_ACKNOWLEDGE,
-                                                               
DECISION_APPROVE, DECISION_DENY, DECISION_HOLD, DECISION_REASSIGN };
+                                                              
DECISION_APPROVE, DECISION_DENY, DECISION_HOLD, DECISION_REASSIGN };
 
     private final String m_key;
 
@@ -65,16 +63,11 @@ public final class Outcome implements Serializable
     /**
      * Private constructor to prevent direct instantiation.
      *
-     * @param key
-     *            message key for the Outcome
-     * @param completion
-     *            whether this Outcome should be interpreted as the logical
-     *            completion of a Step.
+     * @param key message key for the Outcome
+     * @param completion whether this Outcome should be interpreted as the 
logical completion of a Step.
      */
-    private Outcome( String key, boolean completion )
-    {
-        if ( key == null )
-        {
+    private Outcome( final String key, final boolean completion ) {
+        if ( key == null ) {
             throw new IllegalArgumentException( "Key cannot be null." );
         }
         m_key = key;
@@ -82,72 +75,58 @@ public final class Outcome implements Serializable
     }
 
     /**
-     * Returns <code>true</code> if this Outcome represents a completion
-     * condition for a Step.
+     * Returns <code>true</code> if this Outcome represents a completion 
condition for a Step.
      *
      * @return the result
      */
-    public boolean isCompletion()
-    {
+    public boolean isCompletion() {
         return m_completion;
     }
 
     /**
-     * The i18n key for this outcome, which is prefixed by 
<code>outcome.</code>.
-     * If calling classes wish to return a locale-specific name for this task
-     * (such as "approve this request"), they can use this method to obtain the
-     * correct key suffix.
+     * The i18n key for this outcome, which is prefixed by 
<code>outcome.</code>. If calling classes wish to return a locale-specific
+     * name for this task (such as "approve this request"), they can use this 
method to obtain the correct key suffix.
      *
      * @return the i18n key for this outcome
      */
-    public String getMessageKey()
-    {
+    public String getMessageKey() {
         return m_key;
     }
 
     /**
-     * The hashcode of an Outcome is identical to the hashcode of its message
-     * key, multiplied by 2 if it is a "completion" Outcome.
+     * The hashcode of an Outcome is identical to the hashcode of its message 
key, multiplied by 2 if it is a "completion" Outcome.
+     *
      * @return the hash code
      */
-    public int hashCode()
-    {
+    public int hashCode() {
         return m_key.hashCode() * ( m_completion ? 1 : 2 );
     }
 
     /**
      * Two Outcome objects are equal if their message keys are equal.
+     *
      * @param obj the object to test
      * @return <code>true</code> if logically equal, <code>false</code> if not
      */
-    public boolean equals( Object obj )
-    {
-        if (!(obj instanceof Outcome))
-        {
+    public boolean equals( final Object obj ) {
+        if( !( obj instanceof Outcome ) ) {
             return false;
         }
-        return m_key.equals( ( (Outcome) obj ).getMessageKey() );
+        return m_key.equals( ( ( Outcome )obj ).getMessageKey() );
     }
 
     /**
-     * Returns a named Outcome. If an Outcome matching the supplied key is not
-     * found, this method throws a {@link NoSuchOutcomeException}.
+     * Returns a named Outcome. If an Outcome matching the supplied key is not 
found, this method throws a {@link NoSuchOutcomeException}.
      *
-     * @param key
-     *            the name of the outcome
+     * @param key the name of the outcome
      * @return the Outcome
-     * @throws NoSuchOutcomeException
-     *             if an Outcome matching the key isn't found.
+     * @throws NoSuchOutcomeException if an Outcome matching the key isn't 
found.
      */
-    public static Outcome forName( String key ) throws NoSuchOutcomeException
-    {
-        if ( key != null )
-        {
-            for (int i = 0; i < OUTCOMES.length; i++)
-            {
-                if ( OUTCOMES[i].m_key.equals( key ) )
-                {
-                    return OUTCOMES[i];
+    public static Outcome forName( final String key ) throws 
NoSuchOutcomeException {
+        if( key != null ) {
+            for( final Outcome outcome : OUTCOMES ) {
+                if( outcome.m_key.equals( key ) ) {
+                    return outcome;
                 }
             }
         }
@@ -157,8 +136,7 @@ public final class Outcome implements Serializable
     /**
      * {@inheritDoc}
      */
-    public String toString()
-    {
+    public String toString() {
         return "[Outcome:" + m_key + "]";
     }
 
diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/workflow/SystemPrincipal.java 
b/jspwiki-main/src/main/java/org/apache/wiki/workflow/SystemPrincipal.java
index 2c2893b..192c41b 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/workflow/SystemPrincipal.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/workflow/SystemPrincipal.java
@@ -20,12 +20,12 @@ package org.apache.wiki.workflow;
 
 import java.security.Principal;
 
+
 /**
  * System users asociated with workflow Task steps.
- * 
  */
-public final class SystemPrincipal implements Principal
-{
+public final class SystemPrincipal implements Principal {
+
     /** The JSPWiki system user */
     public static final Principal SYSTEM_USER = new SystemPrincipal( "System 
User" );
 
@@ -33,18 +33,17 @@ public final class SystemPrincipal implements Principal
 
     /**
      * Private constructor to prevent direct instantiation.
+     *
      * @param name the name of the Principal
      */
-    private SystemPrincipal( String name )
-    {
+    private SystemPrincipal( final String name ) {
         m_name = name;
     }
 
     /**
      * {@inheritDoc}
      */
-    public String getName()
-    {
+    public String getName() {
         return m_name;
     }
 
diff --git a/jspwiki-main/src/test/java/org/apache/wiki/TestEngine.java 
b/jspwiki-main/src/test/java/org/apache/wiki/TestEngine.java
index fe13c37..148254a 100644
--- a/jspwiki-main/src/test/java/org/apache/wiki/TestEngine.java
+++ b/jspwiki-main/src/test/java/org/apache/wiki/TestEngine.java
@@ -78,7 +78,7 @@ public class TestEngine extends WikiEngine {
      * Creates WikiSession with the privileges of the administrative user. For 
testing purposes, obviously.
      *
      * @return the wiki session
-     * @throws WikiSecurityException
+     * @throws WikiSecurityException admin login operation had some trouble
      */
     public Session adminSession() throws WikiSecurityException {
         if ( m_adminWikiSession == null ) {
@@ -108,7 +108,7 @@ public class TestEngine extends WikiEngine {
      * Creates WikiSession with the privileges of the Janne. For testing 
purposes, obviously.
      *
      * @return the wiki session
-     * @throws WikiSecurityException
+     * @throws WikiSecurityException janne login operation had some trouble
      */
     public Session janneSession() throws WikiSecurityException {
         if ( m_janneWikiSession == null ) {
@@ -135,6 +135,7 @@ public class TestEngine extends WikiEngine {
      * @param entries additional configuration entries that may overwrite 
default test properties.
      * @return TestEngine using {@link #getTestProperties()} and additional 
configuration.
      */
+    @SafeVarargs
     public static TestEngine build( final Map.Entry< String, String >... 
entries ) {
         final Properties properties = getTestProperties();
         for( final Map.Entry< String, String > entry : entries ) {
@@ -266,7 +267,7 @@ public class TestEngine extends WikiEngine {
         }
     }
 
-    public static final Properties getTestProperties() {
+    public static Properties getTestProperties() {
         if (combinedProperties == null) {
             combinedProperties = 
PropertyReader.getCombinedProperties(PropertyReader.CUSTOM_JSPWIKI_CONFIG);
         }
@@ -277,7 +278,7 @@ public class TestEngine extends WikiEngine {
         return propCopy;
     }
 
-    public static final Properties getTestProperties( final String 
customPropFile) {
+    public static Properties getTestProperties( final String customPropFile) {
         return PropertyReader.getCombinedProperties(customPropFile);
     }
 /*
@@ -393,10 +394,11 @@ public class TestEngine extends WikiEngine {
     }
 
     /**
-     *  Adds an attachment to a page for testing purposes.
-     * @param pageName
-     * @param attachmentName
-     * @param data
+     * Adds an attachment to a page for testing purposes.
+     *
+     * @param pageName page name
+     * @param attachmentName attachment name
+     * @param data attachment data
      */
     public void addAttachment( final String pageName, final String 
attachmentName, final byte[] data ) throws ProviderException, IOException {
         final Attachment att = Wiki.contents().attachment( 
this,pageName,attachmentName );
@@ -404,13 +406,12 @@ public class TestEngine extends WikiEngine {
     }
 
     /**
-     * Convenience method that saves a wiki page by constructing a fake
-     * WikiContext and HttpServletRequest. We always want to do this using a
-     * WikiContext whose subject contains Role.ADMIN.
-     * Note: the WikiPage author will have the default value of "Guest".
-     * @param pageName
-     * @param content
-     * @throws WikiException
+     * Convenience method that saves a wiki page by constructing a fake 
WikiContext and HttpServletRequest. We always want to do this
+     * using a WikiContext whose subject contains Role.ADMIN. Note: the 
WikiPage author will have the default value of "Guest".
+     *
+     * @param pageName page name
+     * @param content page content
+     * @throws WikiException associated login operation or page save had some 
trouble
      */
     public void saveText( final String pageName, final String content ) throws 
WikiException {
         // Build new request and associate our admin session

Reply via email to