Return-Path: Delivered-To: apmail-incubator-jspwiki-commits-archive@locus.apache.org Received: (qmail 22195 invoked from network); 18 Nov 2008 17:43:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Nov 2008 17:43:54 -0000 Received: (qmail 54700 invoked by uid 500); 18 Nov 2008 17:44:03 -0000 Delivered-To: apmail-incubator-jspwiki-commits-archive@incubator.apache.org Received: (qmail 54687 invoked by uid 500); 18 Nov 2008 17:44:02 -0000 Mailing-List: contact jspwiki-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jspwiki-dev@incubator.apache.org Delivered-To: mailing list jspwiki-commits@incubator.apache.org Received: (qmail 54678 invoked by uid 99); 18 Nov 2008 17:44:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Nov 2008 09:44:02 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Nov 2008 17:42:49 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E16F223888AF; Tue, 18 Nov 2008 09:43:33 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r718663 - in /incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH: ChangeLog src/com/ecyrd/jspwiki/Release.java src/com/ecyrd/jspwiki/plugin/InsertPage.java tests/com/ecyrd/jspwiki/plugin/InsertPageTest.java Date: Tue, 18 Nov 2008 17:43:33 -0000 To: jspwiki-commits@incubator.apache.org From: metskem@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081118174333.E16F223888AF@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: metskem Date: Tue Nov 18 09:43:33 2008 New Revision: 718663 URL: http://svn.apache.org/viewvc?rev=718663&view=rev Log: 2.8.1-svn-15 JSPWIKI-415: Favorites not displayed properly when blank in userName, added 2 JUnit tests for InsertPage plugin Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/plugin/InsertPage.java incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/tests/com/ecyrd/jspwiki/plugin/InsertPageTest.java Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog?rev=718663&r1=718662&r2=718663&view=diff ============================================================================== --- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog (original) +++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog Tue Nov 18 09:43:33 2008 @@ -1,3 +1,11 @@ +2008-11-18 Harry Metske + + * 2.8.1-svn-15 + + * JSPWIKI-415: Favorites not displayed properly when blank in userName, reported by Trevor Harrison + Backport from 3.0 to 2.8 on request of Erik Bunn. + Added 2 JUnit tests for InsertPage plugin + 2008-11-15 Dirk Frederickx * 2.8.1-svn-14 Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java?rev=718663&r1=718662&r2=718663&view=diff ============================================================================== --- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java (original) +++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java Tue Nov 18 09:43:33 2008 @@ -77,7 +77,7 @@ *

* If the build identifier is empty, it is not added. */ - public static final String BUILD = "14"; + public static final String BUILD = "15"; /** * This is the generic version string you should use Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/plugin/InsertPage.java URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/plugin/InsertPage.java?rev=718663&r1=718662&r2=718663&view=diff ============================================================================== --- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/plugin/InsertPage.java (original) +++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/plugin/InsertPage.java Tue Nov 18 09:43:33 2008 @@ -23,6 +23,7 @@ import com.ecyrd.jspwiki.*; import com.ecyrd.jspwiki.auth.*; import com.ecyrd.jspwiki.auth.permissions.PermissionFactory; +import com.ecyrd.jspwiki.providers.ProviderException; import java.util.*; @@ -91,8 +92,24 @@ if( includedPage != null ) { - WikiPage page = engine.getPage( includedPage ); - + WikiPage page = null; + try + { + String pageName = engine.getFinalPageName( includedPage ); + if( pageName != null ) + { + page = engine.getPage( pageName ); + } + else + { + page = engine.getPage( includedPage ); + } + } + catch( ProviderException e ) + { + res.append( "Page could not be found by the page provider." ); + return res.toString(); + } if( page != null ) { Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/tests/com/ecyrd/jspwiki/plugin/InsertPageTest.java URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/tests/com/ecyrd/jspwiki/plugin/InsertPageTest.java?rev=718663&r1=718662&r2=718663&view=diff ============================================================================== --- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/tests/com/ecyrd/jspwiki/plugin/InsertPageTest.java (original) +++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/tests/com/ecyrd/jspwiki/plugin/InsertPageTest.java Tue Nov 18 09:43:33 2008 @@ -25,6 +25,8 @@ TestEngine.deleteTestPage( "ThisPage" ); TestEngine.deleteTestPage( "ThisPage2" ); TestEngine.deleteTestPage( "Test_Page" ); + TestEngine.deleteTestPage( "TestPage" ); + TestEngine.deleteTestPage( "Test Page" ); } public void testRecursive() throws Exception @@ -79,6 +81,32 @@ assertEquals( "found != 1", "

foo\n
\n", testEngine.getHTML("ThisPage") ); } + + /** + * a link containing a blank should work if there is a page with exact the + * same name ('Test Page') + */ + public void testWithBlanks1() throws Exception + { + testEngine.saveText( "ThisPage", "[{InsertPage page='Test Page'}]" ); + testEngine.saveText( "Test Page", "foo[{ALLOW view Anonymous}]" ); + + assertEquals( "found != 1", "
foo\n
\n", testEngine.getHTML( "ThisPage" ) ); + } + + /** + * same as testWithBlanks1, but it should still work if the page does not + * have the blank in it ( 'Test Page' should work if the included page is + * called 'TestPage') + */ + public void testWithBlanks2() throws Exception + { + testEngine.saveText( "ThisPage", "[{InsertPage page='Test Page'}]" ); + testEngine.saveText( "TestPage", "foo[{ALLOW view Anonymous}]" ); + + assertEquals( "found != 1", "
foo\n
\n", testEngine.getHTML( "ThisPage" ) ); + } + public static Test suite() { return new TestSuite( InsertPageTest.class );