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 2021/03/11 14:26:00 UTC
[jira] [Created] (DAFFODIL-2480) Externally setting variables
causes Abort/MatchError
Steve Lawrence created DAFFODIL-2480:
----------------------------------------
Summary: Externally setting variables causes Abort/MatchError
Key: DAFFODIL-2480
URL: https://issues.apache.org/jira/browse/DAFFODIL-2480
Project: Daffodil
Issue Type: Bug
Components: CLI, Front End
Affects Versions: 3.0.0
Reporter: Steve Lawrence
Say you have a schema that defines a variable "foo" that cannot be set externally (e.g. external="false"). If we try to set any variable (whether or not it is defined in the schmea), we get the following error:
{code:none}
$ daffodil parse -Dfoo=1 ...
scala.MatchError: (ex:foo,MStack(top=VariableInstance(VariableDefined,DataValue(1),ex:foo,One(CompiledExpression(1)),VariableUndefined,NoValue))) (of class scala.Tuple2)
at org.apache.daffodil.processors.VariableMap.$anonfun$externalVarGlobalQNames$1(VariableMap1.scala:305)
at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:273)
at scala.collection.mutable.HashMap.$anonfun$foreach$1(HashMap.scala:149)
at scala.collection.mutable.HashTable.foreachEntry(HashTable.scala:237)
at scala.collection.mutable.HashTable.foreachEntry$(HashTable.scala:230)
at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:44)
at scala.collection.mutable.HashMap.foreach(HashMap.scala:149)
{code}
So a schema with at least one non-external variable means you cannot set any variables externally.
Similary, say all variables are external, but we try to set a variable that doesn't exist. Then we get the following
{code:none}
$ daffodil parse -Ddne=1 ...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! An unexpected exception occurred. This is a bug! !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Please report this bug and help us fix it:
https://daffodil.apache.org/community/#issue-tracker
Please include the following exception, the command you
ran, and any input, schema, or tdml files used that led
to this bug.
Schema Definition Error: unknown variable dne
Schema context: element reference ex:root Location line 36 in file:/home/slawrence/owl/daffodil/dfdl-schemas.git/dfdl-csv/src/main/resources/com/tresys/csv/xsd/csv.dfdl.xsd
at org.apache.daffodil.dsom.ImplementsThrowsSDE.SDE(SDE.scala:179)
at org.apache.daffodil.dsom.ImplementsThrowsSDE.SDE$(SDE.scala:178)
at org.apache.daffodil.processors.TermRuntimeData.SDE(RuntimeData.scala:101)
{code}
So we do get an SDE about "unknown variable", but that SDE makes its way out of diagnostics and the CLI reports it as a bug.
I haven't testing how the API handles this, but presumably the issue is the same since that's what the CLI uses. When this is fixed, CLI and API tests should be added to make sure this works and correct error diagnostics are returned.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)