You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Steve Lawrence (Jira)" <ji...@apache.org> on 2022/03/10 13:42:00 UTC

[jira] [Comment Edited] (DAFFODIL-2668) Variable Error caused by ignored newVariableInstance in Group Annotation

    [ https://issues.apache.org/jira/browse/DAFFODIL-2668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504269#comment-17504269 ] 

Steve Lawrence edited comment on DAFFODIL-2668 at 3/10/22, 1:41 PM:
--------------------------------------------------------------------

Agreed with Josh. In fact, reading through the spec I don't think dfdl annotations are allowed at all on xs:group declarations, only on xs:group references. I think there has to be a choice or a sequence inside the group that carries the annotation. So instead of an SDE when newVariableInstacne is on a group, we should SDE when any DFDL annotation is on a group.


was (Author: slawrence):
Agreed with Josh. In fact, reading through the spec I don't think dfdl annotations are allowed at all on xs:group declarations, only on xs:group references. I think there has to be a choice or a sequence inside the group that carries the annotation.

> Variable Error caused by ignored newVariableInstance in Group Annotation
> ------------------------------------------------------------------------
>
>                 Key: DAFFODIL-2668
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2668
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Back End
>    Affects Versions: 3.2.1
>            Reporter: Olabusayo Kilo
>            Priority: Major
>             Fix For: 3.3.0
>
>
> Variable Error caused by ignored newVariableInstance in Group Annotation
> (Note: repo with changes currently exists in a private repo. See comment for details on accessing the repo)
> When a newVariableInstance is declared in a statement annotation in a group containing a choice, it causes an error that the variable has no defaultValue, but if the statement annotation is wrapped in a sequence with the choice, it works as expected.
> The 2 below should be equivalent.
>  
> {code:xml}
> <!-- causes variable error -->
> <xs:annotation>
>   <xs:appinfo source="http://www.ogf.org/dfdl/">
>     <dfdl:format ref="ms:msCommon" />
>     <dfdl:defineVariable name="messageID" type="xs:string"/>
>   </xs:appinfo>
> </xs:annotation>
> <!-- shorthand -->
> <group>
>   <annotation>
>     <dfdl:newVariableInstance ref="cmvmf:messageID" defaultValue="{...}"/>
>   </annotation>
>   <choice choiceDispatchKey="{ $cmvmf:messageID}">...</choice>
> </group>
> {code}
>  
> {code:xml}
> <!--no error-->
> <xs:annotation>
>   <xs:appinfo source="http://www.ogf.org/dfdl/">
>     <dfdl:format ref="ms:msCommon" />
>     <dfdl:defineVariable name="messageID" type="xs:string"/>
>   </xs:appinfo>
> </xs:annotation>
> <!-- shorthand -->
> <group>
>   <sequence>
>     <annotation>
>         <dfdl:newVariableInstance ref="cmvmf:messageID" defaultValue="{...}"/>
>     </annotation>
>     <choice choiceDispatchKey="{ $cmvmf:messageID}">...</choice>
>   </sequence>
> </group>
> {code}
>  
>  
> {noformat}
> // variable error
> org.apache.daffodil.tdml.TDMLExceptionImpl: (Implementation: daffodil) RuntimeSchemaDefinitionError: Runtime Schema Definition Error: Variable Error: Variable map (runtime): variable cmvmf:messageID has no value. It was not set, and has no default value.
> Schema context: cmvmf:messageID Location line 53 column 14 in file:/home/okilo/git/DFDLSchemas/dfdl-noc-vmfa/target/classes/com/owlcyberdefense/mil-std-6017/xsd/vmfChoiceOfMessages.dfdl.xsd
> Schema context: message Location line 49 column 14 in file:/home/okilo/git/DFDLSchemas/dfdl-noc-vmfa/target/classes/com/owlcyberdefense/noc/xsd/message_content_type.dfdl.xsd
> Data location was preceding byte 57 limit(bytes) 78
> Caused by: Runtime Schema Definition Error: Variable Error: Variable map (runtime): variable cmvmf:messageID has no value. It was not set, and has no default value.
> Schema context: cmvmf:messageID Location line 53 column 14 in file:/home/okilo/git/DFDLSchemas/dfdl-noc-vmfa/target/classes/com/owlcyberdefense/mil-std-6017/xsd/vmfChoiceOfMessages.dfdl.xsd
> Schema context: message Location line 49 column 14 in file:/home/okilo/git/DFDLSchemas/dfdl-noc-vmfa/target/classes/com/owlcyberdefense/noc/xsd/message_content_type.dfdl.xsd
> Data location was preceding byte 57 limit(bytes) 78
>     at org.apache.daffodil.processors.parsers.DoSDEMixin.doSDE(ParseErrors.scala:102)
>     at org.apache.daffodil.processors.parsers.DoSDEMixin.doSDE$(ParseErrors.scala:95)
>     at org.apache.daffodil.dpath.RuntimeExpressionDPath.doSDE(DPath.scala:73)
>     at org.apache.daffodil.dpath.RuntimeExpressionDPath.handleCompileState(DPath.scala:169)
>     at org.apache.daffodil.dpath.RuntimeExpressionDPath.handleThrow(DPath.scala:333)
>     at org.apache.daffodil.dpath.RuntimeExpressionDPath.evaluateMaybe(DPath.scala:266)
>     at org.apache.daffodil.dpath.RuntimeExpressionDPath.evaluate(DPath.scala:275)
>     at org.apache.daffodil.processors.ExprEvalMixin.eval(Evaluatable.scala:404)
>     at org.apache.daffodil.processors.ExprEvalMixin.eval$(Evaluatable.scala:398)
>     at org.apache.daffodil.processors.EvaluatableConvertedExpression.eval(Evaluatable.scala:485)
>     at org.apache.daffodil.processors.EvaluatableConvertedExpressionMixin.compute(Evaluatable.scala:470)
>     at org.apache.daffodil.processors.EvaluatableConvertedExpressionMixin.compute$(Evaluatable.scala:469)
>     at org.apache.daffodil.processors.EvaluatableConvertedExpression.compute(Evaluatable.scala:485)
>     at org.apache.daffodil.processors.InfosetCachedEvaluatable.getCachedOrComputeAndCache(Evaluatable.scala:90)
>     at org.apache.daffodil.processors.InfosetCachedEvaluatable.getCachedOrComputeAndCache$(Evaluatable.scala:68)
>     at org.apache.daffodil.processors.ChoiceDispatchKeyEv.getCachedOrComputeAndCache(EvElement.scala:284)
>     at org.apache.daffodil.processors.Evaluatable.evaluate(Evaluatable.scala:284)
>     at org.apache.daffodil.processors.parsers.ChoiceDispatchCombinatorParser.computeDispatchKey(ElementKindParsers.scala:235)
>     at org.apache.daffodil.processors.parsers.ChoiceDispatchCombinatorParserBase.parse(ElementKindParsers.scala:159)
>     at org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:82)
>     at org.apache.daffodil.processors.parsers.Parser.parse1$(Parser.scala:76)
>     at org.apache.daffodil.processors.parsers.CombinatorParser.parse1(Parser.scala:161)
>     at org.apache.daffodil.processors.parsers.Unseparated.parseOne(UnseparatedSequenceParsers.scala:29)
>     at org.apache.daffodil.processors.parsers.Unseparated.parseOne$(UnseparatedSequenceParsers.scala:27)
>     at org.apache.daffodil.processors.parsers.ScalarOrderedUnseparatedSequenceChildParser.parseOne(UnseparatedSequenceParsers.scala:37)
>     at org.apache.daffodil.processors.parsers.SequenceParserBase.parseOneInstanceWithMaybePoU(SequenceParserBases.scala:437)
>     at org.apache.daffodil.processors.parsers.SequenceParserBase.parseOneInstance(SequenceParserBases.scala:422)
>     at org.apache.daffodil.processors.parsers.SequenceParserBase.parse(SequenceParserBases.scala:265)
>     at org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:82)
>     at org.apache.daffodil.processors.parsers.Parser.parse1$(Parser.scala:76)
>     at org.apache.daffodil.processors.parsers.CombinatorParser.parse1(Parser.scala:161)
>     at org.apache.daffodil.processors.parsers.ElementParserBase.parse(ElementCombinator1.scala:135)
>     at org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:82)
>     at org.apache.daffodil.processors.parsers.Parser.parse1$(Parser.scala:76)
>     at org.apache.daffodil.processors.parsers.CombinatorParser.parse1(Parser.scala:161)
>     at org.apache.daffodil.processors.parsers.Unseparated.parseOne(UnseparatedSequenceParsers.scala:29)
>     at org.apache.daffodil.processors.parsers.Unseparated.parseOne$(UnseparatedSequenceParsers.scala:27)
>     at org.apache.daffodil.processors.parsers.RepOrderedWithMinMaxUnseparatedSequenceChildParser.parseOne(UnseparatedSequenceParsers.scala:64)
>     at org.apache.daffodil.processors.parsers.SequenceParserBase.parseOneInstanceWithMaybePoU(SequenceParserBases.scala:437)
>     at org.apache.daffodil.processors.parsers.SequenceParserBase.parseOneInstance(SequenceParserBases.scala:417)
>     at org.apache.daffodil.processors.parsers.SequenceParserBase.parse(SequenceParserBases.scala:157)
>     at org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:82)
>     at org.apache.daffodil.processors.parsers.Parser.parse1$(Parser.scala:76)
>     at org.apache.daffodil.processors.parsers.CombinatorParser.parse1(Parser.scala:161)
>     at org.apache.daffodil.processors.parsers.SeqCompParser.parse(Parser.scala:177)
>     at org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:82)
>     at org.apache.daffodil.processors.parsers.Parser.parse1$(Parser.scala:76)
>     at org.apache.daffodil.processors.parsers.CombinatorParser.parse1(Parser.scala:161)
>     at org.apache.daffodil.processors.parsers.ElementParserBase.parse(ElementCombinator1.scala:135)
>     at org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:82)
>     at org.apache.daffodil.processors.parsers.Parser.parse1$(Parser.scala:76)
>     at org.apache.daffodil.processors.parsers.CombinatorParser.parse1(Parser.scala:161)
>     at org.apache.daffodil.processors.parsers.Unseparated.parseOne(UnseparatedSequenceParsers.scala:29)
>     at org.apache.daffodil.processors.parsers.Unseparated.parseOne$(UnseparatedSequenceParsers.scala:27)
>     at org.apache.daffodil.processors.parsers.ScalarOrderedUnseparatedSequenceChildParser.parseOne(UnseparatedSequenceParsers.scala:37)
>     at org.apache.daffodil.processors.parsers.SequenceParserBase.parseOneInstanceWithMaybePoU(SequenceParserBases.scala:437)
>     at org.apache.daffodil.processors.parsers.SequenceParserBase.parseOneInstance(SequenceParserBases.scala:422)
>     at org.apache.daffodil.processors.parsers.SequenceParserBase.parse(SequenceParserBases.scala:265)
>     at org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:82)
>     at org.apache.daffodil.processors.parsers.Parser.parse1$(Parser.scala:76)
>     at org.apache.daffodil.processors.parsers.CombinatorParser.parse1(Parser.scala:161)
>     at org.apache.daffodil.processors.parsers.SpecifiedLengthParserBase.parse(SpecifiedLengthParsers.scala:76)
>     at org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:82)
>     at org.apache.daffodil.processors.parsers.Parser.parse1$(Parser.scala:76)
>     at org.apache.daffodil.processors.parsers.CombinatorParser.parse1(Parser.scala:161)
>     at org.apache.daffodil.processors.parsers.ElementParserBase.parse(ElementCombinator1.scala:135)
>     at org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:82)
>     at org.apache.daffodil.processors.parsers.Parser.parse1$(Parser.scala:76)
>     at org.apache.daffodil.processors.parsers.CombinatorParser.parse1(Parser.scala:161)
>     at org.apache.daffodil.processors.parsers.Unseparated.parseOne(UnseparatedSequenceParsers.scala:29)
>     at org.apache.daffodil.processors.parsers.Unseparated.parseOne$(UnseparatedSequenceParsers.scala:27)
>     at org.apache.daffodil.processors.parsers.ScalarOrderedUnseparatedSequenceChildParser.parseOne(UnseparatedSequenceParsers.scala:37)
>     at org.apache.daffodil.processors.parsers.SequenceParserBase.parseOneInstanceWithMaybePoU(SequenceParserBases.scala:437)
>     at org.apache.daffodil.processors.parsers.SequenceParserBase.parseOneInstance(SequenceParserBases.scala:422)
>     at org.apache.daffodil.processors.parsers.SequenceParserBase.parse(SequenceParserBases.scala:265)
>     at org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:82)
>     at org.apache.daffodil.processors.parsers.Parser.parse1$(Parser.scala:76)
>     at org.apache.daffodil.processors.parsers.CombinatorParser.parse1(Parser.scala:161)
>     at org.apache.daffodil.processors.parsers.SeqCompParser.parse(Parser.scala:177)
>     at org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:82)
>     at org.apache.daffodil.processors.parsers.Parser.parse1$(Parser.scala:76)
>     at org.apache.daffodil.processors.parsers.CombinatorParser.parse1(Parser.scala:161)
>     at org.apache.daffodil.processors.parsers.ElementParserBase.parse(ElementCombinator1.scala:135)
>     at org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:82)
>     at org.apache.daffodil.processors.parsers.Parser.parse1$(Parser.scala:76)
>     at org.apache.daffodil.processors.parsers.CombinatorParser.parse1(Parser.scala:161)
>     at org.apache.daffodil.processors.parsers.Unseparated.parseOne(UnseparatedSequenceParsers.scala:29)
>     at org.apache.daffodil.processors.parsers.Unseparated.parseOne$(UnseparatedSequenceParsers.scala:27)
>     at org.apache.daffodil.processors.parsers.ScalarOrderedUnseparatedSequenceChildParser.parseOne(UnseparatedSequenceParsers.scala:37)
>     at org.apache.daffodil.processors.parsers.SequenceParserBase.parseOneInstanceWithMaybePoU(SequenceParserBases.scala:437)
>     at org.apache.daffodil.processors.parsers.SequenceParserBase.parseOneInstance(SequenceParserBases.scala:422)
>     at org.apache.daffodil.processors.parsers.SequenceParserBase.parse(SequenceParserBases.scala:265)
>     at org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:82)
>     at org.apache.daffodil.processors.parsers.Parser.parse1$(Parser.scala:76)
>     at org.apache.daffodil.processors.parsers.CombinatorParser.parse1(Parser.scala:161)
>     at org.apache.daffodil.processors.parsers.ElementParserBase.parse(ElementCombinator1.scala:135)
>     at org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:82)
>     at org.apache.daffodil.processors.parsers.Parser.parse1$(Parser.scala:76)
>     at org.apache.daffodil.processors.parsers.CombinatorParser.parse1(Parser.scala:161)
>     at org.apache.daffodil.processors.parsers.Unseparated.parseOne(UnseparatedSequenceParsers.scala:29)
>     at org.apache.daffodil.processors.parsers.Unseparated.parseOne$(UnseparatedSequenceParsers.scala:27)
>     at org.apache.daffodil.processors.parsers.RepOrderedWithMinMaxUnseparatedSequenceChildParser.parseOne(UnseparatedSequenceParsers.scala:64)
>     at org.apache.daffodil.processors.parsers.SequenceParserBase.parseOneInstanceWithMaybePoU(SequenceParserBases.scala:437)
>     at org.apache.daffodil.processors.parsers.SequenceParserBase.parseOneInstance(SequenceParserBases.scala:417)
>     at org.apache.daffodil.processors.parsers.SequenceParserBase.parse(SequenceParserBases.scala:157)
>     at org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:82)
>     at org.apache.daffodil.processors.parsers.Parser.parse1$(Parser.scala:76)
>     at org.apache.daffodil.processors.parsers.CombinatorParser.parse1(Parser.scala:161)
>     at org.apache.daffodil.processors.parsers.ElementParserBase.parse(ElementCombinator1.scala:135)
>     at org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:82)
>     at org.apache.daffodil.processors.parsers.Parser.parse1$(Parser.scala:76)
>     at org.apache.daffodil.processors.parsers.CombinatorParser.parse1(Parser.scala:161)
>     at org.apache.daffodil.processors.DataProcessor.doParse(DataProcessor.scala:503)
>     at org.apache.daffodil.processors.DataProcessor.parse(DataProcessor.scala:447)
>     at org.apache.daffodil.tdml.processor.DaffodilTDMLDFDLProcessor.doParseWithBothApis(DaffodilTDMLDFDLProcessor.scala:311)
>     at org.apache.daffodil.tdml.processor.DaffodilTDMLDFDLProcessor.parse(DaffodilTDMLDFDLProcessor.scala:248)
>     at org.apache.daffodil.tdml.processor.DaffodilTDMLDFDLProcessor.parse(DaffodilTDMLDFDLProcessor.scala:253)
>     at org.apache.daffodil.tdml.ParserTestCase.doParseExpectSuccess(TDMLRunner.scala:1069)
>     ... 33 more
> Caused by: Variable Error: Variable map (runtime): variable cmvmf:messageID has no value. It was not set, and has no default value.
> Schema context: cmvmf:messageID Location line 53 column 14 in file:/home/okilo/git/DFDLSchemas/dfdl-noc-vmfa/target/classes/com/owlcyberdefense/mil-std-6017/xsd/vmfChoiceOfMessages.dfdl.xsd
> {noformat}
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)