jadams-tresys commented on code in PR #1572:
URL: https://github.com/apache/daffodil/pull/1572#discussion_r2466056077


##########
daffodil-core/src/main/scala/org/apache/daffodil/runtime1/processors/DaffodilUnparseContentHandlerImpl.scala:
##########
@@ -180,9 +180,13 @@ class DaffodilUnparseContentHandlerImpl(dp: 
DFDL.DataProcessor, output: DFDL.Out
    * coroutine is still unparsing), or if an unexpected exception occurred that
    * prevented unparse from completing. Otherwise returns the UnparseResult.
    */
-  def getUnparseResult: DFDL.UnparseResult = unparseResult.orNull
+  def getUnparseResult: DFDL.UnparseResult =
+    if (maybeUnparseResultOrException.isDefined)
+      maybeUnparseResultOrException.get.toOption.orNull
+    else
+      null
 
-  private var unparseResult: Maybe[DFDL.UnparseResult] = Nope
+  private var maybeUnparseResultOrException: Maybe[Either[Exception, 
DFDL.UnparseResult]] = Nope

Review Comment:
   So this `Either[Exception, DFDL.UnparseResult]` is essentially catching any 
exceptions that get thrown as part of `this.resume(...)` calls?  Pretty neat 
way to handle things.  Feels a little weird to wrap it in a maybe, but I think 
I understand the logic here where this may not ever be getting set by the 
XMLReader and we need to be able to detect that.



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

To unsubscribe, e-mail: [email protected]

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

Reply via email to