Skip to content

Commit 42f92c0

Browse files
committed
[bugfix] Restore compatibility between org.exist.xquery.ErrorCodes.ErrorCode and externally distributed XQuery Java Modules such as EXPath Crypto Module. Fixes a regression introduced in a4979fb
Closes #130
1 parent af7da3c commit 42f92c0

File tree

35 files changed

+555
-486
lines changed

35 files changed

+555
-486
lines changed

exist-core/src/main/java/org/exist/http/RESTServer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@ private void declareExternalAndXQJVariables(final XQueryContext context,
15241524
}
15251525

15261526
if (localname == null) {
1527-
throw new XPathException(ErrorCodes.W3CErrorCode.XPDY0002, String.format("External variable is missing local name in its qualified name. Prefix=%s URI=%s", prefix, uri));
1527+
throw new XPathException(ErrorCodes.W3CErrorCode.XPDY0002.getErrorCode(), String.format("External variable is missing local name in its qualified name. Prefix=%s URI=%s", prefix, uri));
15281528
}
15291529

15301530
if (uri == null && prefix != null) {
@@ -1539,7 +1539,7 @@ private void declareExternalAndXQJVariables(final XQueryContext context,
15391539
}
15401540

15411541
if (!context.isExternalVariableDeclared(q)) {
1542-
throw new XPathException(ErrorCodes.W3CErrorCode.XPDY0002, "External variable " + q + " is not declared in the XQuery");
1542+
throw new XPathException(ErrorCodes.W3CErrorCode.XPDY0002.getErrorCode(), "External variable " + q + " is not declared in the XQuery");
15431543
}
15441544

15451545
if (uri != null && prefix != null) {

exist-core/src/main/java/org/exist/xmldb/LocalXPathQueryService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,11 +434,11 @@ protected void declareVariables(final XQueryContext context) throws XPathExcepti
434434
try {
435435
varName = QName.parse(context, varNameStr);
436436
} catch (final QName.IllegalQNameException e) {
437-
throw new XPathException(org.exist.xquery.ErrorCodes.W3CErrorCode.XPST0081, "Error declaring variable, invalid qname: " + varNameStr + ". " + e.getMessage(), e);
437+
throw new XPathException(org.exist.xquery.ErrorCodes.W3CErrorCode.XPST0081.getErrorCode(), "Error declaring variable, invalid qname: " + varNameStr + ". " + e.getMessage(), e);
438438
}
439439

440440
if (!context.isExternalVariableDeclared(varName)) {
441-
throw new XPathException(org.exist.xquery.ErrorCodes.W3CErrorCode.XPDY0002, "External variable " + varName + " is not declared in the XQuery");
441+
throw new XPathException(org.exist.xquery.ErrorCodes.W3CErrorCode.XPDY0002.getErrorCode(), "External variable " + varName + " is not declared in the XQuery");
442442
}
443443

444444
context.declareVariable(varName, true, entry.getValue());

exist-core/src/main/java/org/exist/xmldb/RemoteXPathQueryService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ private XPathException errorToXPathException(final Map result) {
204204
final QName qname = new QName(localPart, namespaceUri, prefix);
205205
errorCode = org.exist.xquery.ErrorCodes.fromQName(qname);
206206
} else {
207-
errorCode = org.exist.xquery.ErrorCodes.EXistErrorCode.ERROR;
207+
errorCode = org.exist.xquery.ErrorCodes.EXistErrorCode.ERROR.getErrorCode();
208208
}
209209

210210
return new XPathException(line, column, errorCode, message);

exist-core/src/main/java/org/exist/xmlrpc/RpcConnection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,11 @@ protected QueryResult doQuery(final DBBroker broker, final CompiledXQuery compil
279279
try {
280280
varName = QName.parse(context, varNameStr);
281281
} catch (final QName.IllegalQNameException e) {
282-
throw new XPathException(org.exist.xquery.ErrorCodes.W3CErrorCode.XPST0081, "Error declaring variable, invalid qname: " + varNameStr + ". " + e.getMessage(), e);
282+
throw new XPathException(org.exist.xquery.ErrorCodes.W3CErrorCode.XPST0081.getErrorCode(), "Error declaring variable, invalid qname: " + varNameStr + ". " + e.getMessage(), e);
283283
}
284284

285285
if (!context.isExternalVariableDeclared(varName)) {
286-
throw new XPathException(org.exist.xquery.ErrorCodes.W3CErrorCode.XPDY0002, "External variable " + varName + " is not declared in the XQuery");
286+
throw new XPathException(org.exist.xquery.ErrorCodes.W3CErrorCode.XPDY0002.getErrorCode(), "External variable " + varName + " is not declared in the XQuery");
287287
}
288288

289289
if (LOG.isDebugEnabled()) {

0 commit comments

Comments
 (0)