From: Wolfgang M. <sb...@we...> - 2004-09-20 20:30:30
|
Hi, I just came back to this issue when responding to another question concerning value comparisons. I checked the XQuery spec and you're right. In the section about value comparisons, it says: "If either atomized operand is an empty sequence, the result of the value comparison is an empty sequence." You can change the function by adding if(ls.getLength() == 0 || rs.getLength() == 0) return Sequence.EMPTY_SEQUENCE; in front of the other if statement. However, the return type of method genericCompare() then also has to be changed from AtomicValue to Sequence. This should be done in both classes, GenericComparison and ValueComparison. I will add that to the CVS. Wolfgang > Dear Exist User Group: > > I'm seeing an "intermittent" exception begin thrown, and > propagating all the way to the top. > > The exception is happening inside > org.exist.xquery.ValueComparision.genericCompare() > and the passed argument contextSequence is of type > org.exist.xquery.value.EmptySequence. > > I'm just guessing that this code is using bogus information > and throwing an exception because statement > ls.getLength() == 1 && rs.getLength() == 1 > is false. > > But shouldn't (or is a fix to) this routine for it > to check if contextSequence is of type EmptySequence > and then return either true or false? > > The call stack looks like: > > ValueComparison.genericCompare(Sequence, Item) line: 76 > ValueComparison(GeneralComparison).eval(Sequence, Item) line: 157 > ValueComparison(AbstractExpression).eval(Sequence) line: 45 > PathExpr.eval(Sequence, Item) line: 145 > ConditionalExpression.eval(Sequence, Item) line: 70 > PathExpr.eval(Sequence, Item) line: 127 > > This is 20040510 snapshot, but even most recent cvs > snapshot has the same problem. |