Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-2574

Cast error when multiplying two unsignedBytes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.1.0
    • 4.0.0
    • General
    • None

    Description

      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.

      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)
      

      Attachments

        1. shortCastBug.tdml
          4 kB
          Kyle Rosales

        Activity

          People

            slawrence Steve Lawrence
            kjrosales Kyle Rosales
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: