tenderlove/nokogiri — pull request #685 by aselder (2012-05-23 06:59:16+00:00)
Title: Fix JRuby thread safety bugs causes by shared Xpath object [#682]

This pull request fixes #682.

First in XmlXpathContext.java, each XmlXpathContext object should have
it's own XPath object, instead of sharing one across the class. XPath
objects are not thread-safe as documented in the official Java
documentation.

Secondly, NokogiriService was giving Nokogiri::XML::XPathContext
objects their XmlXpathContext by cloning a single XmlXpathContext
object. Since this is a shallow clone, all those context objects shared
a reference to a single underlying XPath object. This change has the
NokogiriService create a new XmlXpathContext from scratch rather than
cloning an existing one.