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/11/29 21:54:26 UTC

[jspwiki] branch master updated (58d0820 -> 7263dc1)

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 58d0820  2.11.0-M8-git-04
     new 443febd  update selenide to 5.16.2
     new 6b0a6b1  update tomcat to 9.0.40
     new f06ece9  update LICENSE
     new 14703a5  minor edits
     new a1c197c  apply fixes suggested by intellij
     new 176b6df  extract hidden inputs expected by SpamFilter into its own custom tag, and refactor editors-related JSPs to use it
     new 0f92ee6  use ConcurrentHashMap instead of plain HashMap to avoid possible thread safety issues
     new 9ae2f9f  ensure IndexPlugin works with non-blank page references
     new 363f594  JSPWIKI-1134: improve german translation
     new 080085f  minor edit
     new 7263dc1  2.11.0-M8-git-05

The 11 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:
 ChangeLog.md                                       |  17 +++
 LICENSE                                            |   4 +-
 UPGRADING                                          |   2 +-
 .../src/main/java/org/apache/wiki/api/Release.java |   2 +-
 .../java/org/apache/wiki/filters/SpamFilter.java   | 121 ++++++++++-----------
 .../java/org/apache/wiki/plugin/IndexPlugin.java   |   5 +-
 .../wiki/references/DefaultReferenceManager.java   |  49 ++++-----
 .../org/apache/wiki/tags/SpamFilterInputsTag.java  |  53 +++++++++
 .../src/main/resources/META-INF/jspwiki.tld        |   7 ++
 .../main/resources/templates/default_de.properties |  39 ++++---
 .../tomcat/woas.app/Contents/Java/bootstrap.jar    | Bin 35909 -> 35909 bytes
 .../tomcat/woas.app/Contents/Java/tomcat-juli.jar  | Bin 49769 -> 49777 bytes
 .../src/overlay/launchers/tomcat/woas.exe          | Bin 3612748 -> 3630174 bytes
 .../main/webapp/templates/210/editors/CKeditor.jsp |   6 +-
 .../src/main/webapp/templates/210/editors/FCK.jsp  |   2 +-
 .../main/webapp/templates/210/editors/TinyMCE.jsp  |  10 +-
 .../main/webapp/templates/210/editors/plain.jsp    |   3 +-
 .../main/webapp/templates/210/editors/preview.jsp  |   2 +-
 .../main/webapp/templates/210/editors/wysiwyg.jsp  |   3 +-
 .../webapp/templates/default/editors/CKeditor.jsp  |   7 +-
 .../webapp/templates/default/editors/TinyMCE.jsp   |   7 +-
 .../webapp/templates/default/editors/plain.jsp     |   6 +-
 .../webapp/templates/default/editors/preview.jsp   |   2 +-
 .../webapp/templates/default/editors/wysiwyg.jsp   |   7 +-
 mvn_cheat-sheet.md                                 |   7 +-
 pom.xml                                            |   4 +-
 26 files changed, 201 insertions(+), 164 deletions(-)
 create mode 100644 jspwiki-main/src/main/java/org/apache/wiki/tags/SpamFilterInputsTag.java


[jspwiki] 07/11: use ConcurrentHashMap instead of plain HashMap to avoid possible thread safety issues

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 0f92ee6ae8c8f360cee17f66815f4e08185ab4a4
Author: juanpablo <ju...@apache.org>
AuthorDate: Sun Nov 29 22:37:19 2020 +0100

    use ConcurrentHashMap instead of plain HashMap to avoid possible thread safety issues
---
 .../wiki/references/DefaultReferenceManager.java   | 49 +++++++++-------------
 1 file changed, 20 insertions(+), 29 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/references/DefaultReferenceManager.java b/jspwiki-main/src/main/java/org/apache/wiki/references/DefaultReferenceManager.java
index 7495ab2..64efeae 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/references/DefaultReferenceManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/references/DefaultReferenceManager.java
@@ -39,28 +39,12 @@ import org.apache.wiki.pages.PageManager;
 import org.apache.wiki.render.RenderingManager;
 import org.apache.wiki.util.TextUtil;
 
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
+import java.io.*;
 import java.nio.charset.StandardCharsets;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.ConcurrentModificationException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
 
 /*
   BUGS
@@ -151,8 +135,8 @@ public class DefaultReferenceManager extends BasePageFilter implements Reference
      *  @param engine The Engine to which this is managing references to.
      */
     public DefaultReferenceManager( final Engine engine ) {
-        m_refersTo = new HashMap<>();
-        m_referredBy = new HashMap<>();
+        m_refersTo = new ConcurrentHashMap<>();
+        m_referredBy = new ConcurrentHashMap<>();
         m_engine = engine;
         m_matchEnglishPlurals = TextUtil.getBooleanProperty( engine.getWikiProperties(), Engine.PROP_MATCHPLURALS, false );
 
@@ -639,7 +623,7 @@ public class DefaultReferenceManager extends BasePageFilter implements Reference
                 // We add a non-null entry to referredBy to indicate the referred page exists
                 m_referredBy.put( page.getName(), new TreeSet<>() );
                 // Just add a key to refersTo; the keys need to be in sync with referredBy.
-                m_refersTo.put( page.getName(), null );
+                m_refersTo.put( page.getName(), new TreeSet<>() );
             }
         } catch( final ClassCastException e ) {
             log.fatal( "Invalid collection entry in ReferenceManager.buildKeyLists().", e );
@@ -682,7 +666,8 @@ public class DefaultReferenceManager extends BasePageFilter implements Reference
      *
      * @param pagename  Name of the page to clear references for.
      */
-    @Override public synchronized void clearPageEntries( String pagename ) {
+    @Override
+    public synchronized void clearPageEntries( String pagename ) {
         pagename = getFinalPageName( pagename );
 
         //  Remove this item from the referredBy list of any page which this item refers to.
@@ -705,7 +690,8 @@ public class DefaultReferenceManager extends BasePageFilter implements Reference
      *
      *  @return The Collection of Strings
      */
-    @Override public synchronized Collection< String > findUnreferenced() {
+    @Override
+    public synchronized Collection< String > findUnreferenced() {
         final ArrayList< String > unref = new ArrayList<>();
         for( final String key : m_referredBy.keySet() ) {
             final Set< ? > refs = getReferenceList( m_referredBy, key );
@@ -727,7 +713,8 @@ public class DefaultReferenceManager extends BasePageFilter implements Reference
      *
      * @return A Collection of Strings
      */
-    @Override public synchronized Collection< String > findUncreated() {
+    @Override
+    public synchronized Collection< String > findUncreated() {
         final TreeSet< String > uncreated = new TreeSet<>();
 
         // Go through m_refersTo values and check that m_refersTo has the corresponding keys.
@@ -785,7 +772,8 @@ public class DefaultReferenceManager extends BasePageFilter implements Reference
      * @param pagename The page to find referrers for.
      * @return A Set of Strings.  May return null, if the page does not exist, or if it has no references.
      */
-    @Override public synchronized Set< String > findReferrers( final String pagename ) {
+    @Override
+    public synchronized Set< String > findReferrers( final String pagename ) {
         final Set< String > refs = getReferenceList( m_referredBy, pagename );
         if( refs == null || refs.isEmpty() ) {
             return null;
@@ -807,7 +795,8 @@ public class DefaultReferenceManager extends BasePageFilter implements Reference
      *         not exist or has not been indexed yet.
      * @since 2.2.33
      */
-    @Override public Set< String > findReferredBy( final String pageName ) {
+    @Override
+    public Set< String > findReferredBy( final String pageName ) {
         return m_unmutableReferredBy.get( getFinalPageName(pageName) );
     }
 
@@ -825,7 +814,8 @@ public class DefaultReferenceManager extends BasePageFilter implements Reference
      *         does not exist or has not been indexed yet.
      * @since 2.2.33
      */
-    @Override public Collection< String > findRefersTo( final String pageName ) {
+    @Override
+    public Collection< String > findRefersTo( final String pageName ) {
         return m_unmutableRefersTo.get( getFinalPageName( pageName ) );
     }
 
@@ -868,7 +858,8 @@ public class DefaultReferenceManager extends BasePageFilter implements Reference
      *  @return A Set of all defined page names that ReferenceManager knows about.
      *  @since 2.3.24
      */
-    @Override public Set< String > findCreated() {
+    @Override
+    public Set< String > findCreated() {
         return new HashSet<>( m_refersTo.keySet() );
     }
 


[jspwiki] 10/11: minor edit

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 080085f8c7c3503188bb9803a1e74dd80dcd6cbe
Author: juanpablo <ju...@apache.org>
AuthorDate: Sun Nov 29 22:53:23 2020 +0100

    minor edit
---
 mvn_cheat-sheet.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mvn_cheat-sheet.md b/mvn_cheat-sheet.md
index f41eba8..2c95f42 100644
--- a/mvn_cheat-sheet.md
+++ b/mvn_cheat-sheet.md
@@ -52,5 +52,5 @@ under the License.
 | mvn cobertura:cobertura                                           | generates a cobertura maven report. See: http://mojo.codehaus.org/cobertura-maven-plugin/usage.html                       |
 | mvn javadoc:javadoc                                               | creates javadocs; if graphviz binaries (www.graphviz.org) are found on $PATH, the javadocs will display                   |
 |                                                                   | some UML class/package level diagrams                                                                                     |
-| mvn javadoc:javadoc -Djdk.javadoc.doclet.version=2.0.8            | same as above, but with JDK >= 9                                                                                          |
+| mvn javadoc:javadoc -Djdk.javadoc.doclet.version=2.0.12           | same as above, but with JDK >= 9                                                                                          |
 | mvn sonar:sonar                                                   | generates a Sonar report. Expects a Sonar server running at http://localhost:9000/                                        |


[jspwiki] 11/11: 2.11.0-M8-git-05

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 7263dc180c418f2a3507704076f6a6799a96f98f
Author: juanpablo <ju...@apache.org>
AuthorDate: Sun Nov 29 22:53:58 2020 +0100

    2.11.0-M8-git-05
---
 ChangeLog.md                                            | 17 +++++++++++++++++
 .../src/main/java/org/apache/wiki/api/Release.java      |  2 +-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index 53d5006..391f59b 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -17,6 +17,23 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+**2020-11-29  Juan Pablo Santos (juanpablo AT apache DOT org)**
+
+* _2.11.0-M8-git-05_
+
+* [JSPWIKI-1134](https://issues.apache.org/jira/browse/JSPWIKI-1134): german translation improved
+    * Patch provided by Dietrich Schmidt - thanks!
+
+* Extracted hidden input fields expected by the SpamFilter into its own custom tag and applied it to editor-related JSPs.
+
+* Ensure IndexPlugin works with non-blank page references.
+
+* Use ConcurrentHashMap inside DefaultReferenceManager, to avoid possible thread safety issues.
+
+* Dependency updates
+    * Selenide 5.16.2
+    * Tomcat to 9.0.40
+
 **2020-11-10  Juan Pablo Santos (juanpablo AT apache DOT org)**
 
 * _2.11.0-M8-git-04_
diff --git a/jspwiki-api/src/main/java/org/apache/wiki/api/Release.java b/jspwiki-api/src/main/java/org/apache/wiki/api/Release.java
index 9967d16..42535b8 100644
--- a/jspwiki-api/src/main/java/org/apache/wiki/api/Release.java
+++ b/jspwiki-api/src/main/java/org/apache/wiki/api/Release.java
@@ -69,7 +69,7 @@ public final class Release {
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "git-04";
+    public static final String     BUILD         = "git-05";
 
     /**
      *  This is the generic version string you should use when printing out the version.  It is of


[jspwiki] 02/11: update tomcat to 9.0.40

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 6b0a6b1e85d53e2ad6106b4e9680b609bcb64069
Author: juanpablo <ju...@apache.org>
AuthorDate: Sun Nov 29 14:26:52 2020 +0100

    update tomcat to 9.0.40
---
 .../tomcat/woas.app/Contents/Java/bootstrap.jar    | Bin 35909 -> 35909 bytes
 .../tomcat/woas.app/Contents/Java/tomcat-juli.jar  | Bin 49769 -> 49777 bytes
 .../src/overlay/launchers/tomcat/woas.exe          | Bin 3612748 -> 3630174 bytes
 pom.xml                                            |   2 +-
 4 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/jspwiki-portable/src/overlay/launchers/tomcat/woas.app/Contents/Java/bootstrap.jar b/jspwiki-portable/src/overlay/launchers/tomcat/woas.app/Contents/Java/bootstrap.jar
index 7611a33..4536d3e 100644
Binary files a/jspwiki-portable/src/overlay/launchers/tomcat/woas.app/Contents/Java/bootstrap.jar and b/jspwiki-portable/src/overlay/launchers/tomcat/woas.app/Contents/Java/bootstrap.jar differ
diff --git a/jspwiki-portable/src/overlay/launchers/tomcat/woas.app/Contents/Java/tomcat-juli.jar b/jspwiki-portable/src/overlay/launchers/tomcat/woas.app/Contents/Java/tomcat-juli.jar
index b81c023..3f35d8f 100644
Binary files a/jspwiki-portable/src/overlay/launchers/tomcat/woas.app/Contents/Java/tomcat-juli.jar and b/jspwiki-portable/src/overlay/launchers/tomcat/woas.app/Contents/Java/tomcat-juli.jar differ
diff --git a/jspwiki-portable/src/overlay/launchers/tomcat/woas.exe b/jspwiki-portable/src/overlay/launchers/tomcat/woas.exe
index 0b39a24..32a8fcf 100644
Binary files a/jspwiki-portable/src/overlay/launchers/tomcat/woas.exe and b/jspwiki-portable/src/overlay/launchers/tomcat/woas.exe differ
diff --git a/pom.xml b/pom.xml
index 719e5ec..d88054a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,7 +76,7 @@
     <slf4j.version>1.7.30</slf4j.version>
     <stripes.version>1.7.0-async-beta</stripes.version>
     <tika.version>1.24.1</tika.version>
-    <tomcat.version>9.0.39</tomcat.version>
+    <tomcat.version>9.0.40</tomcat.version>
     <wro4j.version>1.8.0</wro4j.version>
     <xmlrpc.version>2.0.1</xmlrpc.version>
 


[jspwiki] 04/11: minor edits

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 14703a5cfa871ef36da19967624f7a71fde95acd
Author: juanpablo <ju...@apache.org>
AuthorDate: Sun Nov 29 14:27:45 2020 +0100

    minor edits
---
 UPGRADING          | 2 +-
 mvn_cheat-sheet.md | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/UPGRADING b/UPGRADING
index 3a9e3bf..590e5c0 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -1,5 +1,5 @@
 
-Apache JSPWiki 2.11.0-incubating - Upgrading Notes
+Apache JSPWiki 2.11.0 - Upgrading Notes
 ==================================================
 
     Licensed to the Apache Software Foundation (ASF) under one
diff --git a/mvn_cheat-sheet.md b/mvn_cheat-sheet.md
index 19404e6..f41eba8 100644
--- a/mvn_cheat-sheet.md
+++ b/mvn_cheat-sheet.md
@@ -35,14 +35,13 @@ under the License.
 | mvn test -Dtest=JSPWikiMarkupParserTest                           | run just a single test class                                                                                              |
 | mvn test -Dtest=JSPWikiMarkupParserTest#testHeadingHyperlinks3    | run just a single test within a test class                                                                                |
 | mvn test -Dtest=TestClassName#methodName -Dmaven.surefire.debug   | debug a test in Eclipse or IDEA to see why it's failing (see http://www.jroller.com/gmazza/entry/jpa_and_junit#debugging) |
-| mvn org.codehaus.cargo:cargo-maven2-plugin:run                    | (from main war module) starts JSPWiki on a Tomcat9 instance at http://localhost:8080/JSPWiki with an attached debugger    |
-|                                                                   | on port 5005                                                                                                              |
+| mvn org.codehaus.cargo:cargo-maven2-plugin:run                    | (from main war module) starts JSPWiki on a Tomcat9 instance at http://localhost:8080/JSPWiki with an attached debugger on port 5005|
 | mvn clean deploy -Papache-release -Dgpg.passphrase=<passphrase>   | deploys generated artifact to a repository. If -Dgpg.passphrase is not given, expects a gpg-agent running                 |
 | mvn clean install -Pintegration-tests                             | performs a build, enabling functional tests execution (best run from the jspwiki-it-tests folder)                         |
 | mvn wro4j:run -Dminimize=true                                     | merge & compress js & css files                                                                                           |
 | mvn wro4j:run -Dminimize=false                                    | only merge the js & css files  (no compression)                                                                           |
 | mvn clean install -Dmaven.test.skip -Dminimize=false              | performs a build, skipping the tests and skip compression                                                                 |
-| mvn clean install -Dgenerate-native-launchers=true                | performs a build, regenerating the native executables on the portable build                                               |
+| mvn clean install -Dgenerate-native-launchers=true                | (from portable module) performs a build, regenerating the native executables on the portable build                                               |
 
 
 # 3. Reports Specific


[jspwiki] 01/11: update selenide to 5.16.2

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 443febd33207ab82b8223127e68ddd22cf5987c6
Author: juanpablo <ju...@apache.org>
AuthorDate: Sun Nov 29 14:26:03 2020 +0100

    update selenide to 5.16.2
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 9b02336..719e5ec 100644
--- a/pom.xml
+++ b/pom.xml
@@ -72,7 +72,7 @@
     <nekohtml.version>1.9.22</nekohtml.version>
     <oro.version>2.0.8</oro.version>
     <sandler.version>0.5</sandler.version>
-    <selenide.version>5.15.1</selenide.version>
+    <selenide.version>5.16.2</selenide.version>
     <slf4j.version>1.7.30</slf4j.version>
     <stripes.version>1.7.0-async-beta</stripes.version>
     <tika.version>1.24.1</tika.version>


[jspwiki] 03/11: update LICENSE

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 f06ece9e7a9d6c517425caf67aadf54ebe2f16d1
Author: juanpablo <ju...@apache.org>
AuthorDate: Sun Nov 29 14:27:12 2020 +0100

    update LICENSE
---
 LICENSE | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/LICENSE b/LICENSE
index 395ef5b..f17a0c5 100644
--- a/LICENSE
+++ b/LICENSE
@@ -260,7 +260,7 @@ sqltool-2.5.1.jar                           ./jspwiki-war/src/main/config/doc/LI
 jetty-all-8.1.15.v20140411.jar              LICENSE
 junit-5.7.0                                 ./jspwiki-war/src/main/config/doc/LICENSE.cpl
 mockito-core-3.6.0                          ./jspwiki-war/src/main/config/doc/LICENSE.mit
-selenide-5.15.1.jar                         ./jspwiki-war/src/main/config/doc/LICENSE.mit
+selenide-5.16.2.jar                         ./jspwiki-war/src/main/config/doc/LICENSE.mit
 stripes-1.7.0-async.jar                     LICENSE
 yuicompressor-2.4.7.jar                     ./jspwiki-war/src/main/config/doc/LICENSE.yui
 
@@ -276,7 +276,7 @@ SlimBox                                     ./jspwiki-war/src/main/config/doc/LI
 
 RESOURCES                                   LICENSE FILE
 =============================================================================================================
-Apache Tomcat 9.0.39                        LICENSE
+Apache Tomcat 9.0.40                        LICENSE
 Font Awesome (CSS & LESS files)             ./jspwiki-war/src/main/config/doc/LICENSE.mit
 Font Awesome (Fonts)                        ./jspwiki-war/src/main/config/doc/LICENSE.ofl
 SilkIconSet                                 ./jspwiki-war/src/main/config/doc/LICENSE.SilkIconSet


[jspwiki] 06/11: extract hidden inputs expected by SpamFilter into its own custom tag, and refactor editors-related JSPs to use it

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 176b6df82b1ff50dd0e51a4fb3b9cd59001a1bcb
Author: juanpablo <ju...@apache.org>
AuthorDate: Sun Nov 29 22:34:44 2020 +0100

    extract hidden inputs expected by SpamFilter into its own custom tag, and refactor editors-related JSPs to use it
---
 .../org/apache/wiki/tags/SpamFilterInputsTag.java  | 53 ++++++++++++++++++++++
 .../src/main/resources/META-INF/jspwiki.tld        |  7 +++
 .../main/webapp/templates/210/editors/CKeditor.jsp |  6 +--
 .../src/main/webapp/templates/210/editors/FCK.jsp  |  2 +-
 .../main/webapp/templates/210/editors/TinyMCE.jsp  | 10 ++--
 .../main/webapp/templates/210/editors/plain.jsp    |  3 +-
 .../main/webapp/templates/210/editors/preview.jsp  |  2 +-
 .../main/webapp/templates/210/editors/wysiwyg.jsp  |  3 +-
 .../webapp/templates/default/editors/CKeditor.jsp  |  7 +--
 .../webapp/templates/default/editors/TinyMCE.jsp   |  7 +--
 .../webapp/templates/default/editors/plain.jsp     |  6 +--
 .../webapp/templates/default/editors/preview.jsp   |  2 +-
 .../webapp/templates/default/editors/wysiwyg.jsp   |  7 +--
 13 files changed, 73 insertions(+), 42 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/SpamFilterInputsTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/SpamFilterInputsTag.java
new file mode 100644
index 0000000..0219d49
--- /dev/null
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/SpamFilterInputsTag.java
@@ -0,0 +1,53 @@
+/*
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+ */
+
+package org.apache.wiki.tags;
+
+
+import org.apache.wiki.filters.SpamFilter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.jsp.PageContext;
+
+/**
+ * Provides hidden input fields which are checked by the {@code SpamFilter}.
+ *
+ * @since 2.11.0-M8
+ */
+public class SpamFilterInputsTag extends WikiTagBase {
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int doWikiStartTag() throws Exception {
+        final String encodingCheckInput = SpamFilter.insertInputFields( pageContext );
+        final String hashCheckInput =
+            "<input type='hidden' name='" + SpamFilter.getHashFieldName( ( HttpServletRequest ) pageContext.getRequest() ) + "'" +
+            " value='" + pageContext.getAttribute( "lastchange", PageContext.REQUEST_SCOPE ) + "' />\n";
+
+        // This following field is only for the SpamFilter to catch bots which are just randomly filling all fields and submitting.
+        // Normal user should never see this field, nor type anything in it.
+        final String botCheckInput =
+            "<input class='hidden' type='text' name='" + SpamFilter.getBotFieldName() + "' id='" + SpamFilter.getBotFieldName() + "' value='' />\n";
+        pageContext.getOut().print( encodingCheckInput + hashCheckInput + botCheckInput );
+        return SKIP_BODY;
+    }
+
+}
diff --git a/jspwiki-main/src/main/resources/META-INF/jspwiki.tld b/jspwiki-main/src/main/resources/META-INF/jspwiki.tld
index c33e038..64d72b5 100644
--- a/jspwiki-main/src/main/resources/META-INF/jspwiki.tld
+++ b/jspwiki-main/src/main/resources/META-INF/jspwiki.tld
@@ -708,6 +708,13 @@
   </tag>
 
   <tag>
+      <description>Includes input fields used by the Spam Filter</description>
+      <name>SpamFilterInputs</name>
+      <tag-class>org.apache.wiki.tags.SpamFilterInputsTag</tag-class>
+      <body-content>empty</body-content>
+  </tag>
+
+  <tag>
     <description>A BodyTag for tabbed sections</description>
     <name>TabbedSection</name>
     <tag-class>org.apache.wiki.tags.TabbedSectionTag</tag-class>
diff --git a/jspwiki-war/src/main/webapp/templates/210/editors/CKeditor.jsp b/jspwiki-war/src/main/webapp/templates/210/editors/CKeditor.jsp
index b113830..aa4864f 100644
--- a/jspwiki-war/src/main/webapp/templates/210/editors/CKeditor.jsp
+++ b/jspwiki-war/src/main/webapp/templates/210/editors/CKeditor.jsp
@@ -133,11 +133,7 @@
     <%-- Edit.jsp relies on these being found.  So be careful, if you make changes. --%>
   <input type="hidden" name="page" value="<wiki:Variable var='pagename' />" />
   <input type="hidden" name="action" value="save" />
-  <%=SpamFilter.insertInputFields( pageContext )%>
-  <input type="hidden" name="<%=SpamFilter.getHashFieldName(request)%>" value="${lastchange}" />
-  <%-- This following field is only for the SpamFilter to catch bots which are just randomly filling all fields and submitting.
-       Normal user should never see this field, nor type anything in it. --%>
-  <div style="display:none;">Authentication code: <input type="text" name="<%=SpamFilter.getBotFieldName()%>" id="<%=SpamFilter.getBotFieldName()%>" value="" /></div>
+  <wiki:SpamFilterInputs/>
 
     <p>
       <input name='ok' type='submit' value='<fmt:message key="editor.plain.save.submit"/>' />
diff --git a/jspwiki-war/src/main/webapp/templates/210/editors/FCK.jsp b/jspwiki-war/src/main/webapp/templates/210/editors/FCK.jsp
index 7735d36..792fcb4 100644
--- a/jspwiki-war/src/main/webapp/templates/210/editors/FCK.jsp
+++ b/jspwiki-war/src/main/webapp/templates/210/editors/FCK.jsp
@@ -107,7 +107,7 @@
         <%-- Edit.jsp relies on these being found.  So be careful, if you make changes. --%>
         <input name="page" type="hidden" value="<wiki:Variable var="pagename"/>" />
         <input name="action" type="hidden" value="save" />
-        <input name="<%=SpamFilter.getHashFieldName(request)%>" type="hidden" value="<c:out value='${lastchange}' />" />
+        <wiki:SpamFilterInputs/>
     </p>
 <div style="width:100%"> <%-- Required for IE6 on Windows --%>
 <script type="text/javascript">
diff --git a/jspwiki-war/src/main/webapp/templates/210/editors/TinyMCE.jsp b/jspwiki-war/src/main/webapp/templates/210/editors/TinyMCE.jsp
index 3fbaafb..8e0021c 100644
--- a/jspwiki-war/src/main/webapp/templates/210/editors/TinyMCE.jsp
+++ b/jspwiki-war/src/main/webapp/templates/210/editors/TinyMCE.jsp
@@ -127,13 +127,9 @@
      enctype="application/x-www-form-urlencoded" >
 
     <%-- Edit.jsp relies on these being found.  So be careful, if you make changes. --%>
-  <input type="hidden" name="page" value="<wiki:Variable var='pagename' />" />
-  <input type="hidden" name="action" value="save" />
-  <%=SpamFilter.insertInputFields( pageContext )%>
-  <input type="hidden" name="<%=SpamFilter.getHashFieldName(request)%>" value="${lastchange}" />
-  <%-- This following field is only for the SpamFilter to catch bots which are just randomly filling all fields and submitting.
-       Normal user should never see this field, nor type anything in it. --%>
-  <div style="display:none;">Authentication code: <input type="text" name="<%=SpamFilter.getBotFieldName()%>" id="<%=SpamFilter.getBotFieldName()%>" value="" /></div>
+    <input type="hidden" name="page" value="<wiki:Variable var='pagename' />" />
+    <input type="hidden" name="action" value="save" />
+    <wiki:SpamFilterInputs/>
 
     <p>
       <input name='ok' type='submit' value='<fmt:message key="editor.plain.save.submit"/>' />
diff --git a/jspwiki-war/src/main/webapp/templates/210/editors/plain.jsp b/jspwiki-war/src/main/webapp/templates/210/editors/plain.jsp
index e725ef5..4f36913 100644
--- a/jspwiki-war/src/main/webapp/templates/210/editors/plain.jsp
+++ b/jspwiki-war/src/main/webapp/templates/210/editors/plain.jsp
@@ -92,8 +92,7 @@
   <p id="submitbuttons">
   <input name="page" type="hidden" value="<wiki:Variable var='pagename' />" />
   <input name="action" type="hidden" value="save" />
-  <%=SpamFilter.insertInputFields( pageContext )%>
-  <input name="<%=SpamFilter.getHashFieldName(request)%>" type="hidden" value="<c:out value='${lastchange}' />" />
+  <wiki:SpamFilterInputs/>
   <input type="submit" name="ok" value="<fmt:message key='editor.plain.save.submit'/>"
     accesskey="s"
         title="<fmt:message key='editor.plain.save.title'/>" />
diff --git a/jspwiki-war/src/main/webapp/templates/210/editors/preview.jsp b/jspwiki-war/src/main/webapp/templates/210/editors/preview.jsp
index 13bdac0..1c0036b 100644
--- a/jspwiki-war/src/main/webapp/templates/210/editors/preview.jsp
+++ b/jspwiki-war/src/main/webapp/templates/210/editors/preview.jsp
@@ -55,7 +55,7 @@
 
     <input type="hidden" name="page" value="<wiki:Variable var='pagename' />" />
     <input type="hidden" name="action" value="save" />
-    <input name="<%=SpamFilter.getHashFieldName(request)%>" type="hidden" value="${lastchange}" />
+    <wiki:SpamFilterInputs/>
   </p>
   <div>
   <textarea style="display:none;" readonly="readonly"
diff --git a/jspwiki-war/src/main/webapp/templates/210/editors/wysiwyg.jsp b/jspwiki-war/src/main/webapp/templates/210/editors/wysiwyg.jsp
index acc4fb0..67b304c 100644
--- a/jspwiki-war/src/main/webapp/templates/210/editors/wysiwyg.jsp
+++ b/jspwiki-war/src/main/webapp/templates/210/editors/wysiwyg.jsp
@@ -97,8 +97,7 @@ Falling back to the plain editor.
   <p id="submitbuttons">
   <input name="page" type="hidden" value="<wiki:Variable var='pagename' />" />
   <input name="action" type="hidden" value="save" />
-  <%=SpamFilter.insertInputFields( pageContext )%>
-  <input name="<%=SpamFilter.getHashFieldName(request)%>" type="hidden" value="<c:out value='${lastchange}' />" />
+  <wiki:SpamFilterInputs/>
   <input type="submit" name="ok" value="<fmt:message key='editor.plain.save.submit'/>"
     accesskey="s"
         title="<fmt:message key='editor.plain.save.title'/>" />
diff --git a/jspwiki-war/src/main/webapp/templates/default/editors/CKeditor.jsp b/jspwiki-war/src/main/webapp/templates/default/editors/CKeditor.jsp
index fb70ec0..b57635e 100644
--- a/jspwiki-war/src/main/webapp/templates/default/editors/CKeditor.jsp
+++ b/jspwiki-war/src/main/webapp/templates/default/editors/CKeditor.jsp
@@ -137,12 +137,7 @@
   <%-- Edit.jsp relies on these being found.  So be careful, if you make changes. --%>
   <input type="hidden" name="page" value="<wiki:Variable var='pagename' />" />
   <input type="hidden" name="action" value="save" />
-  <%=SpamFilter.insertInputFields( pageContext )%>
-  <input type="hidden" name="<%=SpamFilter.getHashFieldName(request)%>" value="${lastchange}" />
-  <%-- This following field is only for the SpamFilter to catch bots which are just randomly filling all fields and submitting.
-       Normal user should never see this field, nor type anything in it. --%>
-  <input class="hidden" type="text" name="<%=SpamFilter.getBotFieldName()%>" id="<%=SpamFilter.getBotFieldName()%>" value="" />
-
+  <wiki:SpamFilterInputs/>
 
   <div class="form-inline form-group">
 
diff --git a/jspwiki-war/src/main/webapp/templates/default/editors/TinyMCE.jsp b/jspwiki-war/src/main/webapp/templates/default/editors/TinyMCE.jsp
index 2e90595..963f81f 100644
--- a/jspwiki-war/src/main/webapp/templates/default/editors/TinyMCE.jsp
+++ b/jspwiki-war/src/main/webapp/templates/default/editors/TinyMCE.jsp
@@ -139,12 +139,7 @@
   <%-- Edit.jsp relies on these being found.  So be careful, if you make changes. --%>
   <input type="hidden" name="page" value="<wiki:Variable var='pagename' />" />
   <input type="hidden" name="action" value="save" />
-  <%=SpamFilter.insertInputFields( pageContext )%>
-  <input type="hidden" name="<%=SpamFilter.getHashFieldName(request)%>" value="${lastchange}" />
-  <%-- This following field is only for the SpamFilter to catch bots which are just randomly filling all fields and submitting.
-       Normal user should never see this field, nor type anything in it. --%>
-  <input class="hidden" type="text" name="<%=SpamFilter.getBotFieldName()%>" id="<%=SpamFilter.getBotFieldName()%>" value="" />
-
+  <wiki:SpamFilterInputs/>
 
   <div class="form-inline form-group">
 
diff --git a/jspwiki-war/src/main/webapp/templates/default/editors/plain.jsp b/jspwiki-war/src/main/webapp/templates/default/editors/plain.jsp
index 6224e62..3409e5d 100644
--- a/jspwiki-war/src/main/webapp/templates/default/editors/plain.jsp
+++ b/jspwiki-war/src/main/webapp/templates/default/editors/plain.jsp
@@ -85,11 +85,7 @@
   <%-- Edit.jsp relies on these being found.  So be careful, if you make changes. --%>
   <input type="hidden" name="page" value="<wiki:Variable var='pagename' />" />
   <input type="hidden" name="action" value="save" />
-  <%=SpamFilter.insertInputFields( pageContext )%>
-  <input type="hidden" name="<%=SpamFilter.getHashFieldName(request)%>" value="${lastchange}" />
-  <%-- This following field is only for the SpamFilter to catch bots which are just randomly filling all fields and submitting.
-       Normal user should never see this field, nor type anything in it. --%>
-  <input class="hidden" type="text" name="<%=SpamFilter.getBotFieldName()%>" id="<%=SpamFilter.getBotFieldName()%>" value="" />
+  <wiki:SpamFilterInputs/>
 
   <div class="snipe">
 
diff --git a/jspwiki-war/src/main/webapp/templates/default/editors/preview.jsp b/jspwiki-war/src/main/webapp/templates/default/editors/preview.jsp
index 6a90dbe..3127dcf 100644
--- a/jspwiki-war/src/main/webapp/templates/default/editors/preview.jsp
+++ b/jspwiki-war/src/main/webapp/templates/default/editors/preview.jsp
@@ -54,7 +54,7 @@
 
     <input type="hidden" name="page" value="<wiki:Variable var='pagename' />" />
     <input type="hidden" name="action" value="save" />
-    <input type="hidden" name="<%=SpamFilter.getHashFieldName(request)%>"value="${lastchange}" />
+    <wiki:SpamFilterInputs/>
   
   <textarea class="hidden" readonly="readonly"
               id="editorarea" name="<%=EditorManager.REQ_EDITEDTEXT%>"
diff --git a/jspwiki-war/src/main/webapp/templates/default/editors/wysiwyg.jsp b/jspwiki-war/src/main/webapp/templates/default/editors/wysiwyg.jsp
index f769ce9..d8acf45 100644
--- a/jspwiki-war/src/main/webapp/templates/default/editors/wysiwyg.jsp
+++ b/jspwiki-war/src/main/webapp/templates/default/editors/wysiwyg.jsp
@@ -131,12 +131,7 @@
   <%-- Edit.jsp relies on these being found.  So be careful, if you make changes. --%>
   <input type="hidden" name="page" value="<wiki:Variable var='pagename' />" />
   <input type="hidden" name="action" value="save" />
-  <%=SpamFilter.insertInputFields( pageContext )%>
-  <input type="hidden" name="<%=SpamFilter.getHashFieldName(request)%>" value="${lastchange}" />
-  <%-- This following field is only for the SpamFilter to catch bots which are just randomly filling all fields and submitting.
-       Normal user should never see this field, nor type anything in it. --%>
-  <input class="hidden" type="text" name="<%=SpamFilter.getBotFieldName()%>" id="<%=SpamFilter.getBotFieldName()%>" value="" />
-
+  <wiki:SpamFilterInputs/>
 
   <div class="form-inline form-group">
 


[jspwiki] 09/11: JSPWIKI-1134: improve german translation

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 363f59459a402a91737b64614e5e15b5fd3c2afe
Author: juanpablo <ju...@apache.org>
AuthorDate: Sun Nov 29 22:53:00 2020 +0100

    JSPWIKI-1134: improve german translation
    
    Patch provided by Dietrich Schmidt - thanks
---
 .../main/resources/templates/default_de.properties | 39 +++++++++++++---------
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/jspwiki-main/src/main/resources/templates/default_de.properties b/jspwiki-main/src/main/resources/templates/default_de.properties
index 764f81f..c78a898 100644
--- a/jspwiki-main/src/main/resources/templates/default_de.properties
+++ b/jspwiki-main/src/main/resources/templates/default_de.properties
@@ -33,6 +33,8 @@
 # Translated into German by Sebastian Schmidt, Hochschule Heilbronn
 # Translation revised on 2008-02-05 by Florian Holeczek
 
+actions.trail=Verlauf
+
 # Common things
 
 common.nopage=Diese Seite existiert nicht. {0} sie doch einfach!
@@ -134,7 +136,7 @@ editgroup.cancel.submit=Abbrechen
 
 fav.myfavorites=Meine Favoriten
 fav.nomenu=Lege {0} an
-fav.greet.anonymous=Willkommen! (unbekannter Gast)
+fav.greet.anonymous=Willkommen, unbekannter Gast!
 fav.greet.asserted=Willkommen, {0}! (nicht angemeldet)
 fav.greet.authenticated=Willkommen, {0}! (authentifiziert)
 fav.aggregatewiki.title=Den RSS-Feed des gesamten Wikis abonnieren
@@ -601,7 +603,7 @@ editor.plain.undo.title=letzten Ersetzungsvorgang r
 
 #new since v2.5.100
 editor.plain.posteditor=Schl�sselwort+Tab eingeben:
-editor.plain.posteditor.title=Shift+Enter f�r n�chstes Feld
+editor.plain.posteditor.title=Umschalt+Eingabe f�r n�chstes Feld
 
 editor.plain.smartpairs=Smart Typing Pairs
 editor.plain.smartpairs.title=Automatische Paarbildung von () [] {} &lt;&gt; "" ''
@@ -612,13 +614,12 @@ editor.plain.autosuggest=Automatische Vervollst
 #editor.plain.editassist=Edit Assist
 #editor.plain.editassist.title=Toggle Edit Assist buttons
 editor.plain.livepreview=Echtzeitvorschau
-editor.plain.edit.resize=Drag to resize the text and preview area
 
 editor.plain.sneakpreview=Schnellvorschau
 editor.plain.sneakpreview.title=Schnellvorschau. \
 	Klicke au�erhalb des Textfeldes, um die Schnellvorschau zu aktualisieren.
 editor.plain.sidebysidepreview=Geteilte Vorschau
-editor.plain.edit.resize=Ziehen um die Gr��e der Text- und Vorschauberreich zu �ndern
+editor.plain.edit.resize=Ziehen um Text- und Vorschauansicht zu ver�ndern
 
 editor.plain.tbLink.title=link - einen Wiki-Link einf�gen
 editor.plain.tbH1.title=h1 - �berschrift 1 einf�gen
@@ -635,7 +636,7 @@ editor.plain.tbSUP.title=sup - hochgesetzte Schrift
 editor.plain.tbSUB.title=sub - herabgesetzte Schrift
 editor.plain.tbSTRIKE.title=strike - durchgestrichen
 editor.plain.tbTOC.title=toc - Inhaltsverzeichnis einf�gen
-editor.plain.tbTAB.title=tab - Reiter (Tabs) einf�gen
+editor.plain.tbTAB.title=tab - Reiter einf�gen
 editor.plain.tbTABLE.title=table - Tabelle einf�gen
 editor.plain.tbIMG.title=img - Bild einf�gen
 editor.plain.tbCODE.title=code - Codeblock einf�gen
@@ -649,7 +650,7 @@ editor.preview.edit.title=Die aktuelle Seite weiter bearbeiten [ e ]
 editor.preview.save.submit=Speichern
 editor.preview.save.title=Die aktuelle Seite speichern [ s ]
 editor.preview.cancel.submit=Abbrechen
-editor.preview.cancel.title=Bearbeiten abbrechen. Deine �nderungen gehen dabei verloren. [ q ]
+editor.preview.cancel.title=Bearbeiten abbrechen, �nderungen gehen verloren. [q]
 
 editor.fck.noscript=Du musst Javascript in deinem Browser aktivieren, um den FCK-Editor nutzen zu k�nnen.
 editor.wikiwizard.noscript=Du musst Javascript in deinem Browser aktivieren, um den WikiWizard-Editor nutzen zu \
@@ -667,17 +668,27 @@ blog.addcomments=Kommentieren
 #  The Javascript stuff
 #
 javascript.sbox.clearrecent=L�sche letzte Suchen
-javascript.sbox.clone=Dupliziere dies Seite
+javascript.sbox.clone=Dupliziere diese Seite
 javascript.sbox.create=Erzeuge {0}
 javascript.sbox.clone.suffix=-Neu
 
 javascript.edit.allsections=(Alle)
 javascript.edit.startOfPage=(Seitenanfang)
 javascript.edit.findandreplace.nomatch=Keine Treffer gefunden!
-javascript.edit.toolbar.makeSelection=Bitte treffe zuerst eine Auswahl.
+javascript.edit.toolbar.makeSelection=Zuerst eine Auswahl treffen
 javascript.edit.resize=Ziehen, um die Gr��e des Textfeldes zu �ndern
-javascript.edit.areyousure=Wenn du nicht speicherst, werden deine �nderungen verloren gehen. Bist du sicher, \
-	dass du die Seite verlassen willst?
+javascript.edit.areyousure=Ohne Speichern gehen die �nderungen verloren. Seite verlassen?
+javascript.preview.zone = Vorschaubereich
+
+javascript.dialog.confirm = Zustimmen
+javascript.dialog.cancel = Abbrechen
+javascript.dialog.character.entities = Character entities
+javascript.dialog.link.attributes = Wiki Link Attributes
+javascript.dialog.plugin = Plugin
+javascript.dialog.permission = Seitenberechtigung
+javascript.dialog.principal = Rollen, Gruppen oder Benutzer
+javascript.dialog.styles = Zus�tzliche Stile
+javascript.dialog.toc.options = Inhaltsverzeichnis-Optionen
 
 javascript.favs.show=Favoriten einblenden
 javascript.favs.hide=Favoriten ausblenden
@@ -694,13 +705,13 @@ javascript.filter.all=(Alle)
 javascript.filter.hint=Eingabe von Filterausdr�cken (Esc f�r L�schen)
 javascript.tablefilter=Tabelleninhalt filtern
 
-javascript.group.validName=Bitte einen g�ltigen Namen f�r die neue Gruppe angeben!
+javascript.group.validName=Einen g�ltigen Namen f�r die neue Gruppe angeben!
 
 javascript.category.title=Klicken, um Kategorie [{0}] anzuzeigen...
 
 javascript.slimbox.info=Bild {0} von {1}
-javascript.slimbox.error=<h2>Fehler</h2>Es gab ein Problem mit deiner Anfrage.<br />Bitte versuche es erneut!
-javascript.slimbox.directLink=Direkter Link zum Ziel
+javascript.slimbox.error=<h2>Fehler</h2>Es gab ein Problem.<br />Erneut versuchen.
+javascript.slimbox.directLink=Direkter Verweis zum Ziel
 javascript.slimbox.remoteRequest=Anfrage zur Fernsteuerung {0} von {1}
 javascript.slimbox.previous=&laquo; Vorherige
 javascript.slimbox.next=N�chste &raquo;
@@ -716,5 +727,3 @@ javascript.tip.default.title=Weitere...
 
 javascript.prefs.areyousure=Wenn du nicht auf 'Benutzereinstellungen speichern' klickst, \
 	werden deine Einstellungen verworfen. Bist du sicher, dass diese Seite verlassen werden soll?
-
-


[jspwiki] 05/11: apply fixes suggested by intellij

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 a1c197c8e15a6fae24438e3cab8d8eee615f215e
Author: juanpablo <ju...@apache.org>
AuthorDate: Sun Nov 29 22:31:59 2020 +0100

    apply fixes suggested by intellij
---
 .../java/org/apache/wiki/filters/SpamFilter.java   | 121 ++++++++++-----------
 1 file changed, 55 insertions(+), 66 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/filters/SpamFilter.java b/jspwiki-main/src/main/java/org/apache/wiki/filters/SpamFilter.java
index c215ce1..08b3d92 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/filters/SpamFilter.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/filters/SpamFilter.java
@@ -181,16 +181,16 @@ public class SpamFilter extends BasePageFilter {
     private String          m_errorPage          = "RejectedMessage";
     private String          m_blacklist          = "SpamFilterWordList/blacklist.txt";
 
-    private PatternMatcher  m_matcher = new Perl5Matcher();
-    private PatternCompiler m_compiler = new Perl5Compiler();
+    private final PatternMatcher  m_matcher = new Perl5Matcher();
+    private final PatternCompiler m_compiler = new Perl5Compiler();
 
     private Collection<Pattern> m_spamPatterns = null;
     private Collection<Pattern> m_IPPatterns = null;
 
-    private Date            m_lastRebuild = new Date( 0L );
+    private Date m_lastRebuild = new Date( 0L );
 
-    private static  Logger  c_spamlog = Logger.getLogger( "SpamLog" );
-    private static  Logger  log = Logger.getLogger( SpamFilter.class );
+    private static final Logger c_spamlog = Logger.getLogger( "SpamLog" );
+    private static final Logger log = Logger.getLogger( SpamFilter.class );
 
     private Vector<Host>    m_temporaryBanList = new Vector<>();
 
@@ -277,23 +277,17 @@ public class SpamFilter extends BasePageFilter {
         message = TextUtil.replaceString( message, "\"", "\\\"" );
 
         final String uid = getUniqueID();
-
         final String page   = ctx.getPage().getName();
-        String reason = "UNKNOWN";
         final String addr   = ctx.getHttpRequest() != null ? HttpUtil.getRemoteAddress( ctx.getHttpRequest() ) : "-";
-
+        final String reason;
         switch( type ) {
-            case REJECT:
-                reason = "REJECTED";
+            case REJECT: reason = "REJECTED";
                 break;
-            case ACCEPT:
-                reason = "ACCEPTED";
+            case ACCEPT: reason = "ACCEPTED";
                 break;
-            case NOTE:
-                reason = "NOTE";
+            case NOTE: reason = "NOTE";
                 break;
-            default:
-                throw new InternalWikiException( "Illegal type " + type );
+            default: throw new InternalWikiException( "Illegal type " + type );
         }
         c_spamlog.info( reason + " " + source + " " + uid + " " + addr + " \"" + page + "\" " + message );
 
@@ -318,7 +312,7 @@ public class SpamFilter extends BasePageFilter {
         if( !m_stopAtFirstMatch ) {
             final Integer score = context.getVariable( ATTR_SPAMFILTER_SCORE );
 
-            if( score != null && score.intValue() >= m_scoreLimit ) {
+            if( score != null && score >= m_scoreLimit ) {
                 throw new RedirectException( "Herb says you got too many points", getRedirectPage( context ) );
             }
         }
@@ -327,10 +321,10 @@ public class SpamFilter extends BasePageFilter {
         return content;
     }
 
-    private void checkPageName( final Context context, final String content, final Change change) throws RedirectException {
+    private void checkPageName( final Context context, final String content, final Change change ) throws RedirectException {
         final Page page = context.getPage();
         final String pageName = page.getName();
-        final int maxlength = Integer.valueOf(m_pageNameMaxLength);
+        final int maxlength = Integer.parseInt(m_pageNameMaxLength);
         if ( pageName.length() > maxlength) {
             //
             //  Spam filter has a match.
@@ -360,11 +354,10 @@ public class SpamFilter extends BasePageFilter {
     }
     
     /**
-     *  Parses a list of patterns and returns a Collection of compiled Pattern
-     *  objects.
+     *  Parses a list of patterns and returns a Collection of compiled Pattern objects.
      *
-     * @param source
-     * @param list
+     * @param source page containing the list of patterns.
+     * @param list list of patterns.
      * @return A Collection of the Patterns that were found from the lists.
      */
     private Collection< Pattern > parseWordList( final Page source, final String list ) {
@@ -391,7 +384,7 @@ public class SpamFilter extends BasePageFilter {
     /**
      *  Takes a MT-Blacklist -formatted blacklist and returns a list of compiled Pattern objects.
      *
-     *  @param list
+     *  @param list list of patterns.
      *  @return The parsed blacklist patterns.
      */
     private Collection< Pattern > parseBlacklist( final String list ) {
@@ -425,12 +418,12 @@ public class SpamFilter extends BasePageFilter {
     }
 
     /**
-     *  Takes a single page change and performs a load of tests on the content change.
-     *  An admin can modify anything.
+     * Takes a single page change and performs a load of tests on the content change. An admin can modify anything.
      *
-     *  @param context
-     *  @param content
-     *  @throws RedirectException
+     * @param context page Context
+     * @param content page content
+     * @param change page change
+     * @throws RedirectException spam filter rejects the page change.
      */
     private synchronized void checkSinglePageChange( final Context context, final String content, final Change change )
     		throws RedirectException {
@@ -520,9 +513,8 @@ public class SpamFilter extends BasePageFilter {
     /**
      *  Checks against the akismet system.
      *
-     * @param context
-     * @param change
-     * @throws RedirectException
+     * @param context page Context
+     * @throws RedirectException spam filter rejects the page change.
      */
     private void checkAkismet( final Context context, final Change change ) throws RedirectException {
         if( m_akismetAPIKey != null ) {
@@ -597,9 +589,9 @@ public class SpamFilter extends BasePageFilter {
     /**
      * This checks whether an invisible field is available in the request, and whether it's contents are suspected spam.
      *
-     * @param context
-     * @param change
-     * @throws RedirectException
+     * @param context page Context
+     * @param change page change
+     * @throws RedirectException spam filter rejects the page change.
      */
     private void checkBotTrap( final Context context, final Change change ) throws RedirectException {
         final HttpServletRequest request = context.getHttpRequest();
@@ -643,8 +635,8 @@ public class SpamFilter extends BasePageFilter {
     /**
      *  Checks the ban list if the IP address of the changer is already on it.
      *
-     *  @param context
-     *  @throws RedirectException
+     *  @param context page context
+     *  @throws RedirectException spam filter rejects the page change.
      */
     private void checkBanList( final Context context, final Change change ) throws RedirectException {
         final HttpServletRequest req = context.getHttpRequest();
@@ -723,12 +715,12 @@ public class SpamFilter extends BasePageFilter {
     }
 
     /**
-     *  Does a check against a known pattern list.
+     * Does a check against a known pattern list.
      *
-     *  @param context
-     *  @param content
-     *  @param change
-     *  @throws RedirectException
+     * @param context page Context
+     * @param content page content
+     * @param change page change
+     * @throws RedirectException spam filter rejects the page change.
      */
     private void checkPatternList( final Context context, final String content, final Change change ) throws RedirectException {
         // If we have no spam patterns defined, or we're trying to save the page containing the patterns, just return.
@@ -758,8 +750,8 @@ public class SpamFilter extends BasePageFilter {
     /**
      *  Does a check against a pattern list of IPs.
      *
-     *  @param context
-     *  @throws RedirectException
+     *  @param context page context
+     *  @throws RedirectException spam filter rejects the page change.
      */
     private void checkIPList( final Context context ) throws RedirectException {
         //  If we have no IP patterns defined, or we're trying to save the page containing the IP patterns, just return.
@@ -794,8 +786,8 @@ public class SpamFilter extends BasePageFilter {
     /**
      *  Creates a simple text string describing the added content.
      *
-     *  @param context
-     *  @param newText
+     *  @param context page context
+     *  @param newText added content
      *  @return Empty string, if there is no change.
      */
     private static Change getChange( final Context context, final String newText ) {
@@ -852,9 +844,9 @@ public class SpamFilter extends BasePageFilter {
     }
 
     /**
-     *  Returns true, if this user should be ignored.  For example, admin users.
+     * Returns true, if this user should be ignored.  For example, admin users.
      *
-     * @param context
+     * @param context page context
      * @return True, if this users should be ignored.
      */
     private boolean ignoreThisUser( final Context context ) {
@@ -866,11 +858,7 @@ public class SpamFilter extends BasePageFilter {
             return true;
         }
 
-        if( context.getVariable( "captcha" ) != null ) {
-            return true;
-        }
-
-        return false;
+        return context.getVariable("captcha") != null;
     }
 
     /**
@@ -932,7 +920,7 @@ public class SpamFilter extends BasePageFilter {
      *  @since 2.6
      *  @return A hash value for this page and session
      */
-    public static final String getSpamHash( final Page page, final HttpServletRequest request ) {
+    public static String getSpamHash( final Page page, final HttpServletRequest request ) {
         long lastModified = 0;
 
         if( page.getLastModified() != null ) {
@@ -951,7 +939,7 @@ public class SpamFilter extends BasePageFilter {
      *  @return The name to be used in the hash field
      *  @since  2.6
      */
-    public static final String getHashFieldName( final HttpServletRequest request ) {
+    public static String getHashFieldName( final HttpServletRequest request ) {
         String hash = null;
 
         if( request.getSession() != null ) {
@@ -986,7 +974,7 @@ public class SpamFilter extends BasePageFilter {
      *  @throws IOException If redirection fails
      *  @since 2.6
      */
-    public static final boolean checkHash( final Context context, final PageContext pageContext ) throws IOException {
+    public static boolean checkHash( final Context context, final PageContext pageContext ) throws IOException {
         final String hashName = getHashFieldName( (HttpServletRequest)pageContext.getRequest() );
         if( pageContext.getRequest().getParameter(hashName) == null ) {
             if( pageContext.getAttribute( hashName ) == null ) {
@@ -1009,7 +997,7 @@ public class SpamFilter extends BasePageFilter {
      * @param pageContext The PageContext
      * @return A HTML string which contains input fields for the SpamFilter.
      */
-    public static final String insertInputFields( final PageContext pageContext ) {
+    public static String insertInputFields( final PageContext pageContext ) {
         final Context ctx = Context.findContext( pageContext );
         final Engine engine = ctx.getEngine();
         final StringBuilder sb = new StringBuilder();
@@ -1022,15 +1010,13 @@ public class SpamFilter extends BasePageFilter {
     
     /**
      *  A local class for storing host information.
-     *
-     *  @since
      */
     private class Host {
 
-        private long m_addedTime = System.currentTimeMillis();
-        private long m_releaseTime;
-        private String m_address;
-        private Change m_change;
+        private final long m_addedTime = System.currentTimeMillis();
+        private final long m_releaseTime;
+        private final String m_address;
+        private final Change m_change;
 
         public String getAddress() {
             return m_address;
@@ -1062,18 +1048,21 @@ public class SpamFilter extends BasePageFilter {
         public int    m_adds;
         public int    m_removals;
 
-        @Override public String toString() {
+        @Override
+        public String toString() {
             return m_change;
         }
 
-        @Override public boolean equals( final Object o ) {
+        @Override
+        public boolean equals( final Object o ) {
             if( o instanceof Change ) {
                 return m_change.equals( ( ( Change )o ).m_change );
             }
             return false;
         }
 
-        @Override public int hashCode() {
+        @Override
+        public int hashCode() {
             return m_change.hashCode() + 17;
         }
         


[jspwiki] 08/11: ensure IndexPlugin works with non-blank page references

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 9ae2f9fff7533beb9784ec8f9c89401b58623552
Author: juanpablo <ju...@apache.org>
AuthorDate: Sun Nov 29 22:39:16 2020 +0100

    ensure IndexPlugin works with non-blank page references
---
 jspwiki-main/src/main/java/org/apache/wiki/plugin/IndexPlugin.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/plugin/IndexPlugin.java b/jspwiki-main/src/main/java/org/apache/wiki/plugin/IndexPlugin.java
index f326714..29b1a5b 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/plugin/IndexPlugin.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/plugin/IndexPlugin.java
@@ -19,6 +19,7 @@
 
 package org.apache.wiki.plugin;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.log4j.Logger;
 import org.apache.wiki.api.core.Context;
 import org.apache.wiki.api.core.ContextEnum;
@@ -77,8 +78,8 @@ public class IndexPlugin extends AbstractReferralPlugin implements Plugin {
             context.getEngine().getManager( PageManager.class ).getPageSorter().sort(pages);
             char initialChar = ' ';
             Element currentDiv = new Element("div",xmlns_XHTML);            
-            for ( final String name : pages ) {
-                if ( name.charAt(0) != initialChar ) {
+            for( final String name : pages ) {
+                if( StringUtils.isNotBlank( name ) &&  name.charAt(0) != initialChar ) {
                     if ( initialChar != ' ' ) {
                         indexDiv.addContent(" - ");
                     }