stevedlawrence commented on code in PR #1567:
URL: https://github.com/apache/daffodil/pull/1567#discussion_r2392521451
##########
daffodil-core/src/main/scala/org/apache/daffodil/unparsers/runtime1/BCDUnparsers.scala:
##########
@@ -69,41 +72,59 @@ final class BCDIntegerMinimumLengthUnparser(e:
ElementRuntimeData)
}
}
-abstract class BCDDecimalBaseUnparser(e: ElementRuntimeData,
binaryDecimalVirtualPoint: Int)
- extends PackedBinaryDecimalBaseUnparser(e, binaryDecimalVirtualPoint) {
-
- override def fromBigInteger(bigInt: JBigInteger, nBits: Int): Array[Byte] =
+abstract class BCDDecimalBaseUnparser(
+ e: ElementRuntimeData,
+ binaryDecimalVirtualPoint: Int,
+ decimalSigned: YesNo
+) extends PackedBinaryDecimalBaseUnparser(e, binaryDecimalVirtualPoint,
decimalSigned) {
+
+ override def fromBigInteger(bigInt: JBigInteger, nBits: Int): Array[Byte] = {
+ if (bigInt.signum == -1) {
+ UnparseError(
+ One(e.schemaFileLocation),
+ Nope,
+ "Signed numbers with dfdl:binaryNumberRep 'bcd' are always only
positive. %s cannot be negative",
Review Comment:
Alternatively, we could make it an SDE if dfdl:decimalSigned="yes" when
type="xs:decimal" and dfdl:binaryNumberRep="bcd". It feels more consistent to
say certain properties just don't apply with certain combinations of other
properties. Though, maybe mentioning decimalSigned would be a bad idea then.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]