Skip to content

Commit

Permalink
Merge pull request #1630 from adamretter/hotfix/qname-error-code
Browse files Browse the repository at this point in the history
[bugfix] Inability compare a QName should result in XPTY0004
  • Loading branch information
dizzzz authored Nov 27, 2017
2 parents cc88a66 + 7999a1f commit 4aba29f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/org/exist/xquery/value/QNameValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,8 @@ public boolean compareTo(Collator collator, Comparison operator, AtomicValue oth
throw new XPathException(ErrorCodes.XPTY0004, "cannot apply operator to QName");
}
} else {
throw new XPathException(
"Type error: cannot compare QName to "
+ Type.getTypeName(other.getType()));
throw new XPathException(ErrorCodes.XPTY0004, "Type error: cannot compare QName to "
+ Type.getTypeName(other.getType()));
}
}

Expand Down
14 changes: 13 additions & 1 deletion test/src/xquery/namespaces.xql
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,16 @@ function nt:ns-default-constructor() {
element stuff {$n}
}/stuff
)
};
};

declare
%test:assertError("XPTY0004")
function nt:qname-rhs-compare() {
'test' eq xs:QName('test')
};

declare
%test:assertError("XPTY0004")
function nt:qname-lhs-compare() {
xs:QName('test') eq 'test'
};

0 comments on commit 4aba29f

Please sign in to comment.