Description
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:
$ 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)
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
$ 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)
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.
Attachments
Issue Links
- is duplicated by
-
DAFFODIL-2588 abort when external variable has no namespace
- Closed