Skip to content

Commit f68d83c

Browse files
committed
[bugfix] A decimal format must only define the same property once
1 parent 057b9c0 commit f68d83c

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
@@ -554,7 +554,9 @@ throws PermissionDeniedException, EXistException, XPathException
554554
if (pv.length() >= 2 && (pv.startsWith("\"") || pv.startsWith("'"))) {
555555
pv = pv.substring(1, pv.length() - 1);
556556
}
557-
dfProperties.put(pn, pv);
557+
if (dfProperties.put(pn, pv) != null) {
558+
throw new XPathException(dfName.getLine(), dfName.getColumn(), ErrorCodes.W3CErrorCode.XQST0114.getErrorCode(), "Decimal format: " + dfName.getText() + " defines the property: " + pn + " more than once.");
559+
}
558560

559561
current = (XQueryAST) pval.getNextSibling();
560562
}

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)