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 2018/12/25 20:47:33 UTC

[jspwiki] branch master updated (8409e38 -> 4dfe163)

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 8409e38  2.11.0-M1-git-13: AJAX based search results are not shown.
     new 4bc7e97  update dependencies versions':
     new 9a5e662  remove inline comment, no longer true
     new 9f7c530  minor refactor to avoid empty catch on closing inputstream
     new fdc0640  update lucene to 7.6.0
     new 1e994c5  escape entities on Captcha.jsp request parameters
     new 8c49493  Modify Jenkinsfile to build both source and website on one go; jspwiki-site job will run only if called explicitly
     new 1057136  2.11.0-M1-git-14
     new e212d4b  remove unneeded @SuppressWarnings; reorder / add missing braces
     new 4dfe163  update changelog

The 9 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                                          | 16 ++++
 Jenkinsfile                                        | 63 +++++++++++----
 .../src/main/java/org/apache/wiki/PageSorter.java  | 89 ++++++++++------------
 .../src/main/java/org/apache/wiki/Release.java     |  2 +-
 .../org/apache/wiki/preferences/Preferences.java   |  2 -
 .../apache/wiki/search/LuceneSearchProvider.java   | 21 +++--
 .../java/org/apache/wiki/ui/TemplateManager.java   | 46 +++--------
 .../org/apache/wiki/search/SearchManagerTest.java  |  2 +-
 jspwiki-war/src/main/webapp/Captcha.jsp            | 22 +++---
 pom.xml                                            | 12 +--
 10 files changed, 145 insertions(+), 130 deletions(-)


[jspwiki] 06/09: Modify Jenkinsfile to build both source and website on one go; jspwiki-site job will run only if called explicitly

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 8c494933d0d70f58f8ba724048f4523a7344a493
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Dec 25 20:38:27 2018 +0100

    Modify Jenkinsfile to build both source and website on one go; jspwiki-site job will run only if called explicitly
