tuxji commented on a change in pull request #481:
URL: https://github.com/apache/daffodil/pull/481#discussion_r600544452



##########
File path: 
daffodil-lib/src/main/scala/org/apache/daffodil/cookers/EntityReplacer.scala
##########
@@ -616,18 +632,12 @@ class 
SingleCharacterLiteralNoCharClassEntitiesWithByteEntities(pn: String = nul
   extends SingleCharacterLiteralNoCharClassEntities(pn, allowByteEntities = 
true)
 
 class StringLiteralESEntityWithByteEntities(pn: String)
-  extends StringLiteralNoCharClassEntities(pn, allowByteEntities = true) {
+  extends StringLiteralNoCharClassEntities(pn, allowByteEntities = true)
+  with DisallowedCharClassEntitiesMixin {
 
-  /**
-   * Override Because ES is allowed.
-   */
-  override protected def noCharClassEntities(raw: String, context: ThrowsSDE): 
Unit = {
-    context.schemaDefinitionUnless(!raw.contains("%NL;"), "Property dfdl:%s 
cannot contain %%NL;", propName)
-    // ES is allowed
-    context.schemaDefinitionUnless(!raw.contains("%WSP;"), "Property dfdl:%s 
cannot contain %%WSP;", propName)
-    context.schemaDefinitionUnless(!raw.contains("%WSP+;"), "Property dfdl:%s 
cannot contain %%WSP+;", propName)
-    context.schemaDefinitionUnless(!raw.contains("%WSP*;"), "Property dfdl:%s 
cannot contain %%WSP*;", propName)
-  }
+  override val disallowedCharClassEntities = Seq("NL", "WSP", "WSP+", "WSP*")
+  override def testRaw(raw: String, context: ThrowsSDE) =
+    super[DisallowedCharClassEntitiesMixin].testRaw(raw, context)
 }

Review comment:
       We got code not covered by tests warnings for lines 638 and 640.  That 
means this class (StringLiteralESEntityWithByteEntities) isn't covered by any 
tests.  In fact, StringLiteralESEntityWithByteEntities isn't used anywhere in 
the codebase as far as I can see.  Should we remove it?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to