Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-613

Jaxp13XPathTemplate uses thread-unsafe XPathFactory as field

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.9
    • Fix Version/s: 2.0 M2, 1.5.10
    • Component/s: XML
    • Labels:
      None

      Description

      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.

        Attachments

          Activity

            People

            Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            ajvanerp Jeroen van Erp
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 19m
                19m