Discussion:
REST view and weird error
Thorsten Scherler
2013-02-22 09:13:05 UTC
Permalink
Hi all,

in one view of a REST service of mine I get:

SLF4J: Failed toString() invocation on an object of type [java.util.HashMap]
java.lang.StackOverflowError
at
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:639)
at java.lang.StringBuilder.append(StringBuilder.java:224)
at
org.apache.cocoon.configuration.MutableSettings.toString(MutableSettings.java:312)
at java.lang.String.valueOf(String.java:2902)
...
at java.lang.StringBuilder.append(StringBuilder.java:128)
at java.util.AbstractMap.toString(AbstractMap.java:523)
at java.lang.String.valueOf(String.java:2902)

where the last 3 lines will repeat a lot till the end.

I am doing:

@Override
public RestResponse doGet() throws Exception {
HashMap<String, Object> data = new HashMap<String, Object>();
data.put("properties", getProps());
return new URLResponse(VIEW, data);
}

where getProps() basically is a helper for getting
this.settings.getProperties.

As soon I do return new URLResponse(VIEW) the error is gone.

I have the standard logging activated (via rcl-config), using jetty:run
and no override for es.codebusters.droids.rest.DroidsInvoker in my
logback.xml

<root>
<level value="WARN"/>
<appender-ref ref="CORE"/>
</root>

Any ideas?

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

http://www.codebusters.es/
Robby Pelssers
2013-02-22 10:53:39 UTC
Permalink
Hi Thorsten,

Just one question.

I'm a making a few assumptions here but is Settings not a HashMap already? Can't you just do

@Override
public RestResponse doGet() throws Exception {
return new URLResponse(VIEW, getProps());
}

I don’t see the point in putting a hashmap in another hashmap just for the sake of it ;-)

Robby

-----Original Message-----
From: Thorsten Scherler [mailto:***@gmail.com]
Sent: Friday, February 22, 2013 10:13 AM
To: ***@cocoon.apache.org
Subject: REST view and weird error

Hi all,

in one view of a REST service of mine I get:

SLF4J: Failed toString() invocation on an object of type [java.util.HashMap] java.lang.StackOverflowError
at
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:639)
at java.lang.StringBuilder.append(StringBuilder.java:224)
at
org.apache.cocoon.configuration.MutableSettings.toString(MutableSettings.java:312)
at java.lang.String.valueOf(String.java:2902)
...
at java.lang.StringBuilder.append(StringBuilder.java:128)
at java.util.AbstractMap.toString(AbstractMap.java:523)
at java.lang.String.valueOf(String.java:2902)

where the last 3 lines will repeat a lot till the end.

I am doing:

@Override
public RestResponse doGet() throws Exception {
HashMap<String, Object> data = new HashMap<String, Object>();
data.put("properties", getProps());
return new URLResponse(VIEW, data);
}

where getProps() basically is a helper for getting this.settings.getProperties.

As soon I do return new URLResponse(VIEW) the error is gone.

I have the standard logging activated (via rcl-config), using jetty:run and no override for es.codebusters.droids.rest.DroidsInvoker in my logback.xml

<root>
<level value="WARN"/>
<appender-ref ref="CORE"/>
</root>

Any ideas?

salu2

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

http://www.codebusters.es/
Nathaniel, Alfred
2013-02-22 14:07:01 UTC
Permalink
Wild guess: somewhere you add the map to itself

map.put("map", map);

creating an infinite recursion in map.toString().

HTH, Alfred.

-----Original Message-----
From: Robby Pelssers [mailto:***@nxp.com]
Sent: Freitag, 22. Februar 2013 11:54
To: ***@cocoon.apache.org
Subject: RE: REST view and weird error

Hi Thorsten,

Just one question.

I'm a making a few assumptions here but is Settings not a HashMap already? Can't you just do

@Override
public RestResponse doGet() throws Exception {
return new URLResponse(VIEW, getProps());
}

I don't see the point in putting a hashmap in another hashmap just for the sake of it ;-)

Robby

