Community
Participate
Working Groups
Build Identifier: 3.6.0 We use the Eclipse RCP platform in a highly concurrent environment. Sometimes our application throws a NullPointerException shortly after it's being started - which is not really reproducible in a safe way. The stacktrace issues a NullPointer in this line: org.eclipse.emf.ecore.resource.impl.PlatformContentHandlerImpl.contentDescription(PlatformContentHandlerImpl.java:92) After investigating the source code, I came to the conclusion that the only way a NullPointer could happen is that the InternalPlatform.getContentTypeManager returns null. I believe the lazy initialisation in this method is not threadsafe and therefore this issue occures. Thread A recognizes the contentTracker as null and instantiates the member. but between the class instantiation of the Service Tracker and the call to "open()" Thread B recognizes the member variable beeing set and jumps to the end of the method, calling getService() on the "at this point" not opened service tracker. The service tracker itself will return null in case it's not yet being opened :-( Reproducible: Sometimes Steps to Reproduce: 1. Access Platform.getContentTypeManager simultaneously in multiple threads 2. 3.
Created attachment 197064 [details] Stacktrace of the NullPointerException The attachments shows the Nullpointer, which is caused by the Platform.getContentTypeManager not being threadsafe
I believe this is a duplicate of bug 356306. Please re-open if you are still seeing this behaviour in recent builds. Thanks. *** This bug has been marked as a duplicate of bug 356306 ***