You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: exist-core/src/main/java/org/exist/xquery/functions/fn/FnFormatNumbers.java
+41-3Lines changed: 41 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -401,7 +401,7 @@ private Tuple2<SubPicture, Optional<SubPicture>> analyzePictureString(final Deci
401
401
subPicture.clearSuffix();
402
402
403
403
subPicture.incrementMaximumFractionalPartSize();
404
-
} elseif (c == decimalFormat.patternSeparator) {
404
+
} elseif (c == decimalFormat.patternSeparator) {
405
405
capturePrefix = false;
406
406
subPicture.clearSuffix();
407
407
@@ -442,17 +442,55 @@ private Tuple2<SubPicture, Optional<SubPicture>> analyzePictureString(final Deci
442
442
break; // end of FRACTIONAL_PART
443
443
444
444
445
-
446
445
caseEXPONENT_PART:
446
+
447
447
if (c == decimalFormat.decimalSeparator
448
-
|| c == decimalFormat.exponentSeparator
449
448
|| c == decimalFormat.groupingSeparator
450
449
|| c == decimalFormat.digit) {
451
450
capturePrefix = false;
452
451
subPicture.clearSuffix();
453
452
454
453
thrownewXPathException(this, ErrorCodes.FODF1310, "format-number() sub-picture in $picture cannot have any active characters following the exponent-separator-sign");
455
454
455
+
} elseif (c == decimalFormat.exponentSeparator) {
456
+
457
+
/*
458
+
A character that matches the exponent-separator property is treated as an
459
+
exponent-separator-sign if it is both preceded and followed within the
460
+
sub-picture by an active character.
461
+
*/
462
+
463
+
// we need to peek at the next char to determine if it is active
if (isActiveChar(decimalFormat, prevChar) && nextIsActive) {
472
+
// this is an exponent-separator-sign... but we already have one
473
+
capturePrefix = false;
474
+
subPicture.clearSuffix();
475
+
476
+
thrownewXPathException(this, ErrorCodes.FODF1310, "format-number() sub-picture in $picture cannot have any active characters following the exponent-separator-sign");
thrownewXPathException(this, ErrorCodes.FODF1310, "format-number() sub-picture cannot contain a percent character as it already has an exponent separator sign.");
486
+
}
487
+
488
+
if (subPicture.hasPerMille()) {
489
+
thrownewXPathException(this, ErrorCodes.FODF1310, "format-number() sub-picture cannot contain a per-mille character as it already has an exponent separator sign.");
0 commit comments