---
 Jenkinsfile | 63 +++++++++++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 49 insertions(+), 14 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index b7cd1c1..b99e950 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -18,36 +18,71 @@
  */
 
 try {
-    def repo = 'https://github.com/apache/jspwiki'
-    
+    def buildRepo = 'https://github.com/apache/jspwiki'
+    def siteRepo = 'https://gitbox.apache.org/repos/asf/jspwiki-site.git'
+    def creds = '9b041bd0-aea9-4498-a576-9eeb771411dd'
+
+    def asfsite = 'asf-site'
+    def build = 'build'
+    def jbake = 'jbake'
+
     node( 'ubuntu' ) {
         def JAVA_JDK_8=tool name: 'JDK 1.8 (latest)', type: 'hudson.model.JDK'
         echo "Will use Java $JAVA_JDK_8"
-        
+
         def MAVEN_3_LATEST=tool name: 'Maven 3 (latest)', type: 'hudson.tasks.Maven$MavenInstallation'
         echo "Will use Maven $MAVEN_3_LATEST"
-        
-        stage( 'checkout' ) {
+
+        stage( 'clean ws' ) {
             cleanWs()
-            git repo
         }
 
-        stage( 'build' ) {
+        stage( 'build source' ) {
+            dir( build ) {
+                git url: buildRepo, poll: true
+                withEnv( [ "Path+JDK=$JAVA_JDK_8/bin", "Path+MAVEN=$MAVEN_3_LATEST/bin", "JAVA_HOME=$JAVA_JDK_8" ] ) {
+                    withSonarQubeEnv( 'ASF Sonar Analysis' ) {
+                        echo "Will use SonarQube instance at $SONAR_HOST_URL"
+                        sh "mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install -Papache-release $SONAR_MAVEN_GOAL"
+                    }
+                }
+            }
+        }
+
+        stage( 'build website' ) {
             withEnv( [ "Path+JDK=$JAVA_JDK_8/bin", "Path+MAVEN=$MAVEN_3_LATEST/bin", "JAVA_HOME=$JAVA_JDK_8" ] ) {
-			    withSonarQubeEnv( 'ASF Sonar Analysis' ) {
-			        echo "Will use SonarQube instance at $SONAR_HOST_URL"
-                    sh "mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package $SONAR_MAVEN_GOAL"
-				}
+                dir( jbake ) {
+                    git branch: jbake, url: siteRepo, credentialsId: creds
+                    sh 'mvn clean process-resources'
+                }
+                stash name: 'jbake-website'
             }
         }
         
     }
-    
+
+    node( 'git-websites' ) {
+        stage( 'publish website' ) {
+            cleanWs()
+            unstash 'jbake-website'
+            dir( asfsite ) {
+                git branch: asfsite, url: siteRepo, credentialsId: creds
+                sh "cp -rf ../$jbake/target/content/* ./"
+                timeout( 15 ) { // 15 minutes
+                    sh 'git add .'
+                    sh 'git commit -m "Automatic Site Publish by Buildbot"'
+                    echo "pushing to $repo"
+                    sh "git push origin asf-site"
+                }
+            }
+        }
+    }
+
     currentBuild.result = 'SUCCESS'
-    
+
 } catch( Exception err ) {
     currentBuild.result = 'FAILURE'
-	echo err.message
+    echo err.message
 } finally {
     node( 'ubuntu' ) {
         if( currentBuild.result == null ) {


[jspwiki] 08/09: remove unneeded @SuppressWarnings; reorder / add missing braces

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 e212d4b5e6ca115ab9404cb92264cfd9ba9f9a62
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Dec 25 21:24:36 2018 +0100

    remove unneeded @SuppressWarnings; reorder / add missing braces
---
 .../src/main/java/org/apache/wiki/PageSorter.java  | 89 ++++++++++------------
 1 file changed, 39 insertions(+), 50 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/PageSorter.java b/jspwiki-main/src/main/java/org/apache/wiki/PageSorter.java
index 3e3fae6..94fe252 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/PageSorter.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/PageSorter.java
@@ -35,8 +35,8 @@ import org.apache.wiki.util.comparators.JavaNaturalComparator;
  * <b>Note</b> - this class is deliberately not null safe. Never call any of the
  * methods with a null argument!
  */
-public class PageSorter implements Comparator
-{
+public class PageSorter implements Comparator< Object > {
+    
     private static Logger log = Logger.getLogger( PageSorter.class );
 
     // The name of the property that specifies the desired page name comparator
@@ -47,8 +47,7 @@ public class PageSorter implements Comparator
     /**
      * Default constructor uses Java "natural" ordering.
      */
-    public PageSorter()
-    {
+    public PageSorter() {
         m_comparator = JavaNaturalComparator.DEFAULT_JAVA_COMPARATOR;
     }
 
@@ -57,8 +56,7 @@ public class PageSorter implements Comparator
      * 
      * @param comparator the Comparator to use
      */
-    public PageSorter( Comparator<String> comparator )
-    {
+    public PageSorter( Comparator<String> comparator ) {
         m_comparator = comparator;
     }
 
@@ -69,21 +67,22 @@ public class PageSorter implements Comparator
      * @throws IllegalArgumentException if incorrect argument types.
      * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
      */
-    public int compare( Object o1, Object o2 )
-    {
-        if( o1 instanceof String )
-        {
-            if( o2 instanceof String )
+    @Override
+    public int compare( Object o1, Object o2 ) {
+        if( o1 instanceof String ) {
+            if( o2 instanceof String ) {
                 return m_comparator.compare( (String) o1, (String) o2 );
-            if( o2 instanceof WikiPage )
+            }
+            if( o2 instanceof WikiPage ) {
                 return m_comparator.compare( (String) o1, ((WikiPage) o2).getName() );
-        }
-        else if( o1 instanceof WikiPage )
-        {
-            if( o2 instanceof WikiPage )
+            }
+        } else if( o1 instanceof WikiPage ) {
+            if( o2 instanceof WikiPage ) {
                 return m_comparator.compare( ((WikiPage) o1).getName(), ((WikiPage) o2).getName() );
-            if( o2 instanceof String )
+            }
+            if( o2 instanceof String ) {
                 return m_comparator.compare( ((WikiPage) o1).getName(), (String) o2 );
+            }
         }
 
         throw new IllegalArgumentException( "Can only compare String or WikiPage" );
@@ -97,8 +96,7 @@ public class PageSorter implements Comparator
      * @return see java.util.Comparator
      * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
      */
-    public int compare( String pageName1, String pageName2 )
-    {
+    public int compare( String pageName1, String pageName2 ) {
         return m_comparator.compare( pageName1, pageName2 );
     }
 
@@ -111,26 +109,27 @@ public class PageSorter implements Comparator
      * @return see java.util.Comparator
      * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
      */
-    public int compare( WikiPage page1, WikiPage page2 )
-    {
-        if( page1 == page2 )
+    public int compare( WikiPage page1, WikiPage page2 ) {
+        if( page1 == page2 ) {
             return 0; // the same object
+        }
 
         int res = m_comparator.compare( page1.getName(), page2.getName() );
-        if( res == 0 )
+        if( res == 0 ) {
             res = page1.getVersion() - page2.getVersion();
+        }
         return res;
     }
 
     @Override
-    public boolean equals( Object o )
-    {
-        if( !(o instanceof PageSorter) )
+    public boolean equals( Object o ) {
+        if( !(o instanceof PageSorter) ) {
             return false; // Definitely not equal
-
+        }
         PageSorter that = (PageSorter) o;
-        if( this == that || m_comparator == that.m_comparator )
+        if( this == that || m_comparator == that.m_comparator ) {
             return true; // Essentially the same object
+        }
         return m_comparator.equals( that.m_comparator );
     }
 
@@ -142,22 +141,17 @@ public class PageSorter implements Comparator
      * 
      * @param props this WikiEngine's properties.
      */
-    @SuppressWarnings( "unchecked" )
-    public void initialize( Properties props )
-    {
+    public void initialize( Properties props ) {
         // Default is Java natural order
         m_comparator = JavaNaturalComparator.DEFAULT_JAVA_COMPARATOR;
         String className = props.getProperty( PROP_PAGE_NAME_COMPARATOR );
-        if( className != null && className.length() > 0 )
-            try
-            {
-                m_comparator = (Comparator<String>) ClassUtil.findClass( "org.apache.wiki.util.comparators", className )
-                    .newInstance();
-            }
-            catch( Exception e )
-            {
+        if( className != null && className.length() > 0 ) {
+            try {
+                m_comparator = ClassUtil.getMappedObject( "org.apache.wiki.util.comparators." + className );
+            } catch( Exception e ) {
                 log.error( "Falling back to default \"natural\" comparator", e );
             }
+        }
     }
 
     /**
@@ -167,8 +161,7 @@ public class PageSorter implements Comparator
      * 
      * @param nameList the page names to be sorted
      */
-    public void sort( List<String> nameList )
-    {
+    public void sort( List< String > nameList ) {
         Collections.sort( nameList, m_comparator );
     }
 
@@ -179,8 +172,7 @@ public class PageSorter implements Comparator
      * 
      * @param nameArray the page names to be sorted
      */
-    public void sort( String[] nameArray )
-    {
+    public void sort( String[] nameArray ) {
         Arrays.sort( nameArray, m_comparator );
     }
 
@@ -191,10 +183,8 @@ public class PageSorter implements Comparator
      * 
      * @param pageList the pages to be sorted
      */
-    @SuppressWarnings( "unchecked" )
-    public void sortPages( List<Object> pageList )
-    {
-        Collections.sort( pageList, this );
+    public void sortPages( List< Object > pageList ) {
+        Collections.< Object >sort( pageList, this );
     }
 
     /**
@@ -204,9 +194,8 @@ public class PageSorter implements Comparator
      * 
      * @param pageArray the pages to be sorted
      */
-    @SuppressWarnings( "unchecked" )
-    public void sortPages( Object[] pageArray )
-    {
+    public void sortPages( Object[] pageArray ) {
         Arrays.sort( pageArray, this );
     }
+
 }


[jspwiki] 01/09: update dependencies versions':

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 4bc7e978153192da706570670c66ecd7811efbd7
Author: juanpablo <ju...@apache.org>
AuthorDate: Wed Dec 19 23:07:35 2018 +0100

    update dependencies versions':
    
    commons-fileupload to 1.3.3
    ehcache to 2.10.6
    flexmark to 0.35.0
    junit to 5.3.2
    tomcat to 8.5.37
---
 pom.xml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pom.xml b/pom.xml
index 7dce9d9..92debe8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -43,12 +43,12 @@
     <maven.version>3.5</maven.version>
 
     <akismet-java.version>1.02</akismet-java.version>
-    <commons-fileupload.version>1.3</commons-fileupload.version>
+    <commons-fileupload.version>1.3.3</commons-fileupload.version>
     <commons-httpclient.version>3.1</commons-httpclient.version>
     <commons-io.version>2.4</commons-io.version>
     <commons-lang.version>2.6</commons-lang.version>
-    <ehcache.version>2.8.3</ehcache.version>
-    <flexmark.version>0.34.56</flexmark.version>
+    <ehcache.version>2.10.6</ehcache.version>
+    <flexmark.version>0.35.0</flexmark.version>
     <freshcookies-security.version>0.60</freshcookies-security.version>
     <gson.version>2.3.1</gson.version>
     <hsqldb.version>2.3.0</hsqldb.version>
@@ -60,7 +60,7 @@
     <jdom2.version>2.0.5</jdom2.version>
     <jetty.version>8.1.15.v20140411</jetty.version>
     <jrcs-diff.version>0.4.2</jrcs-diff.version>
-    <junit.version>5.3.1</junit.version>
+    <junit.version>5.3.2</junit.version>
     <log4j.version>1.2.17</log4j.version>
     <lucene.version>4.7.0</lucene.version>
     <nekohtml.version>1.9.21</nekohtml.version>
@@ -69,7 +69,7 @@
     <selenium.version>2.42.0</selenium.version>
     <slf4j.version>1.7.25</slf4j.version>
     <stripes.version>1.6.0</stripes.version>
-    <tomcat.version>8.5.34</tomcat.version>
+    <tomcat.version>8.5.37</tomcat.version>
     <wro4j.version>1.8.0</wro4j.version>
     <xmlrpc.version>2.0.1</xmlrpc.version>
 


[jspwiki] 02/09: remove inline comment, no longer true

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 9a5e6629cf5cec43ef91a2b501db854b081fab97
Author: juanpablo <ju...@apache.org>
AuthorDate: Wed Dec 19 23:08:35 2018 +0100

    remove inline comment, no longer true
---
 jspwiki-main/src/main/java/org/apache/wiki/preferences/Preferences.java | 2 --
 1 file changed, 2 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/preferences/Preferences.java b/jspwiki-main/src/main/java/org/apache/wiki/preferences/Preferences.java
index 139eb24..7bd8843 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/preferences/Preferences.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/preferences/Preferences.java
@@ -112,8 +112,6 @@ public class Preferences
         prefs.put("Language", TextUtil.getStringProperty( props, "jspwiki.defaultprefs.template.language", getLocale( ctx ).toString() ) );
         prefs.put("SectionEditing", TextUtil.getStringProperty( props, "jspwiki.defaultprefs.template.sectionediting", "true" ) );
 
-        // FIXME: "editor" property does not get registered, may be related with http://bugs.jspwiki.org/show_bug.cgi?id=117
-        // disabling it until knowing why it's happening
         // FIXME: editormanager reads jspwiki.editor -- which of both properties should continue
         prefs.put("editor", TextUtil.getStringProperty( props, "jspwiki.defaultprefs.template.editor", "plain" ) );
 


[jspwiki] 04/09: update lucene to 7.6.0

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 fdc064085f89b0b21e7ee9f92de4d77720d17bfc
Author: juanpablo <ju...@apache.org>
AuthorDate: Mon Dec 24 01:33:58 2018 +0100

    update lucene to 7.6.0
---
 .../apache/wiki/search/LuceneSearchProvider.java    | 21 ++++++++++-----------
 .../org/apache/wiki/search/SearchManagerTest.java   |  2 +-
 pom.xml                                             |  2 +-
 3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/search/LuceneSearchProvider.java b/jspwiki-main/src/main/java/org/apache/wiki/search/LuceneSearchProvider.java
index 5af7573..a515866 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/search/LuceneSearchProvider.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/search/LuceneSearchProvider.java
@@ -64,7 +64,6 @@ import org.apache.lucene.search.highlight.SimpleHTMLFormatter;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.LockObtainFailedException;
 import org.apache.lucene.store.SimpleFSDirectory;
-import org.apache.lucene.util.Version;
 import org.apache.wiki.InternalWikiException;
 import org.apache.wiki.WatchDog;
 import org.apache.wiki.WikiBackgroundThread;
@@ -126,7 +125,7 @@ public class LuceneSearchProvider implements SearchProvider {
     private static final int MAX_FRAGMENTS = 3;
 
     /** The maximum number of hits to return from searches. */
-    public static final int MAX_SEARCH_HITS = 99999;
+    public static final int MAX_SEARCH_HITS = 99_999;
     
     private static String c_punctuationSpaces = StringUtils.repeat(" ", MarkupParser.PUNCTUATION_CHARS_ALLOWED.length() );
 
@@ -217,7 +216,7 @@ public class LuceneSearchProvider implements SearchProvider {
 
                 log.info("Starting Lucene reindexing, this can take a couple of minutes...");
 
-                Directory luceneDir = new SimpleFSDirectory(dir, null);
+                Directory luceneDir = new SimpleFSDirectory( dir.toPath() );
                 try( IndexWriter writer = getIndexWriter( luceneDir ) )
                 {
                     Collection< WikiPage > allPages = m_engine.getPageManager().getAllPages();
@@ -359,7 +358,7 @@ public class LuceneSearchProvider implements SearchProvider {
             pageRemoved( page );
 
             // Now add back the new version.
-            luceneDir = new SimpleFSDirectory(new File(m_luceneDirectory), null);
+            luceneDir = new SimpleFSDirectory( new File( m_luceneDirectory ).toPath() );
             writer = getIndexWriter( luceneDir );
             
             luceneIndexPage( page, text, writer );
@@ -388,8 +387,8 @@ public class LuceneSearchProvider implements SearchProvider {
         try
         {
             Class< ? > clazz = ClassUtil.findClass( "", m_analyzerClass );
-            Constructor< ? > constructor = clazz.getConstructor( Version.LUCENE_47.getClass() );
-            Analyzer analyzer = (Analyzer) constructor.newInstance( Version.LUCENE_47 );
+            Constructor< ? > constructor = clazz.getConstructor();
+            Analyzer analyzer = (Analyzer) constructor.newInstance();
             return analyzer;
         }
         catch( Exception e )
@@ -479,7 +478,7 @@ public class LuceneSearchProvider implements SearchProvider {
         IndexWriter writer = null;
         try
         {
-            Directory luceneDir = new SimpleFSDirectory(new File(m_luceneDirectory), null);
+            Directory luceneDir = new SimpleFSDirectory( new File( m_luceneDirectory ).toPath() );
             writer = getIndexWriter( luceneDir );
             Query query = new TermQuery( new Term( LUCENE_ID, page.getName() ) );
             writer.deleteDocuments( query );
@@ -498,7 +497,7 @@ public class LuceneSearchProvider implements SearchProvider {
             LockObtainFailedException, IOException, ProviderException 
     {
         IndexWriter writer = null;
-        IndexWriterConfig writerConfig = new IndexWriterConfig( Version.LUCENE_47, getLuceneAnalyzer() );
+        IndexWriterConfig writerConfig = new IndexWriterConfig( getLuceneAnalyzer() );
         writerConfig.setOpenMode( OpenMode.CREATE_OR_APPEND );
         writer = new IndexWriter( luceneDir, writerConfig );
         
@@ -512,7 +511,7 @@ public class LuceneSearchProvider implements SearchProvider {
         {
             if( writer != null ) 
             {
-                writer.close( true );
+                writer.close();
             }
         }
         catch( IOException e )
@@ -583,7 +582,7 @@ public class LuceneSearchProvider implements SearchProvider {
         try
         {
             String[] queryfields = { LUCENE_PAGE_CONTENTS, LUCENE_PAGE_NAME, LUCENE_AUTHOR, LUCENE_ATTACHMENTS };
-            QueryParser qp = new MultiFieldQueryParser( Version.LUCENE_47, queryfields, getLuceneAnalyzer() );
+            QueryParser qp = new MultiFieldQueryParser( queryfields, getLuceneAnalyzer() );
 
             //QueryParser qp = new QueryParser( LUCENE_PAGE_CONTENTS, getLuceneAnalyzer() );
             Query luceneQuery = qp.parse( query );
@@ -598,7 +597,7 @@ public class LuceneSearchProvider implements SearchProvider {
             try
             {
                 File dir = new File(m_luceneDirectory);
-                Directory luceneDir = new SimpleFSDirectory(dir, null);
+                Directory luceneDir = new SimpleFSDirectory( dir.toPath() );
                 IndexReader reader = DirectoryReader.open(luceneDir);
                 searcher = new IndexSearcher(reader);
             }
diff --git a/jspwiki-main/src/test/java/org/apache/wiki/search/SearchManagerTest.java b/jspwiki-main/src/test/java/org/apache/wiki/search/SearchManagerTest.java
index 21f29e4..4aa37c9 100644
--- a/jspwiki-main/src/test/java/org/apache/wiki/search/SearchManagerTest.java
+++ b/jspwiki-main/src/test/java/org/apache/wiki/search/SearchManagerTest.java
@@ -83,7 +83,7 @@ public class SearchManagerTest {
 
             res = m_mgr.findPages( text, ctx );
 
-//            debugSearchResults( res );
+            // debugSearchResults( res );
         }
         return res;
     }
diff --git a/pom.xml b/pom.xml
index 92debe8..d469234 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,7 +62,7 @@
     <jrcs-diff.version>0.4.2</jrcs-diff.version>
     <junit.version>5.3.2</junit.version>
     <log4j.version>1.2.17</log4j.version>
-    <lucene.version>4.7.0</lucene.version>
+    <lucene.version>7.6.0</lucene.version>
     <nekohtml.version>1.9.21</nekohtml.version>
     <oro.version>2.0.8</oro.version>
     <sandler.version>0.5</sandler.version>


[jspwiki] 05/09: escape entities on Captcha.jsp request parameters

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 1e994c5184f3d17cf355983bbe870bcaebab4b9f
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Dec 25 13:07:47 2018 +0100

    escape entities on Captcha.jsp request parameters
---
 jspwiki-war/src/main/webapp/Captcha.jsp | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/jspwiki-war/src/main/webapp/Captcha.jsp b/jspwiki-war/src/main/webapp/Captcha.jsp
index 6789b2d..d720976 100644
--- a/jspwiki-war/src/main/webapp/Captcha.jsp
+++ b/jspwiki-war/src/main/webapp/Captcha.jsp
@@ -40,11 +40,12 @@
     if(!wiki.getAuthorizationManager().hasAccess( wikiContext, response )) return;
     String pagereq = wikiContext.getName();
 
-    String content = request.getParameter("text");
+    String reqPage = TextUtil.replaceEntities( request.getParameter( "page" ) );
+    String content = TextUtil.replaceEntities( request.getParameter( "text" ) );
 
     if( content != null )
     {
-        String ticket = request.getParameter("Asirra_Ticket");
+        String ticket = TextUtil.replaceEntities( request.getParameter( "Asirra_Ticket" ) );
         HttpClient client = new HttpClient();
         HttpMethod method = new GetMethod("http://challenge.asirra.com/cgi/Asirra?action=ValidateTicket&ticket="+ticket);
 
@@ -53,10 +54,10 @@
 
         if( status == HttpStatus.SC_OK )
         {
-            if( body.indexOf("Pass") != -1 )
+            if( body.indexOf( "Pass" ) != -1 )
             {
-                session.setAttribute("captcha","ok");
-                response.sendRedirect( wikiContext.getURL(WikiContext.EDIT, request.getParameter("page") ) );
+                session.setAttribute( "captcha", "ok" );
+                response.sendRedirect( wikiContext.getURL( WikiContext.EDIT, reqPage ) );
                 return;
             }
         }
@@ -65,7 +66,7 @@
     }
 
     // Set the content type and include the response content
-    response.setContentType("text/html; charset="+wiki.getContentEncoding() );
+    response.setContentType( "text/html; charset=" + wiki.getContentEncoding() );
 %>
 <html>
 
@@ -106,14 +107,15 @@
 
    <form action="<wiki:Link jsp='Captcha.jsp' format='url'/>" method="post" id="mainForm" style="display: none;">
       <input type="hidden" value="foo" name="text" />
-      <input type="hidden" value='<%=request.getParameter("page")%>' name='page'/>
+      <input type="hidden" value='<%=reqPage%>' name='page'/>
       <script type="text/javascript" src="http://challenge.asirra.com/js/AsirraClientSide.js"></script>
       <script type="text/javascript">
-         asirraState.SetEnlargedPosition("right");
-         // asirraState.SetCellsPerRow(6);
+         asirraState.SetEnlargedPosition( "right" );
+         // asirraState.SetCellsPerRow( 6 );
       </script>
       <br />
       <input type="button" value="<fmt:message key="captcha.submit" />" onclick="javascript:Asirra_CheckIfHuman(HumanCheckComplete)" />
   </form>
 </div>
-</body>
\ No newline at end of file
+</body>
+</html>
\ No newline at end of file


[jspwiki] 07/09: 2.11.0-M1-git-14

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 1057136227e8aa5bca62cbc5fcab9cedf4f9412b
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Dec 25 20:39:19 2018 +0100

    2.11.0-M1-git-14
---
 ChangeLog                                               | 12 ++++++++++++
 jspwiki-main/src/main/java/org/apache/wiki/Release.java |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index cb66b75..ed0d7e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2018-12-25  Juan Pablo Santos (juanpablo AT apache DOT org)
+
+       * 2.11.0-M1-git-14: upgrade bundled dependencies
+         - commons-fileupload to 1.3.3
+         - ehcache to 2.10.6
+         - flexmark to 0.35.0
+         - junit to 5.3.2
+         - lucene to 7.6.0
+         - tomcat to 8.5.37
+       
+       * escape entities on Captcha.jsp request parameters
+
 2018-12-24  Dirk Frederickx (brushed AT apache DOT org)
 
        * 2.11.0-M1-git-13: AJAX based search results are not shown.
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/Release.java b/jspwiki-main/src/main/java/org/apache/wiki/Release.java
index 27b3193..7c25722 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/Release.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/Release.java
@@ -72,7 +72,7 @@ public final class Release {
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "13";
+    public static final String     BUILD         = "14";
 
     /**
      *  This is the generic version string you should use when printing out the version.  It is of


[jspwiki] 03/09: minor refactor to avoid empty catch on closing inputstream

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 9f7c530aa4b40427900b09611ad10f31a785c624
Author: juanpablo <ju...@apache.org>
AuthorDate: Wed Dec 19 23:09:41 2018 +0100

    minor refactor to avoid empty catch on closing inputstream
---
 .../java/org/apache/wiki/ui/TemplateManager.java   | 46 ++++++----------------
 1 file changed, 11 insertions(+), 35 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/ui/TemplateManager.java b/jspwiki-main/src/main/java/org/apache/wiki/ui/TemplateManager.java
index 64ddc86..d606916 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/ui/TemplateManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/ui/TemplateManager.java
@@ -18,7 +18,6 @@
  */
 package org.apache.wiki.ui;
 
-import java.io.IOException;
 import java.io.InputStream;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -43,6 +42,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.jsp.PageContext;
 import javax.servlet.jsp.jstl.fmt.LocaleSupport;
 
+import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.apache.wiki.InternalWikiException;
@@ -157,22 +157,12 @@ public class TemplateManager extends ModuleManager {
      *  Check the existence of a template.
      */
     // FIXME: Does not work yet
-    public boolean templateExists( String templateName )
-    {
+    public boolean templateExists( String templateName ) {
         ServletContext context = m_engine.getServletContext();
-
         InputStream in = context.getResourceAsStream( getPath(templateName)+"ViewTemplate.jsp");
 
-        if( in != null )
-        {
-            try
-            {
-                in.close();
-            }
-            catch (IOException e)
-            {
-            }
-
+        if( in != null ) {
+            IOUtils.closeQuietly( in );
             return true;
         }
 
@@ -188,31 +178,17 @@ public class TemplateManager extends ModuleManager {
      *  @param name The name of the resource
      *  @return The name of the resource which was found.
      */
-    private static String findResource( ServletContext sContext, String name )
-    {
+    private static String findResource( ServletContext sContext, String name ) {
         InputStream is = sContext.getResourceAsStream( name );
 
-        if( is == null )
-        {
-            String defname = makeFullJSPName( DEFAULT_TEMPLATE,
-                                              removeTemplatePart(name) );
+        if( is == null ) {
+            String defname = makeFullJSPName( DEFAULT_TEMPLATE, removeTemplatePart(name) );
             is = sContext.getResourceAsStream( defname );
 
-            if( is != null )
-                name = defname;
-            else
-                name = null;
+            name = is != null ? defname : null;
         }
 
-        if( is != null )
-        {
-            try
-            {
-                is.close();
-            }
-            catch( IOException e )
-            {}
-        }
+        IOUtils.closeQuietly( is );
 
         return name;
     }
@@ -730,14 +706,14 @@ public class TemplateManager extends ModuleManager {
 
         if( resourcemap == null )
         {
-            resourcemap = new HashMap<String,Vector<String>>();
+            resourcemap = new HashMap<>();
         }
 
         Vector<String> resources = resourcemap.get( type );
 
         if( resources == null )
         {
-            resources = new Vector<String>();
+            resources = new Vector<>();
         }
 
         String resourceString = null;


[jspwiki] 09/09: update changelog

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 4dfe163d05799c0dc02c06f59f866a89a19dcaca
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Dec 25 21:47:04 2018 +0100

    update changelog
---
 ChangeLog | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index ed0d7e4..a6b0634 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,10 @@
        
        * escape entities on Captcha.jsp request parameters
 
+       * Jenkinsfile now builds both source and website, jspwiki-site job can still be triggered manually
+
+       * few more polishing and minor refactors
+
 2018-12-24  Dirk Frederickx (brushed AT apache DOT org)
 
        * 2.11.0-M1-git-13: AJAX based search results are not shown.