New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

general comparison to empty sequence sometimes raises an error #1639

Closed
telic opened this Issue Nov 28, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@telic
Contributor

telic commented Nov 28, 2017

What is the problem

eXist sometimes raises a type error when making a general comparison to an empty-sequence on the right-hand side (eg. current-date() = ()). It never raises this error if the empty sequence appears on the left-hand side (eg. () = current-date()).

This appears to be due to inconsistent practice in the implementation of the compareTo(Collator, Comparison, AtomicValue) method in each of the org.exist.xquery.value classes. Some explicitly check for .isEmpty() at the start, but BooleanValue, AbstractDateTimeValue, and BinaryValue do not (and there may be others that I missed).

What did you expect

A general comparison to the empty sequence should always return false(), since no "pair of atomic values" exists.

Context information

  • eXist-db 3.6.0 (build 201711271542) / ceaab01
  • Java 1.8.0_152-b16
  • MacOS 10.13.1
  • 64 bit
@dizzzz

This comment has been minimized.

Show comment
Hide comment
@dizzzz

dizzzz Dec 3, 2017

Member

only a hand full

isempty

Member

dizzzz commented Dec 3, 2017

only a hand full

isempty

@dizzzz

This comment has been minimized.

Show comment
Hide comment
@dizzzz

dizzzz Dec 3, 2017

Member

I think we can fix this in the GeneralCOmparison :

org/exist/xquery/GeneralComparison.java:1094

 default: {
                    // If right value is () always return false
                    return( rv.isEmpty() ? false : lv.compareTo( collator, relation, rv ) );
                }
Member

dizzzz commented Dec 3, 2017

I think we can fix this in the GeneralCOmparison :

org/exist/xquery/GeneralComparison.java:1094

 default: {
                    // If right value is () always return false
                    return( rv.isEmpty() ? false : lv.compareTo( collator, relation, rv ) );
                }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment