Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8047329

Parse errors when multiple threads call XPathExpression.evaluate(InputSource) on different objects

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 8u5
    • xml
    • None

      If multiple threads call evaluate(InputSource) concurrently on different XPathExpression objects, they fail with the following exception:

      org.xml.sax.SAXException: FWK005 parse may not be called while parsing.
      at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:271)
      at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:348)
      at com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:302)
      at com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:332)
      at XPathRepro.lambda$main$0(XPathRepro.java:13)
      at XPathRepro$$Lambda$1/142257191.run(Unknown Source)
      at java.lang.Thread.run(Thread.java:745)
      --------------- linked to ------------------
      javax.xml.xpath.XPathExpressionException: org.xml.sax.SAXException: FWK005 parse may not be called while parsing.
      at com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:305)
      at com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:332)
      at XPathRepro.lambda$main$0(XPathRepro.java:13)
      at XPathRepro$$Lambda$1/142257191.run(Unknown Source)
      at java.lang.Thread.run(Thread.java:745)
      Caused by: org.xml.sax.SAXException: FWK005 parse may not be called while parsing.
      at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:271)
      at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:348)
      at com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:302)
      ... 4 more

      See the attached XPathRepro.java for how to reproduce.

      I think such errors would have been expected if the threads had called evaluate() on the same XPathExpression object. But the repro gives each thread its own instance of XPathExpression to work on, so I wouldn't expect any interference between the threads in this case.

            joehw Joe Wang
            khatlen Knut Anders Hatlen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: