The user macro show-ancestor-with-label (copy below) generates exceptions (eg, null pointer, array bounds, hibernate) but only on a small number of invocations. It is intended to include a link to the first ancestor it finds with the given label.
Strangely rendering a page that calls the macro ~260 times is successful in approx. 2/3 tries, but on the failed case generates one of the exceptions.
Any suggestions on what may be driving the exceptions (some but not all of the time)?
## @Param Label:title=Label|type=string|required=true|desc=Pages that contain this label should be displayed
##set ( $ancestor = "" )
#foreach ( $ancestor in $content.getAncestors() )
#foreach ( $label in $ancestor.getLabels() )
#if ($label == $paramLabel)
#contentLink2($ancestor, false, false)
#break($foreach.parent)
#end
#end
#end