Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 334657

Summary: NullPointerException on multithreaded access to adapters during notify
Product: [Modeling] EMF Reporter: Rudolf Endreß <rudolf.endress>
Component: CoreAssignee: Ed Merks <Ed.Merks>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Rudolf Endreß CLA 2011-01-18 10:26:58 EST
Build Identifier: M20090917-0800

Used plugin: org.eclipse.emf.common_2.5.0.v200906151043.jar

A multi thread application shows NullPointer Exceptions 
'java.lang..NullPointerException: null
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:280'.

Bug 299808 describes a solution for quite the same problem in 'WTP Java EE Tools': Null pointer check on the adapters within the loop.

I suggest to modify the BasicNotifierImpl in a similar manner.

Reproducible: Sometimes
Comment 1 Ed Merks CLA 2011-01-18 11:39:32 EST
No, we won't put hacks in to mask the fundamental problem.  The list isn't thread safe and any null in the list represents a list that's been corrupted by multi-threaded updates.  Perhaps an adapter that should have been added isn't present or perhaps an adapter that was supposed to be removed isn't. Masking that fact, rather than tracking down how the list is being misused by the application isn't appropriate in the core framework (and probably isn't even appropriate for WTP but that's their own business not mine).