Skip to content

Commit ba269cb

Browse files
committed
[bugfix] #4958 return false() from empty nodeSetCompare
1 parent dcc8782 commit ba269cb

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

exist-core/src/main/java/org/exist/xquery/GeneralComparison.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,9 @@ protected Sequence nodeSetCompare( NodeSet nodes, Sequence contextSequence ) thr
648648
}
649649
}
650650
}
651+
if (result.isEmpty()) {
652+
return BooleanValue.FALSE;
653+
}
651654
}
652655

653656
if( context.getProfiler().traceFunctions() ) {
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
xquery version "3.1";
2+
3+
module namespace t="http://exist-db.org/xquery/test";
4+
5+
declare namespace test="http://exist-db.org/xquery/xqsuite";
6+
7+
declare variable $t:XML := document {
8+
<F id="1"/>
9+
};
10+
11+
declare
12+
%test:setUp
13+
function t:setup() {
14+
xmldb:create-collection("/db", "test"),
15+
xmldb:store("/db/test", "test.xml", $t:XML)
16+
};
17+
18+
declare
19+
%test:tearDown
20+
function t:tearDown() {
21+
xmldb:remove("/db/test")
22+
};
23+
24+
declare
25+
%test:assertTrue
26+
function t:test-db() {
27+
exists(
28+
doc("/db/test/test.xml")//F[boolean(count(@id >= 2))]
29+
)
30+
};
31+
32+
declare
33+
%test:assertTrue
34+
function t:test-mem() {
35+
exists(
36+
$t:XML//F[boolean(count(@id >= 2))]
37+
)
38+
};

0 commit comments

Comments
 (0)