You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by me...@apache.org on 2011/04/03 18:52:29 UTC

svn commit: r1088332 - in /incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH: ./ src/com/ecyrd/jspwiki/ src/com/ecyrd/jspwiki/parser/ src/com/ecyrd/jspwiki/render/ tests/com/ecyrd/jspwiki/parser/

Author: metskem
Date: Sun Apr  3 16:52:29 2011
New Revision: 1088332

URL: http://svn.apache.org/viewvc?rev=1088332&view=rev
Log:
2.8.5-svn-6   fixed JSPWIKI-688 (Poor performance of CreoleToJSPWikiTranslator), thanks to Jelmer Kuperus.

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/parser/CreoleToJSPWikiTranslator.java
    incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/render/CreoleRenderer.java
    incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/tests/com/ecyrd/jspwiki/parser/CreoleToJSPWikiTranslatorTest.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=1088332&r1=1088331&r2=1088332&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog Sun Apr  3 16:52:29 2011
@@ -1,3 +1,9 @@
+2011-04-03  Harry Metske <me...@apache.org>
+
+        * 2.8.5-svn-6
+        
+        * fixed JSPWIKI-688 (Poor performance of CreoleToJSPWikiTranslator), thanks to Jelmer Kuperus.
+        
 2011-01-24  Harry Metske <me...@apache.org>
 
         * 2.8.5-svn-5

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=1088332&r1=1088331&r2=1088332&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 Sun Apr  3 16:52:29 2011
@@ -77,7 +77,7 @@ public final class Release
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "5";
+    public static final String     BUILD         = "6";
     
     /**
      *  This is the generic version string you should use

Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/parser/CreoleToJSPWikiTranslator.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/parser/CreoleToJSPWikiTranslator.java?rev=1088332&r1=1088331&r2=1088332&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/parser/CreoleToJSPWikiTranslator.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/parser/CreoleToJSPWikiTranslator.java Sun Apr  3 16:52:29 2011
@@ -148,7 +148,7 @@ public class CreoleToJSPWikiTranslator
 
     private static final String JSPWIKI_IMAGE_X = "[{\u2016 src='$1' caption='$4' \u2015}]";
 
-    private static final String CREOLE_LINK_IMAG_X = "\\[\\[(.*?)\\|\\{\\{(.*?)((\\|)(.*?)){0,1}((\\|)(.*?)){0,1}\\}\\}\\]\\]";
+    private static final String CREOLE_LINK_IMAG_X = "\\[\\[([^|]*)\\|\\{\\{([^|]*)((\\|)([^|]*)){0,1}((\\|)([^}]*)){0,1}\\}\\}\\]\\]";
 
     private static final String JSPWIKI_LINK_IMAGE_X = "[{\u2016 src='$2' link='$1' caption='$5' \u2015}]";
 

Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/render/CreoleRenderer.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/render/CreoleRenderer.java?rev=1088332&r1=1088331&r2=1088332&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/render/CreoleRenderer.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/render/CreoleRenderer.java Sun Apr  3 16:52:29 2011
@@ -84,8 +84,6 @@ public class CreoleRenderer extends Wiki
     /**
      *  Creates a new Creole Renderer.
      *  
-     *  @param ctx {@inheritDoc}
-     *  @param doc {@inheritDoc}
      */
     public CreoleRenderer( WikiContext ctx, WikiDocument doc )
     {

Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/tests/com/ecyrd/jspwiki/parser/CreoleToJSPWikiTranslatorTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/tests/com/ecyrd/jspwiki/parser/CreoleToJSPWikiTranslatorTest.java?rev=1088332&r1=1088331&r2=1088332&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/tests/com/ecyrd/jspwiki/parser/CreoleToJSPWikiTranslatorTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/tests/com/ecyrd/jspwiki/parser/CreoleToJSPWikiTranslatorTest.java Sun Apr  3 16:52:29 2011
@@ -833,6 +833,34 @@ public class CreoleToJSPWikiTranslatorTe
         assertEquals(target, translate(src));
     }
 
+    /**
+     * See issue JSPWIKI-688 for details. 
+     * (before the patch it took about 50 seconds on an Intel Core 2 to complete, after the patch : 0.2 seconds).
+     */
+    public void testJSPWIKI688()
+    {
+        CreoleToJSPWikiTranslator translator = new CreoleToJSPWikiTranslator();
+
+        Properties props = new Properties();
+        props.setProperty( "creole.imagePlugin.para.XL", "width='540'" );
+        props.setProperty( "creole.imagePlugin.para.XXL", "width='1024'" );
+        props.setProperty( "creole.imagePlugin.para.S", "width='140'" );
+        props.setProperty( "creole.imagePlugin.para.M", "width='180'" );
+        props.setProperty( "creole.imagePlugin.para.L", "width='360'" );
+        props.setProperty( "creole.imagePlugin.name", "Image" );
+        props.setProperty( "creole.imagePlugin.para.%px", "width='%px\"" );
+
+        String content = "//Note: Please see the [[http://liferay.com/community/100-papercuts|main landing page]] for the latest updates.//<<TableOfContents>>== Introduction ==This project's aim is to identify and fix high-visibility, easy to correct bugs in Liferay Portal. It is driven by the wider Liferay community, with volunteers working to identify, prioritize, assign, and resolve known issues.== The Process ==# **Identify issues.**  The community has always been encouraged to vote for issues that they would like to see fixed sooner rather than later.  This has allowed Liferay program managers to properly prioritize bugs based on community feedback.  With the 100 Paper Cuts program, voting has become even more important.  We use the same voting system to identify high visibility, easy-to-fix bugs.  The 100 Paper Cuts process begins with a period of time in which additional voting is encouraged.  If you wish to vote for issues, please read the voting process.  You
  can also [[http://issues.liferay.com/secure/IssueNavigator.jspa?mode=hide&requestId=12340|browse this filter for potential PaperCuts bugs]].  This fiter shows all open bugs that haven't been already selected for inclusion into the existing Liferay development pipeline, sorted by votes.# **Assign and Fix.**  During a 2-week period, approximately 10 issues are selected and fixed based on their impact and effort required to fix.  We aim for selecting bugs that take no more than 1 developer-day to fix.  This period is called a \"Community Sprint\" and represents a fixed time amount in which to fix the identified issues.  Once the sprint period is over, the process is repeated.# **Track progress.**  During and after the sprint, issues are tracked for progress, until the issue is merged with one or more Liferay releases.== Current Sprint Status ==|=Resolved|=In Progress|=Blocked on submitter|=Warning!|=Unfixable/Not a papercut||{{http://cdn.www.liferay.com/osb-theme/images/
 dock/my_place_current.png}}|{{../../../c/wiki/get_page_attachment?p_l_id=10171&nodeId=10304&title=&fileName=SharedImages/health-80plus.gif}}|{{../../../c/wiki/get_page_attachment?p_l_id=10171&nodeId=10304&title=&fileName=SharedImages/health-40to59.png}}|{{../../../c/wiki/get_page_attachment?p_l_id=10171&nodeId=10304&title=&fileName=SharedImages/warning.gif}}|{{../../../c/wiki/get_page_attachment?p_l_id=10171&nodeId=10304&title=&fileName=SharedImages/red.gif}}|=== Sprint 3: Mar 16, 2011 - Mar 30, 2011 ===|= Issue |= Summary |= Assigned To |= Status |= Indicator || [[http://issues.liferay.com/browse/LPS-15491 |LPS-15491]] | Automatic \"html linkification\" of text http links in message board posts: [[http://liferay.com/|http://liferay.com]] => <a href=\"[[http://lliferay.com\">http//lliferay.com</a>|http://lliferay.com\">http://lliferay.com</a>]] | Baptiste | Open | {{../../../c/wiki/get_page_attachment?p_l_id=10171&nodeId=10304&title=&fileName=SharedImages/warning.gif}}|| [[h
 ttp://issues.liferay.com/browse/LPS-9157 |LPS-9157]] | Width of the panel shouldn't be changed| Maarten | Contributed Solution | {{http://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|| [[http://issues.liferay.com/browse/LPS-15494 |LPS-15494]] | Showing search result content in inappropriate layout| Juan | Contributed Solution | {{../../../c/wiki/get_page_attachment?p_l_id=10171&nodeId=10304&title=&fileName=http://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|| [[http://issues.liferay.com/browse/LPS-15791 |LPS-15791]] | Pagination is lost after editing permissions in the Define Permission action of Roles admin portlet| Rafal | Contributed Solution | {{http://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|| [[http://issues.liferay.com/browse/LPS-8968 |LPS-8968]] | Web Proxy fails with error.httpclient in Glassfish| Deb | Contributed Solution | {{../../../c/wiki/get_page_attachment?p_l_id=10171&nodeId=10304&title=&fileNam
 e=http://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|| [[http://issues.liferay.com/browse/LPS-15677 |LPS-15677]] | Asset Publisher portlet does not display web content, When the content publish again.| Boubker | Contributed Solution | {{http://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|| [[http://issues.liferay.com/browse/LPS-15225 |LPS-15225]] | String not internationalized in Enterprise Admin Organizations portlet.| Corne | Community Resolved| {{../../../c/wiki/get_page_attachment?p_l_id=10171&nodeId=10304&title=&fileName=http://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|| [[http://issues.liferay.com/browse/LPS-15122 |LPS-15122]] | o language key for \"Table of Contents\" in the wiki | Corne | Contributed Solution| {{http://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|| [[http://issues.liferay.com/browse/LPS-14789 |LPS-14789]] | Freemarker template processor has undefined variables | Tomas
  | Contributed Solution | {{../../../c/wiki/get_page_attachment?p_l_id=10171&nodeId=10304&title=&fileName=http://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|== Previous Sprint Status ===== Sprint 2: Feb 23, 2011 - Mar 9, 2011 ===|= Issue |= Summary |= Assigned To |= Status |= Indicator || [[http://issues.liferay.com/browse/LEP-6973 |LEP-6973]] | Publish to Live is not properly configuring Page Permissions from Staging | Boubker | Contributed Solution | {{http://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|| [[http://issues.liferay.com/browse/LPS-12988 |LPS-12988]] | Bad HTTP Content-Type for RSS feed | Jelmer | Contributed Solution | {{../../../c/wiki/get_page_attachment?p_l_id=10171&nodeId=10304&title=&fileName=http://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|| [[http://issues.liferay.com/browse/LPS-10263 |LPS-10263]] | Remove the mandatory URL from announcements entries | Jaromir | Contributed Solution | {{htt
 p://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|| [[http://issues.liferay.com/browse/LPS-11854 |LPS-11854]] | Web Form Portlet Configuration -- Changing type field does not appear to work at all in IE8. | Deb | Contributed Solution | {{../../../c/wiki/get_page_attachment?p_l_id=10171&nodeId=10304&title=&fileName=http://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|| [[http://issues.liferay.com/browse/LPS-12918 |LPS-12918]] | Import lar with global \"Structures/Templates\" | Jelmer | Contributed Solution | {{http://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|| [[http://issues.liferay.com/browse/LPS-11479 |LPS-11479]] | ServiceBuilder doesn't support one-to-one relationships out of the box | Tomas | Open | {{../../../c/wiki/get_page_attachment?p_l_id=10171&nodeId=10304&title=&fileName=SharedImages/red.gif}}|| [[http://issues.liferay.com/browse/LPS-7503 |LPS-7503]] | Give alternatives to <object> | Juan | Open | {{../
 ../../c/wiki/get_page_attachment?p_l_id=10171&nodeId=10304&title=&fileName=SharedImages/red.gif}}|| [[http://issues.liferay.com/browse/LPS-14905 |LPS-14905]] | Unable to import group from LDAP in Liferay 6.0.5 with ldap.import.method=user | Baptiste | Resolved | {{http://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|=== Sprint 1: Feb 2, 2011 - Feb 16, 2011 ===|= Issue |= Summary |= Assigned To |= Status |= Indicator || [[http://issues.liferay.com/browse/LPS-11003|LPS-11003]] | sample-struts-liferay-portlet can not be deployed to trunk | James | Closed (not reproducible) | {{../../../c/wiki/get_page_attachment?p_l_id=10171&nodeId=10304&title=&fileName=http://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|| [[http://issues.liferay.com/browse/LPS-13422|LPS-13422]] | Preformatted URLS show with \"[ ]\" around them on a wiki page | Milan | Fixed | {{http://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|| [[http://issues.lifer
 ay.com/browse/LPS-14911|LPS-14911]] | Unable to publish previously saved draft | Deb | Community Resolved | {{../../../c/wiki/get_page_attachment?p_l_id=10171&nodeId=10304&title=&fileName=http://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|| [[http://issues.liferay.com/browse/LPS-14671|LPS-14671]] | When adding a document to the document library a file extension is required in the document title | Corne | Closed (already fixed) | {{http://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|| [[http://issues.liferay.com/browse/LPS-14411|LPS-14411]] | complete_gradient.png is missing | Boubker | In Review | {{../../../c/wiki/get_page_attachment?p_l_id=10171&nodeId=10304&title=&fileName=http://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|| [[http://issues.liferay.com/browse/LPS-14351|LPS-14351]] | Liferay Calendar, Duplicate Events Upon Import | Tomas | Contributed Solution | {{http://cdn.www.liferay.com/osb-theme/images/dock
 /my_place_current.png}}|| [[http://issues.liferay.com/browse/LPS-12988|LPS-12988]] | Bad HTTP Content-Type for RSS feed | Maarten | Open | {{../../../c/wiki/get_page_attachment?p_l_id=10171&nodeId=10304&title=&fileName=SharedImages/red.gif}}|| [[http://issues.liferay.com/browse/LPS-12810|LPS-12810]] | Error on Summary Tab of Calendar | Juan | Fixed | {{http://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|| [[http://issues.liferay.com/browse/LPS-11859|LPS-11859]] | Categories Navigation with Wiki Broken | Juan | Contributed Solution | {{../../../c/wiki/get_page_attachment?p_l_id=10171&nodeId=10304&title=&fileName=http://cdn.www.liferay.com/osb-theme/images/dock/my_place_current.png}}|| [[http://issues.liferay.com/browse/LPS-11854|LPS-11854]] | Web Form Portlet Configuration -- Changing type field does not appear to work at all in IE8. | Szymon | Open | {{../../../c/wiki/get_page_attachment?p_l_id=10171&nodeId=10304&title=&fileName=SharedImages/warning.gif}}
 |";
+
+        long startTime = System.currentTimeMillis();
+        translator.translate( props, content );
+        long testDuration = System.currentTimeMillis() - startTime;
+        
+        // even a very slow cpu should do this much faster
+        assertTrue( "rendering takes too long", testDuration < 3000 );
+
+    }
+    
     public String translate(String src)
     {
         CreoleToJSPWikiTranslator translator = new CreoleToJSPWikiTranslator();