stevedlawrence commented on a change in pull request #138: Adding error when 
dfdl:initiator is "%"
URL: https://github.com/apache/incubator-daffodil/pull/138#discussion_r233828806
 
 

 ##########
 File path: 
daffodil-core/src/main/scala/org/apache/daffodil/dsom/RuntimePropertyMixins.scala
 ##########
 @@ -186,6 +186,9 @@ trait DelimitedRuntimeValuedPropertiesMixin
     val qn = this.qNameForProperty("initiator")
     val typeIfStaticallyKnown = NodeInfo.String
     val typeIfRuntimeKnown = NodeInfo.NonEmptyString
+    if (initiatorRaw.value == "%") {
 
 Review comment:
   I'm not sure if this is the right fix for this, for a couple reasons:
   1. This only fixes initiators, but my guess is that this same bug applies to 
separators and terminators, and maybe even other properties. Might be worth 
adding a few extra tests to make sure this issue is resolved with other 
properties, and not just initiator/terminator/separator.
   2. If the initiator was an expression that evaluated to a percent, e.g. ``{ 
"%" }``, this check wouldn't find it since this only checks the raw value. We 
really need to check the value after it's been evaluated, whether it's a 
constant or an expression.
   
   So fixing the root issue probably means a change somewhere in the Cookers, 
which all properties use and which are also used after expression evaluation. 
Take a look at the EntityReplacer, which is used by the cookers for handle char 
classes. The replaceEntity function already has one SDE for invalid dfdl 
entities using regular expressions (see the replaceEntity function), so likely 
a tweak just needs to be made there.
   
   Also, when testing this, I noticed that not only does a single percent not 
work, but a single percent at the end also doesn't throw an error, e.g. 
dfdl:initiator="foo%". Sounds like whatever is checking for invalid dfdl 
entities doesn't handle the edge case of a percent at the end of the string, 
rather than just a single %.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to