Deyan Atanasov created DAFFODIL-2961:
----------------------------------------
Summary: When using a bcd element as length for a subsequent field
a ClassCastException is thrown
Key: DAFFODIL-2961
URL: https://issues.apache.org/jira/browse/DAFFODIL-2961
Project: Daffodil
Issue Type: Bug
Components: CLI, DFDL Schemas
Affects Versions: 3.9.0
Reporter: Deyan Atanasov
I am trying to use a BCD number as a lenght parameter, when parsing an ISO8583
dialect.
Here is the corresponding schema:
<xs:element dfdl:binaryNumberRep="bcd" dfdl:length="1"
dfdl:occursCount="\{/ISO8583OpenWay/PrimaryBitmap/Bit002}"
dfdl:representation="binary" maxOccurs="1" minOccurs="0" name="Len_002"
type="xs:unsignedInt">
</xs:element>
<!-- TODO fix to be calculated -->
<xs:element dfdl:length="\{xs:int(fn:ceiling(/ISO8583OpenWay/Len_002[1] div 2)
)}" dfdl:lengthKind="explicit"
dfdl:occursCount="\{xs:unsignedInt(/ISO8583OpenWay/PrimaryBitmap/Bit002)}"
ibmDfdlExtn:sampleValue="1111111111111111111" minOccurs="0"
name="PrimaryAccountNumber_002" type="isotyp:Type_b_hexBinary">
</xs:element>
and here is the output from the CLI:
<Len_002>16</Len_002>
<PrimaryAccountNumber_002></PrimaryAccountNumber_002>
and an eception is throwned:
org.apache.daffodil.lib.exceptions.Abort: Invariant broken. Runtime.scala -
Leaked exception: java.lang.ClassCastException: class java.math.BigInteger
cannot be cast to class java.lang.Long (java.math.BigInteger and java.lang.Long
are in module java.base of loader 'bootstrap')
java.lang.ClassCastException: class java.math.BigInteger cannot be cast to
class java.lang.Long (java.math.BigInteger and java.lang.Long are in module
java.base of loader 'bootstrap')
at
org.apache.daffodil.runtime1.infoset.DataValue$.getLong$extension(DataValue.scala:91)
How can I code the Len_002 field so to bypass the exception ?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)