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 2022/02/20 21:25:21 UTC

[jspwiki] 02/06: javadoc fixes

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 a91f9cdd8d8d15b6bdf58fe5cce3c2b9a69916ee
Author: Juan Pablo Santos Rodríguez <ju...@gmail.com>
AuthorDate: Sun Feb 20 22:18:08 2022 +0100

    javadoc fixes
---
 .../java/org/apache/wiki/api/core/Command.java     |  8 +++----
 .../java/org/apache/wiki/api/core/Context.java     | 26 +++++++++++-----------
 .../wiki/auth/user/AbstractUserDatabase.java       |  7 +++---
 .../java/org/apache/wiki/ui/AbstractCommand.java   |  2 +-
 4 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/jspwiki-api/src/main/java/org/apache/wiki/api/core/Command.java b/jspwiki-api/src/main/java/org/apache/wiki/api/core/Command.java
index 38b14d3..dfbd0ce 100644
--- a/jspwiki-api/src/main/java/org/apache/wiki/api/core/Command.java
+++ b/jspwiki-api/src/main/java/org/apache/wiki/api/core/Command.java
@@ -27,13 +27,13 @@ import java.security.Permission;
  * <p> Commands come in two flavors: "static" and "targeted." </p>
  * <ul>
  * <li><strong>Static commands</strong> are exactly what they sound like: static. They are <code>final</code>, threadsafe, and immutable.
- * They have no intrinsic idea of the context they are acting in. For example, the static command {@link org.apache.wiki.ui.PageCommand#VIEW} embodies the
+ * They have no intrinsic idea of the context they are acting in. For example, the static command {@code org.apache.wiki.ui.PageCommand#VIEW} embodies the
  * idea of viewing a page &#8212; but exactly <em>which</em> page is left undefined. Static commands exist so that they can be freely
  * shared and passed around without incurring the penalties of object creation. Static commands are a lot like naked request contexts
  * ("edit", "view", etc.) except that they include additional, essential properties such as the associated URL pattern and content JSP.</li>
  * <li><strong>Targeted commands</strong> "decorate" static commands by scoping a static Command at a specific target such as a WikiPage or
  * GroupPrincipal. Targeted commands are created by calling an existing Command's {@link #targetedCommand(Object)} and supplying the target
- * object. Implementing classes generally require a specific target type. For example, the {@link org.apache.wiki.ui.PageCommand} class requires that the
+ * object. Implementing classes generally require a specific target type. For example, the {@code org.apache.wiki.ui.PageCommand} class requires that the
  * target object be of type {@link org.apache.wiki.api.core.Page}.</li>
  * </ul>
  * <p> Concrete implementations of Command include: </p>
@@ -103,9 +103,9 @@ public interface Command {
 
     /**
      * Returns the Permission required to successfully execute this Command. If no Permission is requred, this method returns
-     * <code>null</code>. For example, the static command {@link org.apache.wiki.ui.PageCommand#VIEW} doesn't require a permission because
+     * <code>null</code>. For example, the static command {@code org.apache.wiki.ui.PageCommand#VIEW} doesn't require a permission because
      * it isn't referring to a particular WikiPage. However, if this command targets a WikiPage called <code>Main</code>(via
-     * {@link org.apache.wiki.ui.PageCommand#targetedCommand(Object)}, the resulting Command would require the permission
+     * {@code org.apache.wiki.ui.PageCommand#targetedCommand(Object)}, the resulting Command would require the permission
      * <code>PagePermission "<em>yourWiki</em>:Main", "view"</code>.
      *
      * @return the required permission, or <code>null</code> if not required
diff --git a/jspwiki-api/src/main/java/org/apache/wiki/api/core/Context.java b/jspwiki-api/src/main/java/org/apache/wiki/api/core/Context.java
index f131ac8..6bd0901 100644
--- a/jspwiki-api/src/main/java/org/apache/wiki/api/core/Context.java
+++ b/jspwiki-api/src/main/java/org/apache/wiki/api/core/Context.java
@@ -35,7 +35,7 @@ import java.security.Principal;
  *  object.</p>
  *  <p>Do not cache the WikiPage object that you get from the WikiContext; always use getPage()!</p>
  *
- *  @see org.apache.wiki.plugin.Counter
+ *  @see {@code org.apache.wiki.plugin.Counter}
  */
 public interface Context extends Cloneable, Command {
 
@@ -43,7 +43,7 @@ public interface Context extends Cloneable, Command {
 
     /**
      *  Variable name which tells whether plugins should be executed or not. Value can be either {@code Boolean.TRUE} or
-     *  {@code Boolean.FALSE}. While not set it's value is {@code null}.
+     *  {@code Boolean.FALSE}. While not set its value is {@code null}.
      */
     String VAR_EXECUTE_PLUGINS = "_PluginContent.execute";
 
@@ -75,8 +75,8 @@ public interface Context extends Cloneable, Command {
      *  the Main page.  However, getRealPage() will return "LeftMenu".
      *
      *  @return A reference to the real page.
-     *  @see org.apache.wiki.tags.InsertPageTag
-     *  @see org.apache.wiki.parser.JSPWikiMarkupParser
+     *  @see {@code org.apache.wiki.tags.InsertPageTag}
+     *  @see {@code org.apache.wiki.parser.JSPWikiMarkupParser}
      */
     Page getRealPage();
 
@@ -93,7 +93,7 @@ public interface Context extends Cloneable, Command {
      *  @param wikiPage  The real WikiPage which is being rendered.
      *  @return The previous real page
      *  @since 2.3.14
-     *  @see org.apache.wiki.tags.InsertPageTag
+     *  @see {@code org.apache.wiki.tags.InsertPageTag}
      */
     Page setRealPage( Page wikiPage );
 
@@ -140,7 +140,7 @@ public interface Context extends Cloneable, Command {
 
     /**
      *  This method will safely return any HTTP parameters that might have been defined.  You should use this method instead
-     *  of peeking directly into the result of getHttpRequest(), since this method is smart enough to do all of the right things,
+     *  of peeking directly into the result of getHttpRequest(), since this method is smart enough to do all the right things,
      *  figure out UTF-8 encoded parameters, etc.
      *
      *  @since 2.0.13.
@@ -150,8 +150,8 @@ public interface Context extends Cloneable, Command {
     String getHttpParameter( String paramName );
 
     /**
-     *  If the request did originate from a HTTP request, then the HTTP request can be fetched here.  However, it the request
-     *  did NOT originate from a HTTP request, then this method will return null, and YOU SHOULD CHECK FOR IT!
+     *  If the request did originate from an HTTP request, then the HTTP request can be fetched here.  However, if the request
+     *  did NOT originate from an HTTP request, then this method will return null, and YOU SHOULD CHECK FOR IT!
      *
      *  @return Null, if no HTTP request was done.
      *  @since 2.0.13.
@@ -203,7 +203,7 @@ public interface Context extends Cloneable, Command {
      *  A shortcut to generate a VIEW url.
      *
      *  @param WikiPage The WikiPage to which to link.
-     *  @return An URL to the page.  This honours the current absolute/relative setting.
+     *  @return A URL to the page.  This honours the current absolute/relative setting.
      */
     String getViewURL( String WikiPage );
 
@@ -223,25 +223,25 @@ public interface Context extends Cloneable, Command {
     Command getCommand();
 
     /**
-     *  Creates an URL for the given request context.
+     *  Creates a URL for the given request context.
      *
      *  @param context e.g. WikiContext.EDIT
      *  @param page The WikiPage to which to link
-     *  @return An URL to the page.
+     *  @return A URL to the page.
      */
     default String getURL( final String context, final String page ) {
         return getURL( context, page, null );
     }
 
     /**
-     *  Returns an URL from a page. It this Context instance was constructed with an actual HttpServletRequest, we will attempt to
+     *  Returns a URL from a page. It this Context instance was constructed with an actual HttpServletRequest, we will attempt to
      *  construct the URL using HttpUtil, which preserves the HTTPS portion if it was used.
      *
      *  @param context The request context (e.g. WikiContext.UPLOAD)
      *  @param page The WikiPage to which to link
      *  @param params A list of parameters, separated with "&amp;"
      *
-     *  @return An URL to the given context and page.
+     *  @return A URL to the given context and page.
      */
     default String getURL( final String context, final String page, final String params ) {
         // FIXME: is rather slow
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/user/AbstractUserDatabase.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/user/AbstractUserDatabase.java
index 028f477..7a8d36f 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/user/AbstractUserDatabase.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/user/AbstractUserDatabase.java
@@ -189,7 +189,7 @@ public abstract class AbstractUserDatabase implements UserDatabase {
      */
     @Override
     public boolean validatePassword( final String loginName, final String password ) {
-        String hashedPassword;
+        final String hashedPassword;
         try {
             final UserProfile profile = findByLoginName( loginName );
             String storedPassword = profile.getPassword();
@@ -252,14 +252,13 @@ public abstract class AbstractUserDatabase implements UserDatabase {
      * calculates a <em>salted</em> hash rather than a plain hash.
      *
      * @param text the text to hash
-     * @param text the algorithm used for the hash
      * @return the result hash
      */
     protected String getHash( final String text ) {
         try {
             return CryptoUtil.getSaltedPassword( text.getBytes(StandardCharsets.UTF_8), SHA256_PREFIX );
         } catch( final NoSuchAlgorithmException e ) {
-            log.error( String.format( "Error creating salted password hash: %s", e.getMessage() ) );
+            log.error( "Error creating salted password hash: {}", e.getMessage() );
             return text;
         }
     }
@@ -269,7 +268,7 @@ public abstract class AbstractUserDatabase implements UserDatabase {
      *
      * @param text the text to hash
      * @return the result hash
-     * @deprecated this method is retained for backwards compatibility purposes; use {@link #getHash(String, String)} instead
+     * @deprecated this method is retained for backwards compatibility purposes; use {@link #getHash(String)} instead
      */
     @Deprecated
     String getShaHash(final String text ) {
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/ui/AbstractCommand.java b/jspwiki-main/src/main/java/org/apache/wiki/ui/AbstractCommand.java
index fc09d5e..869de6b 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/ui/AbstractCommand.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/ui/AbstractCommand.java
@@ -42,7 +42,7 @@ public abstract class AbstractCommand implements Command {
     /**
      * Constructs a new Command with a specified wiki context, URL pattern, content template and target. The URL pattern is used to derive
      * the JSP; if it is a "local" JSP (that is, it does not contain the <code>http://</code> or <code>https://</code> prefixes),
-     * then the JSP will be a cleansed version of the URL pattern; symbols (such as <code>%u</code>) will removed. If it the supplied
+     * then the JSP will be a cleansed version of the URL pattern; symbols (such as <code>%u</code>) will be removed. If the supplied
      * URL pattern points to a non-local destination, the JSP will be set to the value supplied, unmodified.
      *
      * @param requestContext the request context