jadams-tresys closed pull request #130: Initial commit
URL: https://github.com/apache/incubator-daffodil/pull/130
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/daffodil-lib/src/main/scala/org/apache/daffodil/cookers/EntityReplacer.scala 
b/daffodil-lib/src/main/scala/org/apache/daffodil/cookers/EntityReplacer.scala
index 340c4665b..baf804957 100644
--- 
a/daffodil-lib/src/main/scala/org/apache/daffodil/cookers/EntityReplacer.scala
+++ 
b/daffodil-lib/src/main/scala/org/apache/daffodil/cookers/EntityReplacer.scala
@@ -641,7 +641,12 @@ sealed abstract class ListOfStringLiteralBase(
   private lazy val olc = oneLiteralCooker
 
   protected def cook(raw: String, context: ThrowsSDE, forUnparse: Boolean): 
List[String] = {
+    if (raw.length != 0 && (raw.head.isWhitespace || raw.last.isWhitespace)) {
+      context.SDE("The property '%s' cannot start or end with the string \" 
\", did you mean to use '%%SP;' instead?", propNameArg)
+    }
+
     val rawList = raw.split("\\s+").toList
+
     val cooked = {
       val cookedList: ListBuffer[String] = ListBuffer.empty
       rawList.foreach(x => {
diff --git 
a/daffodil-test/src/test/resources/org/apache/daffodil/section12/delimiter_properties/DelimiterProperties.tdml
 
b/daffodil-test/src/test/resources/org/apache/daffodil/section12/delimiter_properties/DelimiterProperties.tdml
index 368f6bf98..281d8b2f0 100644
--- 
a/daffodil-test/src/test/resources/org/apache/daffodil/section12/delimiter_properties/DelimiterProperties.tdml
+++ 
b/daffodil-test/src/test/resources/org/apache/daffodil/section12/delimiter_properties/DelimiterProperties.tdml
@@ -111,6 +111,24 @@
       </xs:complexType>
     </xs:element>
 
+    <xs:element name="DP_04_02" dfdl:lengthKind="implicit">
+      <xs:complexType>
+        <xs:sequence>
+          <xs:element name="s1" type="xs:float"
+            dfdl:terminator=" %WSP+;" maxOccurs="unbounded" />
+        </xs:sequence>
+      </xs:complexType>
+    </xs:element>
+
+    <xs:element name="DP_04_03" dfdl:lengthKind="implicit">
+      <xs:complexType>
+        <xs:sequence>
+          <xs:element name="s1" type="xs:float"
+            dfdl:terminator="%WSP+; " maxOccurs="unbounded" />
+        </xs:sequence>
+      </xs:complexType>
+    </xs:element>
+
   </tdml:defineSchema>
 
   <tdml:defineSchema name="DelimiterProperties-Embedded2.dfdl.xsd">
@@ -316,6 +334,36 @@
     </tdml:infoset>
   </tdml:parserTestCase>
 
+  <tdml:parserTestCase name="DelimProp_10_02" root="DP_04_02"
+    model="DelimiterProperties-Embedded.dfdl.xsd"
+    description="Section 12 property delimiters -use of empty space as 
terminator - DFDL-12-033R Should fail"
+    roundTrip="twoPass">
+
+    <tdml:document><![CDATA[.00300 -02.75
+      3.9900 7.33
+    ]]></tdml:document>
+    <tdml:errors>
+      <tdml:error>Schema Definition Error</tdml:error>
+      <tdml:error>cannot start or end</tdml:error>
+      <tdml:error>use '%SP;' instead</tdml:error>
+    </tdml:errors>
+  </tdml:parserTestCase>
+
+  <tdml:parserTestCase name="DelimProp_10_03" root="DP_04_03"
+    model="DelimiterProperties-Embedded.dfdl.xsd"
+    description="Section 12 property delimiters -use of empty space as 
terminator - DFDL-12-033R Should fail"
+    roundTrip="twoPass">
+
+    <tdml:document><![CDATA[.00300 -02.75
+      3.9900 7.33
+    ]]></tdml:document>
+    <tdml:errors>
+      <tdml:error>Schema Definition Error</tdml:error>
+      <tdml:error>cannot start or end</tdml:error>
+      <tdml:error>use '%SP;' instead</tdml:error>
+    </tdml:errors>
+  </tdml:parserTestCase>
+
   <tdml:parserTestCase name="OptionalWSPTermWithExplicitLength" root="e1"
     model="DelimiterProperties-Embedded2.dfdl.xsd"
     description="Section 14 Sequence groups with delimiters -use of %WSP*; as 
terminator - DFDL-12-033R should pass"
diff --git 
a/daffodil-test/src/test/resources/org/apache/daffodil/section14/sequence_groups/SequenceGroupDelimiters.tdml
 
b/daffodil-test/src/test/resources/org/apache/daffodil/section14/sequence_groups/SequenceGroupDelimiters.tdml
index d84a38d0b..5f553c588 100644
--- 
a/daffodil-test/src/test/resources/org/apache/daffodil/section14/sequence_groups/SequenceGroupDelimiters.tdml
+++ 
b/daffodil-test/src/test/resources/org/apache/daffodil/section14/sequence_groups/SequenceGroupDelimiters.tdml
@@ -444,7 +444,7 @@
       <xs:complexType>
         <xs:sequence dfdl:separator="">
           <xs:element name="quantity" type="xs:int"/>
-          <xs:element name="item" type="xs:string" dfdl:initiator="Item: " />
+          <xs:element name="item" type="xs:string" dfdl:initiator="Item:%SP;" 
/>
         </xs:sequence>
       </xs:complexType>
     </xs:element>
diff --git 
a/daffodil-test/src/test/scala/org/apache/daffodil/section12/delimiter_properties/TestDelimiterProperties.scala
 
b/daffodil-test/src/test/scala/org/apache/daffodil/section12/delimiter_properties/TestDelimiterProperties.scala
index 3cfc9c247..a58635c2d 100644
--- 
a/daffodil-test/src/test/scala/org/apache/daffodil/section12/delimiter_properties/TestDelimiterProperties.scala
+++ 
b/daffodil-test/src/test/scala/org/apache/daffodil/section12/delimiter_properties/TestDelimiterProperties.scala
@@ -59,6 +59,8 @@ class TestDelimiterProperties {
 
   @Test def test_DelimProp_10() = { runner_02.runOneTest("DelimProp_10") }
   @Test def test_DelimProp_10_01() = { runner_02.runOneTest("DelimProp_10_01") 
}
+  @Test def test_DelimProp_10_02() = { runner_02.runOneTest("DelimProp_10_02") 
}
+  @Test def test_DelimProp_10_03() = { runner_02.runOneTest("DelimProp_10_03") 
}
 
   @Test def test_E1() = { runner_02.runOneTest("E1") }
 


 

----------------------------------------------------------------
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