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/11/18 18:25:00 UTC

[jira] [Resolved] (DAFFODIL-2588) abort when external variable has no namespace

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

Steve Lawrence resolved DAFFODIL-2588.
--------------------------------------
    Fix Version/s: 3.2.0
       Resolution: Fixed

I've confirmed that I can reproduce the issue on 3.1.0, and that it is fixed on the latest main branch. My guess is DAFFODIL-2480 fixed this, so resolving this as a duplicate of that issue.

> abort when external variable has no namespace
> ---------------------------------------------
>
>                 Key: DAFFODIL-2588
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2588
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Front End
>    Affects Versions: 3.1.0
>            Reporter: Mike Beckerle
>            Priority: Major
>             Fix For: 3.2.0
>
>         Attachments: external_var_schema_error.xsd
>
>
> Reported by a user:
> I found a problem in Daffodil 3.1.0 using external and not-external variables when specifying the external variable without namespace.
> Using attached schema:
> daffodil parse –s external_var_schema_error.xsd –Dexternalvar=1 dummyfile
> The below error is given.
> It does not happen when specifying namespace with the externalvar on the command line.
> Though I don’t know Scala, looking at VariableMap1.scala:464, it seems to me the “vTable.map” expects all items to be mapped, while the “if .. external” only maps the external variables, causing the below error for non-external variables. I guess it needs a filter operation before the “map” to first get the external variables, then “map” to get the globalQName.
>  
> For us the use of the external variable name without namespace is useful, because we use it in several schema in the same way, and pass in the value at run-time. Not having to know the namespace of the schema being used makes it much easier for the user and our code.
>  
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> !!   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.
> scala.MatchError: ({urn:test:external-var}internalvar,ArrayBuffer(VariableInstance(VariableUndefined,NoValue,internalvar,Nope,VariableUndefined,NoValue))) (of class scala.Tuple2)
> at org.apache.daffodil.processors.VariableMap.$anonfun$externalVarGlobalQNames$1(VariableMap1.scala:464)
> at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:286)
> 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)
> at scala.collection.TraversableLike.map(TraversableLike.scala:286)
> at scala.collection.TraversableLike.map$(TraversableLike.scala:279)
> at scala.collection.AbstractTraversable.map(Traversable.scala:108)
> at org.apache.daffodil.processors.VariableMap.externalVarGlobalQNames$lzycompute(VariableMap1.scala:464)
> at org.apache.daffodil.processors.VariableMap.externalVarGlobalQNames(VariableMap1.scala:463)
> at org.apache.daffodil.processors.VariableMap.setExtVariable(VariableMap1.scala:473)
> at org.apache.daffodil.processors.VariableUtils$.$anonfun$setExternalVariables$1(VariableMap1.scala:162)
> at org.apache.daffodil.processors.VariableUtils$.$anonfun$setExternalVariables$1$adapted(VariableMap1.scala:162)
> at scala.collection.Iterator.foreach(Iterator.scala:943)
> at scala.collection.Iterator.foreach$(Iterator.scala:943)
> at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)
> at scala.collection.IterableLike.foreach(IterableLike.scala:74)
> at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
> at scala.collection.AbstractIterable.foreach(Iterable.scala:56)
> at org.apache.daffodil.processors.VariableUtils$.setExternalVariables(VariableMap1.scala:162)
> at org.apache.daffodil.externalvars.ExternalVariablesLoader$.loadVariables(ExternalVariablesLoader.scala:46)
> at org.apache.daffodil.processors.DataProcessor.loadExternalVariables(DataProcessor.scala:286)
> at org.apache.daffodil.processors.DataProcessor.withExternalVariables(DataProcessor.scala:332)
> at org.apache.daffodil.processors.DataProcessor.withExternalVariables(DataProcessor.scala:129)
> at org.apache.daffodil.Main$.$anonfun$run$1(Main.scala:902)
> at scala.Option.map(Option.scala:230)
> at org.apache.daffodil.Main$.run(Main.scala:902)
> at org.apache.daffodil.Main$.main(Main.scala:1569)
> at org.apache.daffodil.Main.main(Main.scala)



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