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

abort: invariant broken when assert test expression does not return boolean

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.2.1
    • None
    • Back End, Middle "End"
    • None

    Description

      Debugging a schema I created this little thing to print out a length I wanted to see:
      ```
      <dfdl:assert test='

      { dfdlx:trace(dfdl:valueLength(message, "bytes"),"contentLen") }

      '/>

      ```
      Notice the mistake. I forgot to compare the value to 0 in the test.
      That expression returns an integer.

      If you fix the expression (add " ge 0") then everything works fine.

      But with the mistake you get an abort at runtime:
      ```
      trace contentLen:DataValue(true)

      org.apache.daffodil.exceptions.Abort: Invariant broken. Runtime.scala - Leaked exception: java.lang.ClassCastException: class java.lang.Boolean cannot be cast to class java.lang.Long (java.lang.Boolean and java.lang.Long are in module java.base of loader 'bootstrap')
      java.lang.ClassCastException: class java.lang.Boolean cannot be cast to class java.lang.Long (java.lang.Boolean and java.lang.Long are in module java.base of loader 'bootstrap')
      at org.apache.daffodil.infoset.DataValue$.getLong$extension(DataValue.scala:78)
      at org.apache.daffodil.dpath.LongToBoolean$.computeValue(ConverterOps.scala:155)
      at org.apache.daffodil.dpath.LongToBoolean$.computeValue(ConverterOps.scala:153)
      at org.apache.daffodil.dpath.Converter.run(DPathRuntime.scala:294)
      at org.apache.daffodil.dpath.CompiledDPath.run(DPathRuntime.scala:141)
      at org.apache.daffodil.dpath.CompiledDPath.runExpression(DPathRuntime.scala:72)
      ```

      Attachments

        Activity

          People

            Unassigned Unassigned
            mbeckerle Mike Beckerle
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: