[
https://issues.apache.org/jira/browse/DAFFODIL-2056?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Josh Adams resolved DAFFODIL-2056.
----------------------------------
Resolution: Fixed
Assignee: Dave Thompson (was: Josh Adams)
Fix Version/s: 2.3.0
Fixed in commit f072199eb4d0cc0254b570d9bd79e11672fdf428
> 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
> Assignee: Dave Thompson
> Priority: Major
> Fix For: 2.3.0
>
>
> 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)