[
https://issues.apache.org/jira/browse/DAFFODIL-2352?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Josh Adams reassigned DAFFODIL-2352:
------------------------------------
Assignee: Josh Adams
> dfdl:newVariableInstance with non-constant defaultValue fails
> -------------------------------------------------------------
>
> Key: DAFFODIL-2352
> URL: https://issues.apache.org/jira/browse/DAFFODIL-2352
> Project: Daffodil
> Issue Type: Bug
> Components: Back End
> Affects Versions: 2.6.0
> Reporter: Steve Lawrence
> Assignee: Josh Adams
> Priority: Critical
>
> If we have a schema with newVariableInstance that uses a non-constant DFDL
> expression for the default value, that default value is never set. For
> example:
> {code:xsd}
> <xs:sequence>
> <xs:annotation>
> <xs:appinfo source="http://www.ogf.org/dfdl/">
> <dfdl:newVariableInstance ref="foo" defaultValue="{
> /some/non/constant/thing }" />
> </xs:appinfo>
> </xs:annotation>
> <xs:element name="fooValue" type="xs:int" dfdl:inputValueCalc="{ $foo }" />
> </xs:sequence>
> {code}
> When the inputValueCalc expressoin is evaluated, we fail with the error
> {code}
> Runtime Schema Definition Error: Variable Error: Variable map (runtime):
> variable foo has no value. It was not set, and has no default value.
> {code}
> According to the spec:
> {code}
> If a default value is specified this initial value of the instance will be
> set when the instance is created
> {code}
> So we are likely just missing the logic to evaluate and set the default when
> when we create the new VariableInstacne.
> This might also affect dfdl:defineVariable as well, which is allowed to also
> have expressions as the defaultValue, as long as the expression doesn't
> reference the infoset and only other variables.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)