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

Implicit expression conversion from xs:string to xs:hexBinary causes exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.0
    • 2.3.0
    • Front End
    • None

    Description

      Assume the following schema snippet:

      <xs:element name="xs:hexBinary" type="xs:hexBinary" dfdl:inputValueCalc="{ xs:string('DEADBEEF') }" />
      

      As of Daffodil 2.3.0, we allow implicit conversions between the result of an expression and the expected type. So this should insert an implicit conversion from xs:string (the resulting type) to xs:hexBinary (the expected type). But this results in the following exception: 

      java.lang.ClassCastException: org.apache.daffodil.dpath.XSHexBinary$ cannot be cast to org.apache.daffodil.dpath.RecipeOp
      	at org.apache.daffodil.dpath.Conversion$.conversionOps(Conversions.scala:147)
      	at org.apache.daffodil.dpath.Expression.conversions$lzycompute(Expression.scala:120)
      	at org.apache.daffodil.dpath.Expression.conversions(Expression.scala:117)
      	at org.apache.daffodil.dpath.FNOneArgExpr.compiledDPath$lzycompute(Expression.scala:1869)
      	at org.apache.daffodil.dpath.FNOneArgExpr.compiledDPath(Expression.scala:1865)
      	at org.apache.daffodil.dpath.FunctionCallExpression.compiledDPath$lzycompute(Expression.scala:1317)
      	at org.apache.daffodil.dpath.FunctionCallExpression.compiledDPath(Expression.scala:1317)
      	at org.apache.daffodil.dpath.WholeExpression.compiledDPath$lzycompute(Expression.scala:636)
      	at org.apache.daffodil.dpath.WholeExpression.compiledDPath(Expression.scala:636)
      	at org.apache.daffodil.dpath.DFDLPathExpressionParser.compile(DFDLExpressionParser.scala:54)
      

      Eventually this implicit conversion will be disabled, but since it is allowed we should fix this.

      The workaround is to be explicit about the conversion, e.g.:

      <xs:element name="xs:hexBinary" type="xs:hexBinary" dfdl:inputValueCalc="{ xs:hexBinary(xs:string('DEADBEEF')) }" />
      

      Attachments

        Activity

          People

            dfthompson Dave Thompson
            slawrence Steve Lawrence
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: