scala-xml icon indicating copy to clipboard operation
scala-xml copied to clipboard

Concurrent modification exception under XML.load

Open scabug opened this issue 14 years ago • 6 comments

Dispatch user reported this bug: https://github.com/n8han/Databinder-Dispatch/issues/33

Dispatch is using the load method of the XML singleton object from potentially many threads. The stack trace suggests that the the static method SAXParserFactory.newInstance called in XML.load -> XMLLoader.loadXML is not thread safe. This factory should only be instantiated one time and the instance retained for all calls to newSAXParser; otherwise, if the factory itself is rebuilt on each call to XML.load it will need to be synchronized.

caught javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl could not be instantiated: java.util.ConcurrentModificationException
javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl could not be instantiated: java.util.ConcurrentModificationException
at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:134)
at scala.xml.factory.XMLLoader$class.parser(XMLLoader.scala:28)
at scala.xml.XML$.parser(XML.scala:40)
at scala.xml.factory.XMLLoader$class.load(XMLLoader.scala:53)
at scala.xml.XML$.load(XML.scala:40)
at dispatch.HandlerVerbs$$anonfun$$less$greater$1.apply(handlers.scala:88)

scabug avatar Jul 11 '11 04:07 scabug

Imported From: https://issues.scala-lang.org/browse/SI-4836?orig=1 Reporter: Nathan (n8han)

scabug avatar Jul 11 '11 04:07 scabug

@SethTisue said: The scala-xml library is now community-maintained. Issues with it are now tracked at https://github.com/scala/scala-xml/issues instead of here in the Scala JIRA.

Interested community members: if you consider this issue significant, feel free to open a new issue for it on GitHub, with links in both directions.

scabug avatar Jul 17 '15 23:07 scabug

Is this problem fixed? I can't find the corresponding ticket in the scala-xml repo. 🤔

guizmaii avatar Oct 26 '20 23:10 guizmaii

Is this problem fixed?

it nearly certainly isn't

SethTisue avatar Oct 27 '20 01:10 SethTisue

I'll transfer the issue. In 2015, that capability didn't exist on GitHub.

SethTisue avatar Oct 27 '20 01:10 SethTisue

Thanks @SethTisue :)

guizmaii avatar Oct 27 '20 01:10 guizmaii