Community
Participate
Working Groups
Build Identifier: M20110909-1335 TaglibIndex is not thread safe which can result in an NPE. void fireCurrentDelta(Object trigger) { if (fCurrentTopLevelDelta != null) { fCurrentTopLevelDelta.trigger = trigger; ITaglibIndexDelta delta = fCurrentTopLevelDelta; fCurrentTopLevelDelta = null; fireTaglibDelta(delta); } } ... is not protected against multiple thread access so it is possible that fCurrentTopLevelDelta will be non-null when 2 threads enter the 'if' block and be subsequently set to null by the first thread before the second thread executes the statement 'ITaglibIndexDelta delta = fCurrentTopLevelDelta;'. This would cause a NullPointerException in fireTaglibDelta(delta) since delta will be null. Reproducible: Sometimes Steps to Reproduce: This is a race condition and I have only had the NPE logged once after thousands of executions.
Nice catch, Andrew. Thanks for the report! I've synchronized the code in that block.