Skip to content

Commit 38cedd0

Browse files
committed
[bugfix] A decimal format must only define the same property once
1 parent 4d1d399 commit 38cedd0

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

exist-core/src/main/antlr/org/exist/xquery/parser/XQueryTree.g

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,9 @@ throws PermissionDeniedException, EXistException, XPathException
560560
if (pv.length() >= 2 && (pv.startsWith("\"") || pv.startsWith("'"))) {
561561
pv = pv.substring(1, pv.length() - 1);
562562
}
563-
dfProperties.put(pn, pv);
563+
if (dfProperties.put(pn, pv) != null) {
564+
throw new XPathException(dfName.getLine(), dfName.getColumn(), ErrorCodes.W3CErrorCode.XQST0114.getErrorCode(), "Decimal format: " + dfName.getText() + " defines the property: " + pn + " more than once.");
565+
}
564566

565567
current = (XQueryAST) pval.getNextSibling();
566568
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ public enum W3CErrorCode implements IErrorCode {
225225
XQDY0102 ("If the name of an element in an element constructor is in no namespace, creating a default namespace for that element using a computed namespace constructor is an error."),
226226
XQST0103 ("All variables in a window clause must have distinct names."),
227227
XQST0111 ("It is a static error for a query prolog to contain two decimal formats with the same name, or to contain two default decimal formats."),
228+
XQST0114 ("It is a static error for a decimal format declaration to define the same property more than once."),
228229
XQDY0137 ("No two keys in a map may have the same key value"),
229230
XQDY0138 ("Position n does not exist in this array"),
230231
XUDY0023 ("It is a dynamic error if an insert, replace, or rename expression affects an element node by introducing a new namespace binding that conflicts with one of its existing namespace bindings."),

0 commit comments

Comments
 (0)