You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Dave Thompson (Jira)" <ji...@apache.org> on 2020/12/14 17:47:00 UTC

[jira] [Closed] (DAFFODIL-2352) dfdl:newVariableInstance with non-constant defaultValue fails

     [ https://issues.apache.org/jira/browse/DAFFODIL-2352?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dave Thompson closed DAFFODIL-2352.
-----------------------------------

Verified the specified commit (commit fbefd3a2a8648e354d5c9bdcb2325bd1f84a8fb4) is included in the latest pull from the incubator-daffodil repository.

Verified the all incubator-daffodil sbt test suites execute successfully including the new tests added.

Verified the nightly test schemas compile and save successfully.

Verified the nightly test suite executes successfully.

Note: one test that was added caused an "unhandled NoSuchElement exception" and was coomented out. This is addressed in Jira ticket DAFFODIL- 2444.

> 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
>            Priority: Critical
>             Fix For: 3.1.0
>
>
> 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)