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

Jaxp13XPathTemplate uses thread-unsafe XPathFactory as field

    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.

        Activity

        ajvanerp Jeroen van Erp created issue -
        arjen.poutsma Arjen Poutsma made changes -
        Field Original Value New Value
        Fix Version/s 2.0 M2 [ 11390 ]
        arjen.poutsma Arjen Poutsma made changes -
        Fix Version/s 1.5.10 [ 11497 ]
        arjen.poutsma Arjen Poutsma made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        arjen.poutsma Arjen Poutsma logged work - 11/May/10 8:09 PM
        • Time Spent:
          19m
           
          <No comment>
        arjen.poutsma Arjen Poutsma made changes -
        Remaining Estimate 0d [ 0 ]
        Time Spent 19m [ 1140 ]
        arjen.poutsma Arjen Poutsma made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Fixed in 2.0 and 1.5 branches.

        Show
        arjen.poutsma Arjen Poutsma added a comment - Fixed in 2.0 and 1.5 branches.
        Hide
        edh Edwin Dhondt added a comment -

        Arjen, can this bug be the cause for http://forum.springsource.org/showthread.php?t=107721 ?

        Show
        edh Edwin Dhondt added a comment - Arjen, can this bug be the cause for http://forum.springsource.org/showthread.php?t=107721 ?
        Hide
        edh Edwin Dhondt added a comment -

        In addition to my previous content ? How can I get a hold (using Maven) of the 1.5.10 release ?

        Show
        edh Edwin Dhondt added a comment - In addition to my previous content ? How can I get a hold (using Maven) of the 1.5.10 release ?
        Hide
        edh Edwin Dhondt added a comment -

        Is this really fixed in the 2.0 branch because in 2.0.x Jaxp13XPathTemplate still has XPathFactory as a field: "private XPathFactory xpathFactory".

        Show
        edh Edwin Dhondt added a comment - Is this really fixed in the 2.0 branch because in 2.0.x Jaxp13XPathTemplate still has XPathFactory as a field: "private XPathFactory xpathFactory".
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        @Edwin: Note that the createXPath() method is synchronized, and that's the only place the field is used. So yes, it is fixed.

        Show
        arjen.poutsma Arjen Poutsma added a comment - @Edwin: Note that the createXPath() method is synchronized, and that's the only place the field is used. So yes, it is fixed.
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Closing old issues

        Show
        arjen.poutsma Arjen Poutsma added a comment - Closing old issues
        arjen.poutsma Arjen Poutsma made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        47d 17h 18m 1 Arjen Poutsma 11/May/10 7:49 PM
        In Progress In Progress Resolved Resolved
        20m 20s 1 Arjen Poutsma 11/May/10 8:10 PM
        Resolved Resolved Closed Closed
        723d 10h 53m 1 Arjen Poutsma 04/May/12 7:03 AM

          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