From 471170a411922b07c6605a5f672b6d45cf066389 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Mon, 11 Nov 2024 14:54:49 +0100 Subject: [PATCH] Call `reset` on reusable `SAXParser` instance --- shared/src/main/scala/scala/xml/factory/XMLLoader.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala index afe54330..47ee3708 100644 --- a/shared/src/main/scala/scala/xml/factory/XMLLoader.scala +++ b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala @@ -45,7 +45,11 @@ trait XMLLoader[T <: Node] { } /* Override this to use a different SAXParser. */ - def parser: SAXParser = parserInstance.get + def parser: SAXParser = { + val p = parserInstance.get + p.reset() + p + } /* Override this to use a different XMLReader. */ def reader: XMLReader = parser.getXMLReader