Skip to content

Commit 124fcfd

Browse files
committed
[fix] throw XPathException in ValueComparison with ErrorCode
1 parent c16913a commit 124fcfd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ protected Sequence genericCompare(Sequence contextSequence, Item contextItem) th
7777
final Collator collator = getCollator(contextSequence);
7878
return BooleanValue.valueOf(compareAtomic(collator, lv, rv, StringTruncationOperator.NONE, relation));
7979
}
80-
throw new XPathException(this, "Type error: sequence with more than one item is not allowed here");
80+
throw new XPathException(this, ErrorCodes.XPTY0004, "Type error: sequence with more than one item is not allowed here");
8181
}
8282

8383
protected Sequence nodeSetCompare(NodeSet nodes, Sequence contextSequence) throws XPathException {
@@ -89,14 +89,14 @@ protected Sequence nodeSetCompare(NodeSet nodes, Sequence contextSequence) throw
8989
for (final NodeProxy current : nodes) {
9090
ContextItem context = current.getContext();
9191
if (context == null) {
92-
throw new XPathException(this, "Context is missing for node set comparison");
92+
throw new XPathException(this, ErrorCodes.XPDY0002, "Context is missing for node set comparison");
9393
}
9494
do {
9595
final AtomicValue lv = current.atomize();
9696
final Sequence rs = getRight().eval(context.getNode().toSequence());
9797
if (!rs.hasOne()) {
98-
throw new XPathException(this,
99-
"Type error: sequence with less or more than one item is not allowed here");
98+
throw new XPathException(this, ErrorCodes.XPTY0004,
99+
"Type error: sequence with less or more than one item is not allowed here");
100100
}
101101
if (compareAtomic(collator, lv, rs.itemAt(0).atomize(), StringTruncationOperator.NONE, relation)) {
102102
result.add(current);
@@ -106,8 +106,8 @@ protected Sequence nodeSetCompare(NodeSet nodes, Sequence contextSequence) throw
106106
} else {
107107
final Sequence rs = getRight().eval(null);
108108
if (!rs.hasOne())
109-
{throw new XPathException(this,
110-
"Type error: sequence with less or more than one item is not allowed here");}
109+
{throw new XPathException(this, ErrorCodes.XPTY0004,
110+
"Type error: sequence with less or more than one item is not allowed here");}
111111
final AtomicValue rv = rs.itemAt(0).atomize();
112112
for (final NodeProxy current : nodes) {
113113
final AtomicValue lv = current.atomize();

0 commit comments

Comments
 (0)