stevedlawrence commented on a change in pull request #102: Added tests that 
exercise ambiguous separator/terminator case.
URL: https://github.com/apache/incubator-daffodil/pull/102#discussion_r210317657
 
 

 ##########
 File path: 
daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/PState.scala
 ##########
 @@ -323,6 +329,26 @@ final class PState private (
   }
 
   override lazy val (regexMatchBuffer, regexMatchBitPositionBuffer) = 
dataProcArg.regexMatchState.get
+
+  /**
+   * Verify that the state is left where we expect it to be after
+   * a normal parse. I.e., stacks have been popped back to their original 
state,
+   * pools - all items returned, etc.
+   *
+   * If for some reason parsing ends with a throw (not supposed to, but just 
if)
+   * then all bets are off, so this must be called ONLY on a normal return 
from parse call.
+   * That is, the parse can succeed or fail with diagnostics, but it must have 
returned normally.
+   */
+  def verifyFinalState(wasThrow: Boolean): Unit = {
+    if (!wasThrow) {
+      markPool.finalCheck
 
 Review comment:
   Should the markPool check should be done regardless of if something was 
thrown or not. Some throws are expected and allowed (e.g Runtime SDE) and we 
need to make sure the markPools are cleaned up appropriately in this case so 
successive parses don't fail. The other ones like stacks are less important 
since the PState is thrown away, but mark pool persist between parses and leaks 
cause real issues.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to