Skip to content

Commit 11a5419

Browse files
committed
[bugfix] Picture string provided to fn:format-number cannot contain an exponent and also a percent or per-mille character
1 parent 1f3d901 commit 11a5419

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

exist-core/src/main/java/org/exist/xquery/functions/fn/FnFormatNumbers.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,14 @@ private Tuple2<SubPicture, Optional<SubPicture>> analyzePictureString(final Deci
484484
} else {
485485
/* passive character */
486486
analyzePassiveChar(decimalFormat, c, capturePrefix, subPicture);
487+
488+
if (subPicture.hasPercent()) {
489+
throw new XPathException(this, ErrorCodes.FODF1310, "format-number() sub-picture cannot contain a percent character as it already has an exponent separator sign.");
490+
}
491+
492+
if (subPicture.hasPerMille()) {
493+
throw new XPathException(this, ErrorCodes.FODF1310, "format-number() sub-picture cannot contain a per-mille character as it already has an exponent separator sign.");
494+
}
487495
}
488496

489497
break; // end of EXPONENT_PART

0 commit comments

Comments
 (0)