| Summary: | NullPointerException in TaglibIndex due to race condition. | ||
|---|---|---|---|
| Product: | [WebTools] WTP Source Editing | Reporter: | Andrew McCulloch <Andrew.McCulloch> |
| Component: | jst.jsp | Assignee: | Nick Sandonato <nsand.dev> |
| Status: | RESOLVED FIXED | QA Contact: | Nick Sandonato <nsand.dev> |
| Severity: | normal | ||
| Priority: | P3 | CC: | Andrew.McCulloch, raghunathan.srinivasan, thatnitind |
| Version: | 3.3.1 | ||
| Target Milestone: | 3.3.2 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
Nice catch, Andrew. Thanks for the report! I've synchronized the code in that block. |
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.