git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] stevedlawrence commented on a change in pull request #61: Base64, gzip, and line-folding layering


stevedlawrence commented on a change in pull request #61: Base64, gzip, and line-folding layering
URL: https://github.com/apache/incubator-daffodil/pull/61#discussion_r185545826
 
 

 ##########
 File path: daffodil-core/src/main/scala/org/apache/daffodil/dsom/SequenceGroup.scala
 ##########
 @@ -245,6 +248,31 @@ abstract class SequenceTermBase(
       maybeCheckBitOrderAndCharset)
   }
 
+  private val layeredSequenceAllowedProps = Set("ref", "layerTransform", "layerEncoding", "layerLengthKind", "layerLength", "layerLengthUnits", "layerBoundaryMark")
+
+  final lazy val maybeLayerTransformerEv: Maybe[LayerTransformerEv] = {
+    if (maybeLayerTransformEv.isEmpty) Maybe.Nope
+    else { // need to check that only layering properties are specified
+      val localProps = this.formatAnnotation.justThisOneProperties
+      val localKeys = localProps.keySet
+      val disallowedKeys = localKeys.filterNot(k => layeredSequenceAllowedProps.contains(k))
+      if (disallowedKeys.size > 0)
+        SDE("Sequence has dfdl:layerTransform specified, so cannot have non-layering properties: %s", disallowedKeys)
 
 Review comment:
   Should this be something like ``disallowedKeys.mkString(", ")`` so the output isn't something like ``cannot have non-layering properties: Seq("foo", "bar")``. Also, does formatAnnotation.justThisOneProperties filter out annotations in other namespaces, which should be allowed? Might be worth adding a test to make sure this works as expected?

----------------------------------------------------------------
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:
users@xxxxxxxxxxxxxxxx


With regards,
Apache Git Services