|Parser returned from LaunchingPlugin.getParser() not threadsafe [message #639555]
||Tue, 16 November 2010 16:36
| Mike Youngstrom
Registered: July 2009
I've noticed several places in eclipse's code base that invoke LaunchingPlugin.getParser() to acquire a DocumentBuilder instance to parse some xml. This is fine except that when used in this way LaunchingPlugin is functioning as a singleton and the DocumentBuilder implementation returned from LaunchingPlugin is not threadsafe.|
This causes exceptions similar to:
org.xml.sax.SAXException: FWK005 parse may not be called while parsing.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(D OMParser.java:263)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl. parse(DocumentBuilderImpl.java:284)
Should LaunchPlugin be modified to return a new instance of DocumentBuilder for each thread? I cannot seem to find any unifying place where modification of launch configurations can be synchronized. In a quick search of some code I found JavaRuntime.newRuntimeClasspathEntry() and Tomcat60Configuration.load() both invoking LaunchPlugin.getParser() directly so it appears plugin developers are assuming the DocumentBuilder returned from LaunchPlugin.getParser() is threadsafe.
Thoughs? Should I file an issue?
Powered by FUDForum
. Page generated in 0.02403 seconds