I cannot see any reason not to do the change but a word of caution. I
have been bitten hard modifying this class in the past. Despite my best
efforts this is one of the classes in gt2 that I have a lot of trouble
understanding. Its poorly documented and I never quite understood what
the meaning of having a filter / expression on either stack is.
Regardless, when you do make the modification I suggest you save
yourself headaches later down the road and run the wfs cite tests suite
in geoserver.
Andrea Aime wrote:
> Hi,
> today I was trying to understand why some filters we set
> up in Geoserver threw a:
>
> Caused by: java.lang.ClassCastException:
> org.geotools.filter.AttributeExpressionImpl
> at
> org.geotools.filter.visitor.PostPreProcessFilterSplittingVisitor.getFilterPre(PostPreProcessFilterSplittingVisitor.java:125)
>
> during filter splitting. Now, it turned out we were using a
> non existent attribute name, but the error message was totally
> uninformative. Let's have a look at the code that visits an attribute
> expression:
>
> public Object visit(PropertyName expression, Object notUsed) {
> //JD: use an expression to get at the attribute type intead of
> accessing directly
> if (parent != null && expression.evaluate( parent ) == null ) {
> postStack.push(expression);
> return null; // on 2.3.x this return is not there!!!!!
> }
> if(transactionAccessor!=null){
> Filter updateFilter= (Filter)
> transactionAccessor.getUpdateFilter(expression.getPropertyName());
> if( updateFilter!=null ){
> changedStack.add(updateFilter);
> preStack.push(updateFilter);
> }else
> preStack.push(expression);
> } else{
> preStack.push(expression);
> }
> return null;
> }
>
> now, can anyone tell me why if we have the faature type handy (parent)
> and the attribute is not there, we put the expression in the postStack
> instead of throwing an hard exception?
>
> Theoretically the check could be performed during PropertyName
> construction, but during filter parsing it's not always possible to
> have the feature type handy, so it's pretty much common to have
> a PropertyName that contains a wrong property name.
>
> Imho it would be much better if we threw an exception stating that
> the attribute is not there. Any objection?
>
> Cheers
> Andrea
>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Geotools-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>
> !DSPAM:4007,467bd0ae259367180515871!
>
--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel