Skip to content

Commit 32bc90f

Browse files
Avoid possible serialization issues related to ArraySeq
The ArraySeq class has been known to cause deserialization failures related to saving/reloading parsers because the class is written in a way as to cause serialization sensitivity to changes in the class. We don't use ArraySeq in any of our serialized classes, but Scala implements varargs using ArraySeq, and we do use varargs in the serialized CompiledDPath class. This can make serialized objects sensitive to different versions of Scala if they make changes to the class. We do not need any of the features provided by ArraySeq or varargs, so this converts the ops member of CompiledDPath to an Array, avoiding potential deserialzation issues with future versions of Daffodil. DAFFODIL-3073
1 parent 41e02e7 commit 32bc90f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

daffodil-core/src/main/scala/org/apache/daffodil/runtime1/dpath/DPathRuntime.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
package org.apache.daffodil.runtime1.dpath
1919

20-
import scala.collection.immutable.ArraySeq
2120
import scala.xml.NodeSeq.seqToNodeSeq
2221

2322
import org.apache.daffodil.lib.exceptions.Assert
@@ -42,9 +41,10 @@ import org.apache.daffodil.runtime1.processors.VariableException
4241
import org.apache.daffodil.runtime1.processors.VariableHasNoValue
4342
import org.apache.daffodil.runtime1.processors.VariableRuntimeData
4443

45-
class CompiledDPath(val ops: RecipeOp*) extends Serializable {
44+
class CompiledDPath(val ops: Array[RecipeOp]) extends Serializable {
4645

47-
def this(ops: List[RecipeOp]) = this(ArraySeq.unsafeWrapArray(ops.toArray)*)
46+
def this(ops: RecipeOp*) = this(ops.toArray)
47+
def this(ops: List[RecipeOp]) = this(ops.toArray)
4848

4949
override def toString =
5050
toXML.toString

0 commit comments

Comments
 (0)