Hello David, Can you test with the 1.4-SNAPSHOT code from trunk? (You'll have to check it out and build it).
In trunk, NodePointer.java:80) is: pointer = new NullPointer(name, locale); which can't throw an NPE. I have not looked at this code in a while, now that multi-core CPUs are common place I am not surprised to see issues like this. I am not even sure why the statics in JXPathContext are lazy loaded (at least they are volatile). It would simplify the code to just init the statics in-line. Thank you, Gary On Thu, Sep 12, 2013 at 10:11 PM, David Ferry <[email protected]> wrote: > Hi > > We're using Apache JXPath 1.3. We have multi-threaded code running > JXPathContext.newContext > > We're having an occasional NullPointerException coming out of > NodePointer.newNodePointer > > We've had a look at the code for this class, and wonder if > getNodePointerFactories is not synchronising correctly. > > Other operations that read or write the attribute nodeFactoryArray ... > synchronize on nodeFactories. > > But in getNodePointerFactories() ... it just returns the variable without > locking. > This makes us think that there is no happens-before in the > getNodePointerFactories() method. > > I've put a snippet of the stack trace below. > > Apologies if this has come up before, I didn't manage to find it after a > while searching. > > Regards, > -David > > java.lang.NullPointerException > at > org.apache.commons.jxpath.ri.model.NodePointer.newNodePointer(NodePointer.java:80) > at > org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.<init>(JXPathContextReferenceImpl.java:193) > at > org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.<init>(JXPathContextReferenceImpl.java:167) > at > org.apache.commons.jxpath.ri.JXPathContextFactoryReferenceImpl.newContext(JXPathContextFactoryReferenceImpl.java:39) > at > org.apache.commons.jxpath.JXPathContext.newContext(JXPathContext.java:416) > -- E-Mail: [email protected] | [email protected] Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> Spring Batch in Action <http://www.manning.com/templier/> Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory
