cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <scher...@gmail.com>
Subject Re: REST view and weird error
Date Wed, 27 Feb 2013 00:18:28 GMT
On 02/26/2013 04:36 PM, Francesco Chicchiriccò wrote:
>
>>> as you have already found, the problem is the "cocoon" entry in the
>>> sitemap's ObjectModel, always passed among parameters.
>>>
>>> I have been able to actually print the content of the "cocoon" entry
>>> via common-collection's MapUtils:
>>>
>>>                  if (entry.getValue() instanceof Map) {
>>>                      MapUtils.verbosePrint(System.out, null,
>>> parameters);
>>>                  } else {
>>>                      System.out.println(entry.getValue());
>>>                  }
>>>
>>> I am about to commit a fix for the issue in STRenderer you've reported
>>> above based on the usage of MapUtils#verbosePrint()
>> Nice you are a "monstruo".
>
> Hem, guess you mean "mostro" (a.k.a. monster) - I'll take as a
> compliment ;-)

Definitely here in the south of spain we use it as compliment for a
person/friend which is usually accomplishing BIG things.

>
> Anyway as per r1450217 the StackOverflowError is removed from STRenderer.
>

Thank you very much, so awesome.

I had some problems to find the "important" change though between the
checkstyle/formating changes. It would be great if you could separate
those in the future. Anyway as I understand the most important change is:

Modified: cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/STRenderer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/STRenderer.java?rev=1450217&r1=1450216&r2=1450217&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/STRenderer.java
(original)
+++ cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/STRenderer.java
Tue Feb 26 15:31:18 2013
@@ -17,7 +17,10 @@
 package org.apache.cocoon.stringtemplate;
 
 import java.io.IOException;
+import java.io.PrintStream;
 import java.util.Map;
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.io.output.ByteArrayOutputStream;
 import org.apache.commons.lang3.StringEscapeUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -58,8 +61,18 @@ public final class STRenderer {
                         ? StringEscapeUtils.escapeXml(entry.getValue().toString())
                         : entry.getValue());
 
-                LOG.debug("Passing pipeline parameter as attribute: key={}, value={}",
-                        entry.getKey(), entry.getValue());
+                if (LOG.isDebugEnabled()) {
+                    final String value;
+                    if (entry.getValue() instanceof Map) {
+                        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                        MapUtils.verbosePrint(new PrintStream(baos), null, parameters);
+                        baos.flush();
+                        value = baos.toString();
+                    } else {
+                        value = entry.getValue().toString();
+                    }
+                    LOG.debug("Passing parameter as ST attribute: key={}, value={}", entry.getKey(),
value);
+                }
             }
         }
 



>> Let us see whether that gets rid of the redundant data as well.
>
> I've been exploring a bit the various call and I think that this
> duplication might be generated when intra-pipeline calls (e.g.
> "servlet:/") are issued.
>

Yeah that definitely makes sense since some props where the same but
other not e.g.
source=file:/home/thorsten/src/codebusters/CLIENT/c3-extractor/src/main/resources/COB-INF/resources/views/admin.xhtml,
only appears once (which is the view called by the controller via
servlet:/ ...)

Thanks again Francesco and as well for your latest bugfixing run. :)

salu2

-- 
Thorsten Scherler <scherler.at.gmail.com>
codeBusters S.L. - web based systems
<consulting, training and solutions>

http://www.codebusters.es/


Mime
View raw message