olabusayoT commented on code in PR #1567:
URL: https://github.com/apache/daffodil/pull/1567#discussion_r2392474115
##########
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:
Hmm I think I prefer us checking against the value passed in by the user.
Rather than an implied value,@mbeckerle thoughts?
--
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]