-----Original Message-----
From: Thorsten Scherler [mailto:***@gmail.com]
Sent: Friday, February 22, 2013 10:13 AM
To: ***@cocoon.apache.org
Subject: REST view and weird error

Hi all,

in one view of a REST service of mine I get:

SLF4J: Failed toString() invocation on an object of type [java.util.HashMap] java.lang.StackOverflowError
at
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:639)
at java.lang.StringBuilder.append(StringBuilder.java:224)
at
org.apache.cocoon.configuration.MutableSettings.toString(MutableSettings.java:312)
at java.lang.String.valueOf(String.java:2902)
...
at java.lang.StringBuilder.append(StringBuilder.java:128)
at java.util.AbstractMap.toString(AbstractMap.java:523)
at java.lang.String.valueOf(String.java:2902)

where the last 3 lines will repeat a lot till the end.

I am doing:

@Override
public RestResponse doGet() throws Exception {
HashMap<String, Object> data = new HashMap<String, Object>();
data.put("properties", getProps());
return new URLResponse(VIEW, data);
}

where getProps() basically is a helper for getting this.settings.getProperties.

As soon I do return new URLResponse(VIEW) the error is gone.

I have the standard logging activated (via rcl-config), using jetty:run and no override for es.codebusters.droids.rest.DroidsInvoker in my logback.xml

<root>
<level value="WARN"/>
<appender-ref ref="CORE"/>
</root>

Any ideas?

salu2

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

http://www.codebusters.es/



The content of this e-mail is intended only for the confidential use of the person addressed.
If you are not the intended recipient, please notify the sender and delete this email immediately.
Thank you.
Robby Pelssers
2013-02-22 14:10:47 UTC
Permalink
I'd say no...

He does first create a new map called 'data'
HashMap<String, Object> data = new HashMap<String, Object>();

And next he puts the Props map in data

data.put("properties", getProps());


And next he passes the map to the view.
return new URLResponse(VIEW, data);

But obviously creating that data map is of no use. And secondly... suppose he wants to keep his hands of the original Props map, he should copy all values over toe the new data map instead of putting the map in the map.

Robby


-----Original Message-----
From: Nathaniel, Alfred [mailto:***@six-group.com]
Sent: Friday, February 22, 2013 3:07 PM
To: '***@cocoon.apache.org'
Subject: RE: REST view and weird error

Wild guess: somewhere you add the map to itself

map.put("map", map);

creating an infinite recursion in map.toString().

HTH, Alfred.

-----Original Message-----
From: Robby Pelssers [mailto:***@nxp.com]
Sent: Freitag, 22. Februar 2013 11:54
To: ***@cocoon.apache.org
Subject: RE: REST view and weird error

Hi Thorsten,

Just one question.

I'm a making a few assumptions here but is Settings not a HashMap already? Can't you just do

@Override
public RestResponse doGet() throws Exception {
return new URLResponse(VIEW, getProps());
}

I don't see the point in putting a hashmap in another hashmap just for the sake of it ;-)

Robby

-----Original Message-----
From: Thorsten Scherler [mailto:***@gmail.com]
Sent: Friday, February 22, 2013 10:13 AM
To: ***@cocoon.apache.org
Subject: REST view and weird error

Hi all,

in one view of a REST service of mine I get:

SLF4J: Failed toString() invocation on an object of type [java.util.HashMap] java.lang.StackOverflowError
at
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:639)
at java.lang.StringBuilder.append(StringBuilder.java:224)
at
org.apache.cocoon.configuration.MutableSettings.toString(MutableSettings.java:312)
at java.lang.String.valueOf(String.java:2902)
...
at java.lang.StringBuilder.append(StringBuilder.java:128)
at java.util.AbstractMap.toString(AbstractMap.java:523)
at java.lang.String.valueOf(String.java:2902)

where the last 3 lines will repeat a lot till the end.

I am doing:

@Override
public RestResponse doGet() throws Exception {
HashMap<String, Object> data = new HashMap<String, Object>();
data.put("properties", getProps());
return new URLResponse(VIEW, data);
}

where getProps() basically is a helper for getting this.settings.getProperties.

As soon I do return new URLResponse(VIEW) the error is gone.

