Wow, I'm having trouble finding that.
DefaultRelationalExpr has an evaluateObjectObject(...) that funnels through NumberFunction. DefaultGreaterThanExpr has evaluateDoubleDouble(...) that only accepts doubles. What file did you find this particular evaluateObjectObject(...) method? -bob On Mon, 10 Dec 2001, Yuri de Wit wrote: > > It seems like all expression subclasses have the following method. The > expression '$result > 10' hits this method: > > protected Object evaluateObjectObject(Object lhs, > Object rhs) > { > if ( bothAreBoolean( lhs, > rhs ) ) > { > return ( ( lhs.equals( rhs ) ) > ? Boolean.TRUE > : Boolean.FALSE ); > } > > Comparable lhsComp = (Comparable) lhs; > Comparable rhsComp = (Comparable) rhs; > >>>> > >>>> lhsComp is a Double where rhsComp is an Integer: ClassCastException > >>>> > if ( lhsComp.compareTo( rhsComp ) < 0 ) > { > return Boolean.TRUE; > } > > return Boolean.FALSE; > } > > -----Original Message----- > From: bob mcwhirter [mailto:[EMAIL PROTECTED]] > Sent: Monday, December 10, 2001 11:36 > To: Yuri de Wit > Cc: [EMAIL PROTECTED] > Subject: RE: [Jaxen] Jaxen Handling of Java Objects in expression > evaluati ons > > > On Mon, 10 Dec 2001, Yuri de Wit wrote: > > > Thats me again with the same problem I outlined earlier. > > > > If I have an Jaxen XPATH that looks like the following: > > > > '$result > 10' > > > > And I have a VariableContext set in the engine that returns, for instance, > a > > String("4") or a Double(4.0), Jaxen is going to throw a ClassCastException > > because it is relying on the Java Comparator of Primitive Objects > (Integer, > > String, Double, etc). From the XPATH expression, 10 is an Integer(10) and > > Integer.compare(String("10")) is going to throw the exception. > > > > My question is: Is this a Jaxen bug since it is not properly handling the > > object comparations properly? Or are there specific requirements on what > > types can be returned by VariableContext implementations? > > > > In addition, if the VariableContext returns 'null' it is Jaxen is going to > > throw NullPointerException. Shouldnt Jaxen check for nulls in this case? > > Hmmm... > > Looking at DefaultRelationalExpr.java, it looks to me that it funnels the > LHS and RHS through the NumberFunction(), which should do type coercion > for strings, etc. > > Could you point me to file/line-number where we're Doing The Wrong Thing? > > -bob > > _______________________________________________ > Jaxen-interest mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jaxen-interest > _______________________________________________ Jaxen-interest mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jaxen-interest