This is an automated email from the ASF dual-hosted git repository.

olabusayo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil.git


The following commit(s) were added to refs/heads/main by this push:
     new b2431b6df Replace `ParseError` with `MultiException` in `FuzzData`
b2431b6df is described below

commit b2431b6df049370d1f8165fc2438d61df5c617f6
Author: olabusayoT <[email protected]>
AuthorDate: Wed Feb 25 14:05:31 2026 -0500

    Replace `ParseError` with `MultiException` in `FuzzData`
    
    - Consolidated exception handling under `handleKnownException` to manage 
both `MultiException` and `ParseError`. This is because MultiException.toss can 
throw either a ParseError or a MultiException
    - Adjusted related method and variable names for consistency.
    
    DAFFODIL-3075
---
 .../org/apache/daffodil/core/util/FuzzData.scala    | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git 
a/daffodil-core/src/main/scala/org/apache/daffodil/core/util/FuzzData.scala 
b/daffodil-core/src/main/scala/org/apache/daffodil/core/util/FuzzData.scala
index dff7a28fb..a92cb79f0 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/core/util/FuzzData.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/core/util/FuzzData.scala
@@ -23,6 +23,7 @@ import scala.xml.Elem
 import scala.xml.Node
 
 import org.apache.daffodil.lib.exceptions.Assert
+import org.apache.daffodil.lib.exceptions.MultiException
 import org.apache.daffodil.lib.util.Misc.getAMessage
 import org.apache.daffodil.lib.xml.XMLUtils
 import org.apache.daffodil.lib.xml.XMLUtils.XMLDifferenceException
@@ -146,7 +147,11 @@ class FuzzParseTester(
 
   val okParses = new mutable.HashSet[(Node, Array[Byte], 
XMLDifferenceException)]
 
-  protected def handleParseError(p: ParseError, testData: Array[Byte], i: Int) 
= {
+  protected def handleKnownException(
+    ex: Exception,
+    testData: Array[Byte],
+    i: Int
+  ) = {
     // do nothing by default
   }
 
@@ -175,8 +180,8 @@ class FuzzParseTester(
         try {
           TestUtils.runDataProcessorOnInputStream(p, bais, areTracing = false)
         } catch {
-          case p: ParseError => {
-            handleParseError(p, testData, i)
+          case ex @ (_: MultiException[Throwable] @unchecked | _: ParseError) 
=> {
+            handleKnownException(ex, testData, i)
             (null, null)
           }
           case t: Throwable => {
@@ -207,13 +212,17 @@ class LayerParseTester(
 
   var shouldFail = false
 
-  override def handleParseError(p: ParseError, data: Array[Byte], nth: Int): 
Unit = {
-    val msg = getAMessage(p)
+  override def handleKnownException(
+    ex: Exception,
+    data: Array[Byte],
+    nth: Int
+  ): Unit = {
+    val msg = getAMessage(ex)
     if (excludes.exists { msg.contains(_) }) {
       // we know about this one
     } else {
       // new parse error type
-      println(s"trial $nth produced $p")
+      println(s"trial $nth produced $ex")
       shouldFail = true
     }
   }

Reply via email to