Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-2588

abort when external variable has no namespace

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 3.1.0
    • 3.2.0
    • Front End
    • None

    Description

      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)

      Attachments

        1. external_var_schema_error.xsd
          2 kB
          Mike Beckerle

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mbeckerle Mike Beckerle
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: