On Tue, Jul 5, 2011 at 1:28 PM, Jody Garnett <jody.garnett@gmail.com> wrote:
Here is a patch for DuplicatingFilterVisitor you can try if you like ....

public Object visit(Function expression, Object extraData) {
List old = expression.getParameters();
Expression[] args = new Expression[old.size()];
int i = 0;
for (Iterator iter = old.iterator(); iter.hasNext(); i++) {
Expression exp = (Expression) iter.next();
args[i]= visit(exp, extraData);
FilterFactory2 factory = getFactory(extraData);
try {
   Function copy = factory.function(expression.getName(), args);
   return copy;
catch (RuntimeException eek ){
   LOGGER.warning("Unable to duplicate "+expression.getName()+" did you register it with META_INF/services? "+eek);
   if( args.length == 0 ){
       // this function is probably a volatile hack of some sort from 2.6 code
       // since no arguments are harmed we can get away with ....
       return expression;
   throw eek;

Ugh, this one is likely to pollute the logs of whoever went out of filter ways, and
might hide registration issues for other people.

What about a new marker interface for these forsaken functions?
If the function implements that function we don't clone it, just use it as is.
ImmutableFunction would be a good one, since the function really needs to be
immutable to safely use it as is instead of cloning it

Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054  Massarosa (LU)

phone: +39 0584 962313
fax:      +39 0584 962313