Steve Lawrence created DAFFODIL-2056:
----------------------------------------
Summary: Implicit expression conversion from xs:string to
xs:hexBinary causes exception
Key: DAFFODIL-2056
URL: https://issues.apache.org/jira/browse/DAFFODIL-2056
Project: Daffodil
Issue Type: Bug
Components: Front End
Affects Versions: 2.2.0
Reporter: Steve Lawrence
Assume the following schema snippet:
{code:xml}
<xs:element name="xs:hexBinary" type="xs:hexBinary" dfdl:inputValueCalc="{
xs:string('DEADBEEF') }" />
{code}
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:
{code}
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)
{code}
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.:
{code:xml}
<xs:element name="xs:hexBinary" type="xs:hexBinary" dfdl:inputValueCalc="{
xs:hexBinary(xs:string('DEADBEEF')) }" />
{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)