I have the standard logging activated (via rcl-config), using jetty:run and no override for es.codebusters.droids.rest.DroidsInvoker in my logback.xml

<root>
<level value="WARN"/>
<appender-ref ref="CORE"/>
</root>

Any ideas?

salu2

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

http://www.codebusters.es/



The content of this e-mail is intended only for the confidential use of the person addressed.
If you are not the intended recipient, please notify the sender and delete this email immediately.
Thank you.
Thorsten Scherler
2013-02-25 11:08:47 UTC
Permalink
Hi all,

actually I tried with

HashMap<String, Object> data = new HashMap<String, Object>();
data.put("xxx", "xxx");
return new URLResponse(VIEW, data);

so not really a problem of the hashmap within hasmap. Further I need to
inject the hashmap to do in my view:

<div id="properties" class="tab_content">
<dl>
$properties.keys:{k|
<dt>$k$</dt>
<dd>
<![CDATA[$properties.(k)$]]>
</dd>
}$
</dl>
</div>

As soon I add a map to the response I get the stackoverflow.

I will now play a bit with the log config.

BTW thanks for the feedback.

salu2
Post by Robby Pelssers
I'd say no...
He does first create a new map called 'data'
HashMap<String, Object> data = new HashMap<String, Object>();
And next he puts the Props map in data
data.put("properties", getProps());
And next he passes the map to the view.
return new URLResponse(VIEW, data);
But obviously creating that data map is of no use. And secondly... suppose he wants to keep his hands of the original Props map, he should copy all values over toe the new data map instead of putting the map in the map.
Robby
-----Original Message-----
Sent: Friday, February 22, 2013 3:07 PM
Subject: RE: REST view and weird error
Wild guess: somewhere you add the map to itself
map.put("map", map);
creating an infinite recursion in map.toString().
HTH, Alfred.
-----Original Message-----
Sent: Freitag, 22. Februar 2013 11:54
Subject: RE: REST view and weird error
Hi Thorsten,
Just one question.
I'm a making a few assumptions here but is Settings not a HashMap already? Can't you just do
@Override
public RestResponse doGet() throws Exception {
return new URLResponse(VIEW, getProps());
}
I don't see the point in putting a hashmap in another hashmap just for the sake of it ;-)
Robby
-----Original Message-----
Sent: Friday, February 22, 2013 10:13 AM
Subject: REST view and weird error
Hi all,
SLF4J: Failed toString() invocation on an object of type [java.util.HashMap] java.lang.StackOverflowError
at
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:639)
at java.lang.StringBuilder.append(StringBuilder.java:224)
at
org.apache.cocoon.configuration.MutableSettings.toString(MutableSettings.java:312)
at java.lang.String.valueOf(String.java:2902)
...
at java.lang.StringBuilder.append(StringBuilder.java:128)
at java.util.AbstractMap.toString(AbstractMap.java:523)
at java.lang.String.valueOf(String.java:2902)
where the last 3 lines will repeat a lot till the end.
@Override
public RestResponse doGet() throws Exception {
HashMap<String, Object> data = new HashMap<String, Object>();
data.put("properties", getProps());
return new URLResponse(VIEW, data);
}
where getProps() basically is a helper for getting this.settings.getProperties.
As soon I do return new URLResponse(VIEW) the error is gone.
I have the standard logging activated (via rcl-config), using jetty:run and no override for es.codebusters.droids.rest.DroidsInvoker in my logback.xml
<root>
<level value="WARN"/>
<appender-ref ref="CORE"/>
</root>
Any ideas?
salu2
--
Thorsten Scherler <scherler.at.gmail.com> codeBusters S.L. - web based systems <consulting, training and solutions>
http://www.codebusters.es/
The content of this e-mail is intended only for the confidential use of the person addressed.
If you are not the intended recipient, please notify the sender and delete this email immediately.
Thank you.
--
Thorsten Scherler <scherler.at.gmail.com>
codeBusters S.L. - web based systems
<consulting, training and solutions>

http://www.codebusters.es/
Thorsten Scherler
2013-02-25 11:36:46 UTC
Permalink
Post by Thorsten Scherler
Hi all,
actually I tried with
HashMap<String, Object> data = new HashMap<String, Object>();
data.put("xxx", "xxx");
return new URLResponse(VIEW, data);
so not really a problem of the hashmap within hasmap. Further I need to
<div id="properties" class="tab_content">
<dl>
$properties.keys:{k|
<dt>$k$</dt>
<dd>
<![CDATA[$properties.(k)$]]>
</dd>
}$
</dl>
</div>
As soon I add a map to the response I get the stackoverflow.
I will now play a bit with the log config.
BTW thanks for the feedback.
<logger name="org.apache.cocoon" additivity="false">
<level value="WARN"/>
<appender-ref ref="CORE"/>
</logger>

Gets rid of the error.

The final source of the error is MutableSettings
(cocoon-configuration-api-1.0.4.jar) where we have

public String toString() {
return "Settings:\n" +
"Running mode : " + this.getRunningMode()+ '\n' +
KEY_RELOAD_DELAY + " : " + this.getReloadDelay(null) + '\n' +
KEY_RELOADING + " : " + this.isReloadingEnabled(null) + '\n' +
KEY_LOAD_CLASSES + " : " +
this.toString(this.getLoadClasses()) + '\n' +
KEY_CACHE_DIRECTORY + " : " + this.getCacheDirectory() + '\n' +
KEY_WORK_DIRECTORY + " : " + this.getWorkDirectory() + '\n' +
KEY_FORM_ENCODING + " : " + this.getFormEncoding() + '\n' +
KEY_CONTAINER_ENCODING + " : " + this.getContainerEncoding() +
'\n';
}

protected String toString(List a) {
final StringBuffer buffer = new StringBuffer();
final Iterator i = a.iterator();
boolean first = true;
while ( i.hasNext() ) {
if ( first ) {
first = false;
} else {
buffer.append(", ");
}
buffer.append(i.next());
}
return buffer.toString();
}

The whole things points to the latter method which is based on the
protected final List loadClasses = new ArrayList();

In the following we add values:

/**
* Fill from a properties object
*/
public void configure(Properties props) {
...
} else if ( key.startsWith(KEY_LOAD_CLASSES) ) {
this.addToLoadClasses(value);
}

While debug the loadClasses where empty.

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

http://www.codebusters.es/
Thorsten Scherler
2013-02-25 13:10:38 UTC
Permalink
Post by Thorsten Scherler
Post by Thorsten Scherler
Hi all,
actually I tried with
HashMap<String, Object> data = new HashMap<String, Object>();
data.put("xxx", "xxx");
return new URLResponse(VIEW, data);
so not really a problem of the hashmap within hasmap. Further I need to
<div id="properties" class="tab_content">
<dl>
$properties.keys:{k|
<dt>$k$</dt>
<dd>
<![CDATA[$properties.(k)$]]>
</dd>
}$
</dl>
</div>
As soon I add a map to the response I get the stackoverflow.
I will now play a bit with the log config.
BTW thanks for the feedback.
<logger name="org.apache.cocoon" additivity="false">
<level value="WARN"/>
<appender-ref ref="CORE"/>
</logger>
Gets rid of the error.
The final source of the error is MutableSettings
(cocoon-configuration-api-1.0.4.jar) where we have
public String toString() {
return "Settings:\n" +
"Running mode : " + this.getRunningMode()+ '\n' +
KEY_RELOAD_DELAY + " : " + this.getReloadDelay(null) + '\n' +
KEY_RELOADING + " : " + this.isReloadingEnabled(null) + '\n' +
KEY_LOAD_CLASSES + " : " +
this.toString(this.getLoadClasses()) + '\n' +
KEY_CACHE_DIRECTORY + " : " + this.getCacheDirectory() + '\n' +
KEY_WORK_DIRECTORY + " : " + this.getWorkDirectory() + '\n' +
KEY_FORM_ENCODING + " : " + this.getFormEncoding() + '\n' +
KEY_CONTAINER_ENCODING + " : " + this.getContainerEncoding() +
'\n';
}
protected String toString(List a) {
final StringBuffer buffer = new StringBuffer();
final Iterator i = a.iterator();
boolean first = true;
while ( i.hasNext() ) {
if ( first ) {
first = false;
} else {
buffer.append(", ");
}
buffer.append(i.next());
}
return buffer.toString();
}
The whole things points to the latter method which is based on the
protected final List loadClasses = new ArrayList();
/**
* Fill from a properties object
*/
public void configure(Properties props) {
...
} else if ( key.startsWith(KEY_LOAD_CLASSES) ) {
this.addToLoadClasses(value);
}
While debug the loadClasses where empty.
salu2
Passing pipeline parameter as attribute: key=cocoon, value=[FAILED
toString()]

in MessageFormatter.arrayFormat.

still investigating

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

http://www.codebusters.es/
Thorsten Scherler
2013-02-26 12:43:22 UTC
Permalink
Post by Thorsten Scherler
...
Passing pipeline parameter as attribute: key=cocoon, value=[FAILED
toString()]
in MessageFormatter.arrayFormat.
still investigating
salu2
Actually you can see it if you start the cocoon-sample block and request
http://localhost:8888/controller/abc/foo?reqparam=1


SLF4J: Failed toString() invocation on an object of type [java.util.HashMap]
java.lang.StackOverflowError
at
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:631)
at java.lang.StringBuilder.append(StringBuilder.java:224)
at
org.apache.cocoon.configuration.MutableSettings.toString(MutableSettings.java:312)
at java.lang.String.valueOf(String.java:2902)

It actually happens in STRenderer

public String render(final String template,
final Map<String, Object> parameters)
throws IOException {

final ST stringTemplate = new ST(template, '$', '$');

if (parameters == null || parameters.isEmpty()) {
LOG.warn("There are not any parameters passed to the
template.");
} else {
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
stringTemplate.add(entry.getKey().replace(".", "_"),
(entry.getValue() instanceof String)
? StringEscapeUtils.escapeXml(
entry.getValue().toString())
: entry.getValue());

LOG.debug("Passing pipeline parameter as attribute: key={}"
+ ", value={}", entry.getKey(), entry.getValue());
}
}

return stringTemplate.render();
}

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

http://www.codebusters.es/
Robby Pelssers
2013-02-26 14:13:21 UTC
Permalink
To be more precise it happens when processing the map entry "cocoon". So in this case there must be some circular reference.. finding that needle is a bit more difficult :(

Robby

-----Original Message-----
From: Thorsten Scherler [mailto:***@gmail.com]
Sent: Tuesday, February 26, 2013 1:43 PM
To: ***@cocoon.apache.org
Subject: Re: REST view and weird error
Post by Thorsten Scherler
...
Passing pipeline parameter as attribute: key=cocoon, value=[FAILED
toString()]
in MessageFormatter.arrayFormat.
still investigating
salu2
Actually you can see it if you start the cocoon-sample block and request
http://localhost:8888/controller/abc/foo?reqparam=1


SLF4J: Failed toString() invocation on an object of type [java.util.HashMap] java.lang.StackOverflowError
at
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:631)
at java.lang.StringBuilder.append(StringBuilder.java:224)
at
org.apache.cocoon.configuration.MutableSettings.toString(MutableSettings.java:312)
at java.lang.String.valueOf(String.java:2902)

It actually happens in STRenderer

public String render(final String template,
final Map<String, Object> parameters)
throws IOException {

final ST stringTemplate = new ST(template, '$', '$');

if (parameters == null || parameters.isEmpty()) {
LOG.warn("There are not any parameters passed to the template.");
} else {
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
stringTemplate.add(entry.getKey().replace(".", "_"),
(entry.getValue() instanceof String)
? StringEscapeUtils.escapeXml(
entry.getValue().toString())
: entry.getValue());

LOG.debug("Passing pipeline parameter as attribute: key={}"
+ ", value={}", entry.getKey(), entry.getValue());
}
}

return stringTemplate.render();
}

salu2

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

http://www.codebusters.es/
Robby Pelssers
2013-02-26 14:21:16 UTC
Permalink
And this line is responsible for the stackoverflow:

LOG.debug("Passing pipeline parameter as attribute: key={}"
+ ", value={}", entry.getKey(), entry.getValue());



-----Original Message-----
From: Robby Pelssers [mailto:***@nxp.com]
Sent: Tuesday, February 26, 2013 3:13 PM
To: ***@cocoon.apache.org
Subject: RE: REST view and weird error

To be more precise it happens when processing the map entry "cocoon". So in this case there must be some circular reference.. finding that needle is a bit more difficult :(

Robby

-----Original Message-----
From: Thorsten Scherler [mailto:***@gmail.com]
Sent: Tuesday, February 26, 2013 1:43 PM
To: ***@cocoon.apache.org
Subject: Re: REST view and weird error
Post by Thorsten Scherler
...
Passing pipeline parameter as attribute: key=cocoon, value=[FAILED
toString()]
in MessageFormatter.arrayFormat.
still investigating
salu2
Actually you can see it if you start the cocoon-sample block and request
http://localhost:8888/controller/abc/foo?reqparam=1


SLF4J: Failed toString() invocation on an object of type [java.util.HashMap] java.lang.StackOverflowError
at
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:631)
at java.lang.StringBuilder.append(StringBuilder.java:224)
at
org.apache.cocoon.configuration.MutableSettings.toString(MutableSettings.java:312)
at java.lang.String.valueOf(String.java:2902)

It actually happens in STRenderer

public String render(final String template,
final Map<String, Object> parameters)
throws IOException {

final ST stringTemplate = new ST(template, '$', '$');

if (parameters == null || parameters.isEmpty()) {
LOG.warn("There are not any parameters passed to the template.");
} else {
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
stringTemplate.add(entry.getKey().replace(".", "_"),
(entry.getValue() instanceof String)
? StringEscapeUtils.escapeXml(
entry.getValue().toString())
: entry.getValue());

LOG.debug("Passing pipeline parameter as attribute: key={}"
+ ", value={}", entry.getKey(), entry.getValue());
}
}

return stringTemplate.render();
}

salu2

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

http://www.codebusters.es/
Thorsten Scherler
2013-02-26 14:22:52 UTC
Permalink
Post by Robby Pelssers
To be more precise it happens when processing the map entry "cocoon". So in this case there must be some circular reference.. finding that needle is a bit more difficult :(
Jupp, look at this:

{baseUrl=file:/home/thorsten/src/codebusters/CLIENT/c3-extractor/./src/main/resources/COB-INF/,
javax.servlet.http.HttpServletResponse=***@61771f5,
source=file:/home/thorsten/src/codebusters/CLIENT/c3-extractor/src/main/resources/COB-INF/resources/views/admin.xhtml,
javax.servlet.http.HttpServletRequest=***@6d3a8ef2,
javax.servlet.ServletContext=***@63917066,
org.apache.cocoon.configuration.Settings=Settings:
Running mode : dev
org.apache.cocoon.reload-delay : 1000
org.apache.cocoon.reloading : false
org.apache.cocoon.classloader.load.classes : empty
org.apache.cocoon.cache.directory :
/home/thorsten/src/codebusters/CLIENT/c3-extractor/target/work/cache-dir
org.apache.cocoon.work.directory :
/home/thorsten/src/codebusters/CLIENT/c3-extractor/target/work
org.apache.cocoon.formencoding : null
org.apache.cocoon.containerencoding : UTF-8
,
cocoon={response=***@61771f5,
settings=Settings:
Running mode : dev
org.apache.cocoon.reload-delay : 1000
org.apache.cocoon.reloading : false
org.apache.cocoon.classloader.load.classes : empty
org.apache.cocoon.cache.directory :
/home/thorsten/src/codebusters/CLIENT/c3-extractor/target/work/cache-dir
org.apache.cocoon.work.directory :
/home/thorsten/src/codebusters/CLIENT/c3-extractor/target/work
org.apache.cocoon.formencoding : null
org.apache.cocoon.containerencoding : UTF-8
,
request=org.apache.cocoon.servlet.util.ObjectModelProvider$***@1f7ee9e4,
context=***@63917066,
controller={properties={awt.toolkit=sun.awt.X11.XToolkit,
classworlds.conf=/home/thorsten/src/codebusters/workspace/crawl/.metadata/.plugins/org.eclipse.m2e.core/launches/m2conf3387913835580501331.tmp,
common.resources=/home/thorsten/src/codebusters/CLIENT/api/src/main/resources/COB-INF/resources/,more=...,
sun.java.command=org.codehaus.plexus.classworlds.launcher.Launcher -B -s
/home/thorsten/.m2/settings.xml install jetty:run,
sun.java.launcher=SUN_STANDARD, sun.jnu.encoding=UTF-8,
sun.management.compiler=HotSpot 64-Bit Tiered Compilers,
sun.os.patch.level=unknown, user.country=US,
user.dir=/home/thorsten/src/codebusters/CLIENT/c3-extractor,
user.home=/home/thorsten, user.language=en, user.name=thorsten,
user.timezone=Europe/Madrid}}}}

The more=..., is much more props I handle but basically
org.apache.cocoon.configuration.Settings are two times and a view more
under a different name. e.g.
javax.servlet.http.HttpServletResponse=***@61771f5,
response=***@61771f5,


I am not sure ATM why this duplication.

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

http://www.codebusters.es/
Francesco Chicchiriccò
2013-02-26 14:21:38 UTC
Permalink
Post by Thorsten Scherler
Post by Thorsten Scherler
...
Passing pipeline parameter as attribute: key=cocoon, value=[FAILED
toString()]
in MessageFormatter.arrayFormat.
still investigating
salu2
Actually you can see it if you start the cocoon-sample block and request
http://localhost:8888/controller/abc/foo?reqparam=1
SLF4J: Failed toString() invocation on an object of type [java.util.HashMap]
java.lang.StackOverflowError
at
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:631)
at java.lang.StringBuilder.append(StringBuilder.java:224)
at
org.apache.cocoon.configuration.MutableSettings.toString(MutableSettings.java:312)
at java.lang.String.valueOf(String.java:2902)
It actually happens in STRenderer
[...]
Hi Thorsten,
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()

Regards.
--
Francesco Chicchiriccò

ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member
http://people.apache.org/~ilgrosso/
Robby Pelssers
2013-02-26 14:24:09 UTC
Permalink
Nice tip... [common-collection's MapUtils]

I was about to write my own routine to do a verbose print. You saved me a lot of work :)

Cheers,
Robby

-----Original Message-----
From: Francesco Chicchiriccò [mailto:***@apache.org]
Sent: Tuesday, February 26, 2013 3:22 PM
To: ***@cocoon.apache.org
Subject: Re: REST view and weird error
Post by Thorsten Scherler
Post by Thorsten Scherler
...
Passing pipeline parameter as attribute: key=cocoon, value=[FAILED
toString()]
in MessageFormatter.arrayFormat.
still investigating
salu2
Actually you can see it if you start the cocoon-sample block and request
http://localhost:8888/controller/abc/foo?reqparam=1
SLF4J: Failed toString() invocation on an object of type
[java.util.HashMap] java.lang.StackOverflowError
at
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:631)
at java.lang.StringBuilder.append(StringBuilder.java:224)
at
org.apache.cocoon.configuration.MutableSettings.toString(MutableSettings.java:312)
at java.lang.String.valueOf(String.java:2902)
It actually happens in STRenderer
[...]
Hi Thorsten,
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()

Regards.

--
Francesco Chicchiriccò

ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member http://people.apache.org/~ilgrosso/
Thorsten Scherler
2013-02-26 14:25:25 UTC
Permalink
Post by Robby Pelssers
Post by Thorsten Scherler
Post by Thorsten Scherler
...
Passing pipeline parameter as attribute: key=cocoon, value=[FAILED
toString()]
in MessageFormatter.arrayFormat.
still investigating
salu2
Actually you can see it if you start the cocoon-sample block and request
http://localhost:8888/controller/abc/foo?reqparam=1
SLF4J: Failed toString() invocation on an object of type
[java.util.HashMap]
java.lang.StackOverflowError
at
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:631)
at java.lang.StringBuilder.append(StringBuilder.java:224)
at
org.apache.cocoon.configuration.MutableSettings.toString(MutableSettings.java:312)
at java.lang.String.valueOf(String.java:2902)
It actually happens in STRenderer
[...]
Hi Thorsten,
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
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".

