Thx Wouter,
I am committing it as suggested
Regards Ard
>
> Hi,
>
> We are using the sitemenu module. A content manager
> accidentially added an empty level2:
>
> <level1>
> <name>name</name>
> <title>title</title>
> <datasource>/datasource</datasource>
> <template>template</template>
> <level2>
> <name>name</name>
> <title>title</title>
> <datasource>/datasource</datasource>
> <template>template</template>
> </level2>
> <level2><name/><title/><datasource/><template/></level2>
> <!-- This is wrong --> </level1>
>
> The result was:
>
> java.lang.StringIndexOutOfBoundsException: String index out
> of range: 0 at java.lang.String.charAt(String.java:558)
> at
> nl.hippo.cocoon.components.modules.input.SitemenuModule$Siteme
> nuLevel.getData(SitemenuModule.java:430)
> at
> nl.hippo.cocoon.components.modules.input.SitemenuModule$Siteme
> nuLevel.getData(SitemenuModule.java:441)
> at
> nl.hippo.cocoon.components.modules.input.SitemenuModule$Siteme
> nuLevel.getData(SitemenuModule.java:417)
> at
> nl.hippo.cocoon.components.modules.input.SitemenuModule.getCon
> textObject(SitemenuModule.java:143)
> at
> nl.hippo.cocoon.components.modules.input.SitemenuModule.getAtt
> ribute(SitemenuModule.java:328)
> at
> org.apache.cocoon.components.treeprocessor.variables.PreparedV
> ariableResolver.processModule(PreparedVariableResolver.java:258)
>
> I feel that the SitemenuModule class should ignore the bad
> level instead of crashing. This seems like a clean fix:
>
> public Node getData(String uri) {
> if (data == null) {
> ...
> } else if (uri.length() == 0) { //This is new
> return null; //This is new
> } else if (uri.startsWith(name) ||
> uri.startsWith(slashName) || uri.startsWith(nameSlash)) {
> ...
> }
> }
>
> Although this is not a major issue for us, you might want to
> include a fix in a future release.
>
> Regards,
>
> Wouter
> ********************************************
> Hippocms-dev: Hippo CMS development public mailinglist
>
********************************************
Hippocms-dev: Hippo CMS development public mailinglist