Steve Lawrence created DAFFODIL-2441:
----------------------------------------

             Summary: Compiling a non DFDL schema with warnings turned off 
results in an Abort
                 Key: DAFFODIL-2441
                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2441
             Project: Daffodil
          Issue Type: Bug
          Components: Front End
    Affects Versions: 3.0.0
            Reporter: Steve Lawrence


Say we accidentally try to compile a non-DFDL schema (i.e. a schema without the 
DFDL namespace prefix defined). In this case we get a warning like so:
{code}
[warning] Schema Definition Warning: Non-DFDL Schema file ignored. Does not 
have DFDL namespace definition on schema root element.
...
{code}
In this case, we simply do not generate a parser, and the warning alerts that 
user as to why.

But if we try to compile the same schema with warinings disabled (i.e. 
suppressSchemaDefinitionWarnings=all), then we get the following invariant:
{code}
org.apache.daffodil.exceptions.Abort: Invariant broken: diags.length.>(0)
org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129)
org.apache.daffodil.compiler.Compiler.org$apache$daffodil$compiler$Compiler$$compileSourceInternal(Compiler.scala:332)
org.apache.daffodil.compiler.Compiler$.org$apache$daffodil$compiler$Compiler$$compileSourceSynchronizer(Compiler.scala:367)
org.apache.daffodil.compiler.Compiler.compileSource(Compiler.scala:314)
        at org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129)
        at 
org.apache.daffodil.compiler.Compiler.org$apache$daffodil$compiler$Compiler$$compileSourceInternal(Compiler.scala:332)
        at 
org.apache.daffodil.compiler.Compiler$.org$apache$daffodil$compiler$Compiler$$compileSourceSynchronizer(Compiler.scala:367)
        at 
org.apache.daffodil.compiler.Compiler.compileSource(Compiler.scala:314)
{code}

This assertion is hit if the processor factory returns an error during 
compilation (which occurs in this case because we don't have a DFDL schema) but 
does not have any diagnostics related to the error. In this case, we don't have 
any diagnostics because we disabled the warning that we would normally output.

Some potential solutions:
1. Change the SDW to an SDE, so the diagnostic cannot be ignored. This might 
seem reasonable, but it is allowed to import a non-DFDL schema into a DFDL 
schema, so we need to ensure that this case is either still an SDW or does not 
create a diagnostic. So there might be different cases where this is an SDE vs 
SDW. 
1. Just remove this invariant check, since this is case where pf.isError can be 
true, but there is no related diagnostic. However, that might be unhelpful 
since it's not uncommon for users to suppress all warnings, and so the user 
gets no indication that a parser was not created.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to