You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Kyle Rosales (Jira)" <ji...@apache.org> on 2021/11/01 13:07:00 UTC

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

Kyle Rosales created DAFFODIL-2574:
--------------------------------------

             Summary: 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
         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.3.4#803005)