Let us see whether that gets rid of the redundant data as well.

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

http://www.codebusters.es/
Robby Pelssers
2013-02-26 15:24:58 UTC
Permalink
http://robbypelssers.blogspot.nl/2013/02/debugging-circular-references-in-maps.html

Another useful lesson learned :)

-----Original Message-----
From: Thorsten Scherler [mailto:***@gmail.com]
Sent: Tuesday, February 26, 2013 3:25 PM
To: ***@cocoon.apache.org
Subject: Re: REST view and weird error
Post by Robby Pelssers
Post by Thorsten Scherler
Post by Thorsten Scherler
...
Passing pipeline parameter as attribute: key=cocoon, value=[FAILED
toString()]
in MessageFormatter.arrayFormat.
still investigating
salu2
Actually you can see it if you start the cocoon-sample block and request
http://localhost:8888/controller/abc/foo?reqparam=1
SLF4J: Failed toString() invocation on an object of type
[java.util.HashMap] java.lang.StackOverflowError
at
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:631)
at java.lang.StringBuilder.append(StringBuilder.java:224)
at
org.apache.cocoon.configuration.MutableSettings.toString(MutableSetti
ngs.java:312)
at java.lang.String.valueOf(String.java:2902)
It actually happens in STRenderer
[...]
Hi Thorsten,
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
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".

Let us see whether that gets rid of the redundant data as well.

salu2

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

http://www.codebusters.es/
Francesco Chicchiriccò
2013-02-26 15:36:47 UTC
Permalink
Post by Thorsten Scherler
Post by Robby Pelssers
Post by Thorsten Scherler
Post by Thorsten Scherler
...
Passing pipeline parameter as attribute: key=cocoon, value=[FAILED
toString()]
in MessageFormatter.arrayFormat.
still investigating
salu2
Actually you can see it if you start the cocoon-sample block and request
http://localhost:8888/controller/abc/foo?reqparam=1
SLF4J: Failed toString() invocation on an object of type
[java.util.HashMap]
java.lang.StackOverflowError
at
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:631)
at java.lang.StringBuilder.append(StringBuilder.java:224)
at
org.apache.cocoon.configuration.MutableSettings.toString(MutableSettings.java:312)
at java.lang.String.valueOf(String.java:2902)
It actually happens in STRenderer
[...]
Hi Thorsten,
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
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 ;-)

Anyway as per r1450217 the StackOverflowError is removed from STRenderer.
Post by Thorsten Scherler
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.

Regards.
--
Francesco Chicchiriccò

ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member
http://people.apache.org/~ilgrosso/
Thorsten Scherler
2013-02-27 00:18:28 UTC
Permalink
Post by Francesco Chicchiriccò
Post by Thorsten Scherler
Post by Francesco Chicchiriccò
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
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.
Post by Francesco Chicchiriccò
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);
+ }
}
}
Post by Francesco Chicchiriccò
Post by Thorsten Scherler
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/
Francesco Chicchiriccò
2013-02-27 08:06:57 UTC
Permalink
Post by Thorsten Scherler
[...]
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.
...I knew you would have said that :-)

I did my best about that with 1450163, 1450152, 1450140, 1449724 but in
1450217 I guess I was under the "just another minor adjustment and I'll
stop" effect...

I hope to have some spare cycles soon: we are only 9 issues away from
3.0.0-beta-1 [1]!

Regards.

[1]
https://issues.apache.org/jira/issues/?jql=project%20%3D%20COCOON3%20AND%20fixVersion%20%3D%20%223.0.0-beta-1%22%20AND%20status%20%3D%20Open%20ORDER%20BY%20priority%20DESC
--
Francesco Chicchiriccò

ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member
http://people.apache.org/~ilgrosso/
Loading...