You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Donald Ball <ba...@webslingerZ.com> on 2001/06/22 03:08:16 UTC

more data on the pattern matching bug

here's some more data on the pattern matching bug i've exposed. my sitemap
has these relevant pipelines:

  <map:match pattern="*">
    <map:aggregate element="root">
      <map:part src="plain/meta"/>
      <map:part src="plain/{1}"/>
    </map:aggregate>
    <map:act type="resource-exists">
      <map:parameter name="url" value="context://style/{1}.xsl"/>
      <map:transform src="style/{../1}.xsl"/>
    </map:act>
    <map:select>
      <map:when test="wap">
        <map:transform src="style/wziml-wml.xsl"/>
        <mal:serialize type="wap"/>
      </map:when>
      <map:otherwise>
        <map:transform src="style/wziml-html.xsl"/>
        <map:serialize type="html"/>
      </map:otherwise>
    </map:select>
  </map:match>

  <map:match pattern="plain/*">
    <map:generate src="content/{1}.xml" type="serverpages"/>
    <map:serialize/>
  </map:match>

this used to work fine, but now i'm getting the exceptions i described in
an earlier email. i put some debugging code in AbstractSitemap and i see
the following information for the sitemap above when i request 'clients':

DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): ContentAggregator:
root element='root' ns='' prefix=''
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): Substituting string
plain/meta
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): List item:
{1=clients}
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): ContentAggregator:
part uri='plain/meta' element='' ns='' stripRootElement='' prefix=''
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): Substituting string
plain/{1}
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): List item:
{1=clients}
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): K: 0
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): S: 1
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): Map: {1=clients}
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): Val: clients
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): substitute evaluated
value for 1 as clients
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): ContentAggregator:
part uri='plain/clients' element='' ns='' stripRootElement='' prefix=''
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): Substituting string
context://style/{1}.xsl
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): List item:
{1=clients}
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): K: 0
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): S: 1
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): Map: {1=clients}
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): Val: clients
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): substitute evaluated
value for 1 as clients
WARN    56213   [cocoon  ] (HttpProcessor[8080][4]): Looking up component
on an uninitialized ComponentManager: resource-exists
DEBUG   56213   [cocoon  ] (HttpProcessor[8080][4]): Action
((Action)this.actions.select( resource-exists )).act
DEBUG   56213   [cocoon  ] (HttpProcessor[8080][4]): Substituting string
context://style/{1}.xsl
DEBUG   56213   [cocoon  ] (HttpProcessor[8080][4]): List item:
{1=clients}
DEBUG   56213   [cocoon  ] (HttpProcessor[8080][4]): List item: {}
DEBUG   56213   [cocoon  ] (HttpProcessor[8080][4]): K: 1
DEBUG   56213   [cocoon  ] (HttpProcessor[8080][4]): S: 1
DEBUG   56213   [cocoon  ] (HttpProcessor[8080][4]): Map: {}
DEBUG   56213   [cocoon  ] (HttpProcessor[8080][4]): Val: null
ERROR   56213   [cocoon  ] (HttpProcessor[8080][4]):
AbstractSitemap:substitute()
java.lang.NullPointerException
        at
org.apache.cocoon.sitemap.AbstractSitemap.substitute(AbstractSitemap.java:298)

(the debugging code simply consists of printing the match expression and
iterating over the list of maps and printing them, and printing out the
variables relevant to the pattern resolution just before it tried to
evaluate it. nothing exotic.)

as you can see, it's calling AbstractSitemap.substitute _twice_ for the
context://style/{1}.xsl expression. the first time, it evalutes properly:

DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): Substituting string
context://style/{1}.xsl
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): List item:
{1=clients}
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): K: 0
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): S: 1
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): Map: {1=clients}
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): Val: clients
DEBUG   56212   [cocoon  ] (HttpProcessor[8080][4]): substitute evaluated
value for 1 as clients

but the second time it does not:

DEBUG   56213   [cocoon  ] (HttpProcessor[8080][4]): Substituting string
context://style/{1}.xsl
DEBUG   56213   [cocoon  ] (HttpProcessor[8080][4]): List item:
{1=clients}
DEBUG   56213   [cocoon  ] (HttpProcessor[8080][4]): List item: {}
DEBUG   56213   [cocoon  ] (HttpProcessor[8080][4]): K: 1
DEBUG   56213   [cocoon  ] (HttpProcessor[8080][4]): S: 1
DEBUG   56213   [cocoon  ] (HttpProcessor[8080][4]): Map: {}
DEBUG   56213   [cocoon  ] (HttpProcessor[8080][4]): Val: null
ERROR   56213   [cocoon  ] (HttpProcessor[8080][4]):
AbstractSitemap:substitute()
java.lang.NullPointerException
        at
org.apache.cocoon.sitemap.AbstractSitemap.substitute(AbstractSitemap.java:298)

i believe the first time the substitute method is invoked is from the
sitemap, and the second time it's invoked is from the SourceResolver
that's passed to the ResourceExistsAction. what i _can't_ figure out is
why the context (e.g. the listOfMaps) would be any different in the one
place v.s. the other. but clearly this is a bug and needs to be addressed.

actually, on further reflection, i have no idea why this pattern is being
evaluated twice. it doesn't make any sense for it to ever be evaluted
outside of the ResourceExistsAction. does anyone have a clue?

(note this may or may not have anything to do with the context: url
changes - it's actually been a couple of days since i last updated this
particular webapp with the latest c2 and library changes.)

- donald


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org