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/10 21:06:00 UTC

[jira] [Created] (DAFFODIL-2479) Using %#x25; character class causes invariant abort

Steve Lawrence created DAFFODIL-2479:
----------------------------------------

             Summary: Using %#x25; character class causes invariant abort
                 Key: DAFFODIL-2479
                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2479
             Project: Daffodil
          Issue Type: Bug
          Components: Front End
    Affects Versions: 3.0.0
            Reporter: Steve Lawrence


I have a file format where it is natural to specify initiators using hex character classes because the specification uses hex values. One case of this is an initator that has a value of 0x25 in hex. In ASCII encoding this is the percent character (%). For example:
{code:xml}
<xs:element name="foo" type="xs:string" dfdl:initiator="%#x25;" />
{code}
Using the above leads to the following invariant abort:
{code:none}
org.apache.daffodil.exceptions.Abort: Invariant broken. delimStr should not end in an isolated single %. DelimStr = %
org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129)
org.apache.daffodil.exceptions.Assert$.invariantFailed(Assert.scala:175)
org.apache.daffodil.processors.Delimiter.buildDelimBuf(DFDLDelimiter.scala:331)
org.apache.daffodil.processors.Delimiter.compileDelimiter(DFDLDelimiter.scala:69)
	at org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129)
	at org.apache.daffodil.exceptions.Assert$.invariantFailed(Assert.scala:175)
	at org.apache.daffodil.processors.Delimiter.buildDelimBuf(DFDLDelimiter.scala:331)
	at org.apache.daffodil.processors.Delimiter.compileDelimiter(DFDLDelimiter.scala:69)
	at org.apache.daffodil.processors.dfa.CreateDelimiterDFA$.apply(CreateDelimiterDFA.scala:68)
	at org.apache.daffodil.processors.dfa.CreateDelimiterDFA$.$anonfun$apply$3(CreateDelimiterDFA.scala:97)
{code}
It looks like Daffodil is treating this exactly as if it were a "%". For example, if I change the initiator to this:
{code:xml}
<xs:element name="foo" type="xs:string" dfdl:initiator="%#x25;NL;" />
{code}
then it looks for a newline initator (i.e. %NL;)

Note that {{dfdl:initiator="%"}} does give a helpful error message, so this is specific to using a character class entity that encodes to a percent.

The workaround is to specify the initiator as "%%" (i.e. an escaped percent). This works fine, but is not ideal in this case because all initiators are better described using hex values.



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