Skip to content

Jaxp13XPathTemplate uses thread-unsafe XPathFactory as field [SWS-613] #728

@gregturn

Description

@gregturn

Jeroen van Erp opened SWS-613 and commented

The XPathFactory provided by Sun in the JDK mentions it's not threadsafe, see: http://java.sun.com/javase/6/docs/api/javax/xml/xpath/XPathFactory.html. Though it is not clear from documentation nor code which of the methods is not threadsafe. It can either be:
a) The XPathFactory.newInstance(...) method: In which case Jaxp13XPathTemplate should clearly document that it should only be constructed once for an entire application to prvent concurrency bugs
b) Any of the other instance methods: In which case Jaxp13XPathTemplate should not use XPathFactory as a field if it wants to be threadsafe.

This means that at the moment the Jaxp13XPathTemplate deviates from other Spring templates, such as JdbcTemplate etc, as these are all threadsafe.


Affects: 1.5.9

Referenced from: commits 5ec05e2, 7dfe4a3

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions