You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Mike Beckerle (Jira)" <ji...@apache.org> on 2023/04/26 20:04:00 UTC

[jira] [Updated] (DAFFODIL-2574) Cast error when multiplying two unsignedBytes

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

Mike Beckerle updated DAFFODIL-2574:
------------------------------------
    Fix Version/s: 3.5.1
                       (was: 3.5.0)

> 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
>            Priority: Major
>             Fix For: 3.5.1
>
>         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)