The source for the org.jaxen.expr.DefaultPathExpr.evaluate() method is:

     public Object evaluate(Context context) throws JaxenException
     {
         Object results = getFilterExpr().evaluate( context );

         context.setNodeSet( convertToList( results ) );

         return getLocationPath().evaluate( context );
     }

It seems to me that invoking the setNodeSet() method on the Context 
instance that was passed as an argument is incorrect. Shouldn't a new 
Context be created for evaluation of the location path? For example:

     public Object evaluate(Context context) throws JaxenException
     {
         Object results = getFilterExpr().evaluate( context );

         Context pathContext = new Context( context.getContextSupport() );
         pathContext.setNodeSet( convertToList( results ) );

         return getLocationPath().evaluate( pathContext );
     }

Otherwise, evaluating the RHS of a UnionExpr (e.g.) could change the 
context for evaluation of the LHS. Comments, anyone?

Thanks,


Ari Kermaier    [EMAIL PROTECTED]
Senior Software Engineer
Phaos Technology Corp.    http://www.phaos.com/



-------------------------------------------------------
This sf.net email is sponsored by: Jabber - The world's fastest growing 
real-time communications platform! Don't just IM. Build it in! 
http://www.jabber.com/osdn/xim
_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to