On Tue, Jul 5, 2011 at 1:28 PM, Jody Garnett <jody.garn...@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

Cheers
Andrea

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

Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy

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

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-------------------------------------------------------
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to