Skip to content

Commit 0ad68be

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 4151e8c
Closes #130
1 parent f9ec476 commit 0ad68be

35 files changed

Lines changed: 555 additions & 486 deletions

File tree

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

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

15031503
if (localname == null) {
1504-
throw new XPathException(ErrorCodes.W3CErrorCode.XPDY0002, String.format("External variable is missing local name in its qualified name. Prefix=%s URI=%s", prefix, uri));
1504+
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));
15051505
}
15061506

15071507
if (uri == null && prefix != null) {
@@ -1516,7 +1516,7 @@ private void declareExternalAndXQJVariables(final XQueryContext context,
15161516
}
15171517

15181518
if (!context.isExternalVariableDeclared(q)) {
1519-
throw new XPathException(ErrorCodes.W3CErrorCode.XPDY0002, "External variable " + q + " is not declared in the XQuery");
1519+
throw new XPathException(ErrorCodes.W3CErrorCode.XPDY0002.getErrorCode(), "External variable " + q + " is not declared in the XQuery");
15201520
}
15211521

15221522
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
@@ -431,11 +431,11 @@ protected void declareVariables(final XQueryContext context) throws XPathExcepti
431431
try {
432432
varName = QName.parse(context, varNameStr);
433433
} catch (final QName.IllegalQNameException e) {
434-
throw new XPathException(org.exist.xquery.ErrorCodes.W3CErrorCode.XPST0081, "Error declaring variable, invalid qname: " + varNameStr + ". " + e.getMessage(), e);
434+
throw new XPathException(org.exist.xquery.ErrorCodes.W3CErrorCode.XPST0081.getErrorCode(), "Error declaring variable, invalid qname: " + varNameStr + ". " + e.getMessage(), e);
435435
}
436436

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

441441
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
@@ -209,7 +209,7 @@ private XPathException errorToXPathException(final Map result) {
209209
final QName qname = new QName(localPart, namespaceUri, prefix);
210210
errorCode = org.exist.xquery.ErrorCodes.fromQName(qname);
211211
} else {
212-
errorCode = org.exist.xquery.ErrorCodes.EXistErrorCode.ERROR;
212+
errorCode = org.exist.xquery.ErrorCodes.EXistErrorCode.ERROR.getErrorCode();
213213
}
214214

215215
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)