svn commit: r1781125 - /ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroTreeRenderer.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1781125 - /ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroTreeRenderer.java

jleroux@apache.org
Author: jleroux
Date: Tue Jan 31 17:24:01 2017
New Revision: 1781125

URL: http://svn.apache.org/viewvc?rev=1781125&view=rev
Log:
Fixed: Navigate Accounts tree does not work
(OFBIZ-9191)

This is due to a change in (at least) Tomcat 8.0.39

Here is a simple fix. I tried other ways but none worked and I prefer to keep
this simple.
Using an encoder at this stage (just before calling he macro is not an option.
Or maybe by using it on the linkurl variable alone. But then linkurl  must be
transformed in a string and  back to a StringBuilder or more refactoring is
needed.
Also using encode="true" for links in AccountingTrees.xml does not work.

This also removes trailing blanks (by hand)

Thanks: Moatasim Al Masri for report

Modified:
    ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroTreeRenderer.java

Modified: ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroTreeRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroTreeRenderer.java?rev=1781125&r1=1781124&r2=1781125&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroTreeRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroTreeRenderer.java Tue Jan 31 17:24:01 2017
@@ -224,7 +224,7 @@ public class MacroTreeRenderer implement
 
     public void renderLastElement(Appendable writer, Map<String, Object> context, ModelTree.ModelNode node) throws IOException {
         Boolean processChildren = (Boolean) context.get("processChildren");
-        if (processChildren.booleanValue()) {            
+        if (processChildren.booleanValue()) {
             StringWriter sr = new StringWriter();
             sr.append("<@renderLastElement ");
             sr.append("style=\"");
@@ -246,9 +246,9 @@ public class MacroTreeRenderer implement
         sr.append("\" style=\"");
         sr.append(style);
         sr.append("\" labelText=\"");
-        sr.append(labelText);        
+        sr.append(labelText);
         sr.append("\" />");
-        executeMacro(sr.toString());        
+        executeMacro(sr.toString());
     }
 
     public void renderLink(Appendable writer, Map<String, Object> context, ModelTree.ModelNode.Link link) throws IOException {
@@ -259,8 +259,8 @@ public class MacroTreeRenderer implement
         
         if (UtilValidate.isNotEmpty(target)) {
             WidgetWorker.buildHyperlinkUrl(linkUrl, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context),
-                    link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context);            
-        }        
+                    link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context);
+        }
         
         String id = link.getId(context);
         String style = link.getStyle(context);
@@ -288,20 +288,20 @@ public class MacroTreeRenderer implement
         sr.append("\" title=\"");
         sr.append(title);
         sr.append("\" targetWindow=\"");
-        sr.append(targetWindow);  
+        sr.append(targetWindow);
         sr.append("\" linkUrl=\"");
-        sr.append(linkUrl);    
+        sr.append(linkUrl);
         sr.append("\" linkText=\"");
-        sr.append(linkText);          
+        sr.append(linkText);
         sr.append("\" imgStr=\"");
         sr.append(imgStr.replaceAll("\"", "\\\\\""));
         sr.append("\" />");
-        executeMacro(sr.toString());
+        executeMacro(sr.toString().replace("|", "%7C")); // Fix for OFBIZ-9191
     }
   
     public void renderImage(Appendable writer, Map<String, Object> context, ModelTree.ModelNode.Image image) throws IOException {
         if (image == null) {
-            return ;            
+            return;
         }
         HttpServletResponse response = (HttpServletResponse) context.get("response");
         HttpServletRequest request = (HttpServletRequest) context.get("request");
@@ -357,7 +357,7 @@ public class MacroTreeRenderer implement
         sr.append("\" urlString=\"");
         sr.append(urlString);
         sr.append("\" />");
-        executeMacro(sr.toString());        
+        executeMacro(sr.toString());
     }
 
     public ScreenStringRenderer getScreenStringRenderer(Map<String, Object> context) {