portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r764814 - in /portals/jetspeed-2/portal/trunk: components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/window/impl/PortletWindowImpl.java pom.xml
Date Tue, 14 Apr 2009 15:03:12 GMT
Author: woonsan
Date: Tue Apr 14 15:03:12 2009
New Revision: 764814

URL: http://svn.apache.org/viewvc?rev=764814&view=rev
Log:
JS2-961: Filtering out redundant script lines when merging happens.

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/window/impl/PortletWindowImpl.java
    portals/jetspeed-2/portal/trunk/pom.xml

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/window/impl/PortletWindowImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/window/impl/PortletWindowImpl.java?rev=764814&r1=764813&r2=764814&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/window/impl/PortletWindowImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/window/impl/PortletWindowImpl.java
Tue Apr 14 15:03:12 2009
@@ -20,6 +20,8 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
 
 import javax.portlet.PortletMode;
 import javax.portlet.PortletRequest;
@@ -27,6 +29,7 @@
 import javax.portlet.WindowState;
 
 import org.apache.commons.collections.list.TreeList;
+import org.apache.commons.lang.StringUtils;
 import org.apache.jetspeed.aggregator.PortletContent;
 import org.apache.jetspeed.aggregator.RenderTrackable;
 import org.apache.jetspeed.container.PortletWindow;
@@ -369,7 +372,7 @@
     private static void mergeHeadElementsByHint( List<KeyValue<String, Element>>
headElements )
     {
         Map<String, Element> firstElementByMergeHint = new HashMap<String, Element>();
-        Map<String, StringBuilder> mergedTextContents = new HashMap<String, StringBuilder>();
+        Map<String, Set<String>> mergedTextContents = new HashMap<String,
Set<String>>();
         
         for (Iterator<KeyValue<String, Element>> it = headElements.iterator();
it.hasNext(); )
         {
@@ -390,8 +393,8 @@
                 {
                     if (textContent != null && !"".equals(textContent))
                     {
-                        StringBuilder sb = mergedTextContents.get(mergeHint);
-                        sb.append(textContent).append("\r\n");
+                        Set<String> textContentSet = mergedTextContents.get(mergeHint);
+                        textContentSet.add(textContent);
                     }
                     
                     it.remove();
@@ -399,14 +402,13 @@
                 else
                 {
                     firstElementByMergeHint.put(mergeHint, element);
-                    StringBuilder sb = new StringBuilder();
+                    Set<String> textContentSet = new TreeSet<String>();
+                    mergedTextContents.put(mergeHint, textContentSet);
                     
                     if (textContent != null && !"".equals(textContent))
                     {
-                        sb.append(textContent).append("\r\n");
+                        textContentSet.add(textContent);
                     }
-                    
-                    mergedTextContents.put(mergeHint, sb);
                 }
             }
         }
@@ -415,8 +417,8 @@
         {
             String mergeHint = entry.getKey();
             Element firstElement = entry.getValue();
-            StringBuilder sb = mergedTextContents.get(mergeHint);
-            firstElement.setTextContent(sb.toString());
+            Set<String> textContentSet = mergedTextContents.get(mergeHint);
+            firstElement.setTextContent(StringUtils.join(textContentSet, "\r\n"));
         }
     }
 

Modified: portals/jetspeed-2/portal/trunk/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/pom.xml?rev=764814&r1=764813&r2=764814&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/pom.xml (original)
+++ portals/jetspeed-2/portal/trunk/pom.xml Tue Apr 14 15:03:12 2009
@@ -282,7 +282,7 @@
     <commons-httpclient.version>3.0.1</commons-httpclient.version>
     <commons-io.version>1.4</commons-io.version>
     <commons-jexl.version>1.1</commons-jexl.version>
-    <commons-lang.version>2.1</commons-lang.version>
+    <commons-lang.version>2.4</commons-lang.version>
     <commons-logging.version>1.1</commons-logging.version>
     <commons-pool.version>1.3</commons-pool.version>
     <!-- ddlutils svn r551445 with patch applied from http://issues.apache.org/jira/browse/DDLUTILS-75#action_12521579
-->



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message