You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Christian Schlichtherle <ch...@schlichtherle.de> on 2007/06/07 16:58:06 UTC
Stackoverflow when using regexp matcher (Cocoon 2.1.10)
Hi,
I am trying to use the regexp matcher in a sitemap to match an optional file
name extension like this:
<map:match type="regexp" pattern="(.*)(\..*)">
<!-- ... -->
</map:match>
But all I get is a stack overflow:
java.lang.StackOverflowError
org.apache.regexp.RE.matchNodes(Unknown Source)
org.apache.regexp.RE.matchNodes(Unknown Source)
...
Same applies to:
<map:match type="regexp" pattern="com/bets4all/(.+)(\..*)?">
If I rewrite the pattern to:
<map:match type="regexp" pattern="(.+)(\..+)">
I get this:
java.lang.StackOverflowError
java.util.HashMap.getEntry(HashMap.java:344)
java.util.HashMap.containsKey(HashMap.java:335)
org.apache.cocoon.environment.wrapper.RequestParameters.getParameterValues(R
equestParameters.java:144)
org.apache.cocoon.environment.wrapper.RequestWrapper.getParameterValues(Requ
estWrapper.java:161)
org.apache.cocoon.environment.wrapper.RequestWrapper.getParameterValues(Requ
estWrapper.java:162)
org.apache.cocoon.environment.wrapper.RequestWrapper.getParameterValues(Requ
estWrapper.java:162)
...
Is this a bug or am I doing something wrong?
Kind regards,
Christian Schlichtherle
--
Schlichtherle IT Services
Wittelsbacherstr. 10a
10707 Berlin
Tel: +49 (0) 30 / 34 35 29 29
Mobil: +49 (0) 173 / 27 12 470
mailto:christian@schlichtherle.de
http://www.schlichtherle.de <http://www.schlichtherle.de/>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Resolved: Stackoverflow when using regexp matcher (Cocoon 2.1.10)
Posted by Christian Schlichtherle <ch...@schlichtherle.de>.
Hi,
> unfortunately both stacktraces don't help to track down the
> error. The first one is without any Cocoon part. The second
> one can only happen if a RequestWrapper wraps a
> RequestWrapper wraps a ... and never an actual Request
> object. Posting more complete stacktraces might help - though
> they can get veeeeery long with StackOverflowErrors.
thanks for the attention. Indeed I did not want to provide the full
stacktrace.
Anyway, I resolved it. It appears I have to "root" my regular expression. So
the following works:
<!-- match "foo/list" or "foo/list.xml" or "foo/list.html" or ... -->
<map:match type="regexp" pattern="^foo/(.+)(\..+)?">
<!-- ... -->
</map:match>
The key point is the caret ('^') at the start. Otherwise, "foo" is matched
just anywhere in the request URI. Within my matcher, I then prefixed the URI
with another string. However, now the regexp matched again, which caused an
endless recursion.
Kind regards,
Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Stackoverflow when using regexp matcher (Cocoon 2.1.10)
Posted by Joerg Heinicke <jo...@gmx.de>.
On 07.06.2007 16:58, Christian Schlichtherle wrote:
> I am trying to use the regexp matcher in a sitemap to match an optional file
> name extension like this:
> But all I get is a stack overflow:
Hi Christian,
unfortunately both stacktraces don't help to track down the error. The
first one is without any Cocoon part. The second one can only happen if
a RequestWrapper wraps a RequestWrapper wraps a ... and never an actual
Request object. Posting more complete stacktraces might help - though
they can get veeeeery long with StackOverflowErrors.
Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Stackoverflow when using regexp matcher (Cocoon 2.1.10)
Posted by Joerg Heinicke <jo...@gmx.de>.
On 08.06.2007 14:01, Christian Schlichtherle wrote:
>> The EncodeURLTransformer was modified to use java.util.regexp
>> instead of Apache regexp. Tests showed it is significantly
>> faster and I was experiencing extremely deep stacks on calls
>> to matchNodes (although I never actually got a
>> StackOverflow). Although you have bypassed the problem it
>> probably would make sense to modify the matcher as well.
>
> sorry, but I don't understand how a transformer could help here. I want to
> apply regexp matcher to a pipeline.
Please re-read Ralph's mail. He didn't suggest to use that transformer,
but only to change the actual implementation of the matcher.
Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: Stackoverflow when using regexp matcher (Cocoon 2.1.10)
Posted by Christian Schlichtherle <ch...@schlichtherle.de>.
Hi,
> The EncodeURLTransformer was modified to use java.util.regexp
> instead of Apache regexp. Tests showed it is significantly
> faster and I was experiencing extremely deep stacks on calls
> to matchNodes (although I never actually got a
> StackOverflow). Although you have bypassed the problem it
> probably would make sense to modify the matcher as well.
sorry, but I don't understand how a transformer could help here. I want to
apply regexp matcher to a pipeline.
Kind regards,
Christian
Re: Stackoverflow when using regexp matcher (Cocoon 2.1.10)
Posted by Ralph Goers <Ra...@dslextreme.com>.
The EncodeURLTransformer was modified to use java.util.regexp instead of
Apache regexp. Tests showed it is significantly faster and I was
experiencing extremely deep stacks on calls to matchNodes (although I
never actually got a StackOverflow). Although you have bypassed the
problem it probably would make sense to modify the matcher as well.
Ralph
Christian Schlichtherle wrote:
> Hi,
>
> I am trying to use the regexp matcher in a sitemap to match an optional file
> name extension like this:
>
> <map:match type="regexp" pattern="(.*)(\..*)">
> <!-- ... -->
> </map:match>
>
> But all I get is a stack overflow:
>
> java.lang.StackOverflowError
> org.apache.regexp.RE.matchNodes(Unknown Source)
> org.apache.regexp.RE.matchNodes(Unknown Source)
> ...
>
> Same applies to:
>
> <map:match type="regexp" pattern="com/bets4all/(.+)(\..*)?">
>
> If I rewrite the pattern to:
>
> <map:match type="regexp" pattern="(.+)(\..+)">
>
> I get this:
>
> java.lang.StackOverflowError
> java.util.HashMap.getEntry(HashMap.java:344)
> java.util.HashMap.containsKey(HashMap.java:335)
>
> org.apache.cocoon.environment.wrapper.RequestParameters.getParameterValues(R
> equestParameters.java:144)
>
> org.apache.cocoon.environment.wrapper.RequestWrapper.getParameterValues(Requ
> estWrapper.java:161)
>
> org.apache.cocoon.environment.wrapper.RequestWrapper.getParameterValues(Requ
> estWrapper.java:162)
>
> org.apache.cocoon.environment.wrapper.RequestWrapper.getParameterValues(Requ
> estWrapper.java:162)
> ...
>
> Is this a bug or am I doing something wrong?
>
> Kind regards,
> Christian Schlichtherle
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org