[ 
https://issues.apache.org/jira/browse/DAFFODIL-2574?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Steve Lawrence resolved DAFFODIL-2574.
--------------------------------------
    Resolution: Fixed

Fixed in commit 6650eb918e370cfb4eba1809939aca91684572cc

> Cast error when multiplying two unsignedBytes
> ---------------------------------------------
>
>                 Key: DAFFODIL-2574
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2574
>             Project: Daffodil
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 3.1.0
>            Reporter: Kyle Rosales
>            Assignee: Steve Lawrence
>            Priority: Major
>             Fix For: 4.1.0
>
>         Attachments: shortCastBug.tdml
>
>
> Ran into an issue when trying to multiple two elements of type unsignedByte 
> together in a `dfdl:occursCount`. It is causing a cast exception trying to 
> convert java.lang.integer to a java.lang.short. I was able to work around it 
> by casing once of the bytes as an integer ` dfdl:occursCount="\{ ../value1 * 
> xs:unsignedInt(../value2) }”`. Attached is a tdml demonstrating the error.
> {code:java}
> org.apache.daffodil.exceptions.Abort: Invariant broken. Runtime.scala - 
> Leaked exception: java.lang.ClassCastException: java.lang.Integer cannot be 
> cast to java.lang.Short
> java.lang.ClassCastException: java.lang.Integer cannot be cast to 
> java.lang.Short
> at 
> org.apache.daffodil.infoset.DataValue$.getShort$extension(DataValue.scala:76)
> at 
> org.apache.daffodil.dpath.UnsignedByteToLong$.computeValue(ConverterOps3.scala:94)
> at 
> org.apache.daffodil.dpath.UnsignedByteToLong$.computeValue(ConverterOps3.scala:93)
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to