Bug 121326 - MylarUiPlugin fails to activate if no mylar views visible
Summary: MylarUiPlugin fails to activate if no mylar views visible
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: 0.4   Edit
Hardware: All All
: P1 major (vote)
Target Milestone: ---   Edit
Assignee: Brock Janiczak CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 121381 121436 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-12-17 22:42 EST by Brock Janiczak CLA
Modified: 2005-12-20 11:35 EST (History)
3 users (show)

See Also:


Attachments
patch to org.eclipse.mylar.tasklist (1.54 KB, patch)
2005-12-17 22:52 EST, Brock Janiczak CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brock Janiczak CLA 2005-12-17 22:42:23 EST
Eclipse 3.2 M4

If you try to start a workbench with no Mylar views visible the MylarUuPlugin fails to activate.  The activation attempt is coming from the lightweight decorator.  This activation attempt is being run in a non UI thread which is causing the creation of the ColorMap instance variable to fail as it requires TaskListImages which creates an image registry which assumes it is being run in a UI thread.  The color map is used in initializeHighlighters, so the map can't just be lazily created.

I have only noticed this with 3.2, so perhaps it is a JFace regression?  Still, the plugin shouldn't make assumptions about the thread it is running on.

Moving the creation of the ColorMap into the constructor and wrapping it in a syncExec call does work, but locks up the UI for a good 10-20 seconds.

org.osgi.framework.BundleException: The activator org.eclipse.mylar.ui.MylarUiPlugin for bundle org.eclipse.mylar.ui is invalid
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:140)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:965)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:316)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:255)
at org.eclipse.core.runtime.adaptor.EclipseClassLoader.findLocalClass(EclipseClassLoader.java:116)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:337)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:389)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:350)
at org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader.loadClass(AbstractClassLoader.java:78)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.eclipse.osgi.framework.internal.core.BundleLoader.loadClass(BundleLoader.java:275)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:227)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1235)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:218)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:211)
at org.eclipse.core.internal.registry.ExtensionRegistry.processExecutableExtension(ExtensionRegistry.java:801)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:246)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:53)
at org.eclipse.core.internal.registry.eclipse.LegacyConfigurationElementHandle.createExecutableExtension(LegacyConfigurationElementHandle.java:60)
at org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:243)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:51)
at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:239)
at org.eclipse.ui.internal.decorators.LightweightDecoratorDefinition$1.run(LightweightDecoratorDefinition.java:116)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:785)
at org.eclipse.ui.internal.decorators.LightweightDecoratorDefinition.internalGetDecorator(LightweightDecoratorDefinition.java:112)
at org.eclipse.ui.internal.decorators.LightweightDecoratorDefinition.decorate(LightweightDecoratorDefinition.java:233)
at org.eclipse.ui.internal.decorators.LightweightDecoratorManager$LightweightRunnable.run(LightweightDecoratorManager.java:66)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:785)
at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.decorate(LightweightDecoratorManager.java:323)
at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.getDecorations(LightweightDecoratorManager.java:309)
at org.eclipse.ui.internal.decorators.DecorationScheduler$1.run(DecorationScheduler.java:292)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Caused by: java.lang.ExceptionInInitializerError
at org.eclipse.mylar.ui.internal.ColorMap.<init>(ColorMap.java:25)
at org.eclipse.mylar.ui.MylarUiPlugin.<init>(MylarUiPlugin.java:75)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:135)
... 33 more
Caused by: java.lang.NullPointerException
at org.eclipse.jface.resource.JFaceResources.getResources(JFaceResources.java:183)
at org.eclipse.jface.resource.ImageRegistry.<init>(ImageRegistry.java:145)
at org.eclipse.jface.resource.ImageRegistry.<init>(ImageRegistry.java:117)
at org.eclipse.mylar.tasklist.ui.TaskListImages.<clinit>(TaskListImages.java:37)
... 42 more
Root exception:
java.lang.ExceptionInInitializerError
at org.eclipse.mylar.ui.internal.ColorMap.<init>(ColorMap.java:25)
at org.eclipse.mylar.ui.MylarUiPlugin.<init>(MylarUiPlugin.java:75)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:135)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:965)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:316)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:255)
at org.eclipse.core.runtime.adaptor.EclipseClassLoader.findLocalClass(EclipseClassLoader.java:116)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:337)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:389)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:350)
at org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader.loadClass(AbstractClassLoader.java:78)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.eclipse.osgi.framework.internal.core.BundleLoader.loadClass(BundleLoader.java:275)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:227)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1235)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:218)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:211)
at org.eclipse.core.internal.registry.ExtensionRegistry.processExecutableExtension(ExtensionRegistry.java:801)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:246)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:53)
at org.eclipse.core.internal.registry.eclipse.LegacyConfigurationElementHandle.createExecutableExtension(LegacyConfigurationElementHandle.java:60)
at org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:243)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:51)
at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:239)
at org.eclipse.ui.internal.decorators.LightweightDecoratorDefinition$1.run(LightweightDecoratorDefinition.java:116)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:785)
at org.eclipse.ui.internal.decorators.LightweightDecoratorDefinition.internalGetDecorator(LightweightDecoratorDefinition.java:112)
at org.eclipse.ui.internal.decorators.LightweightDecoratorDefinition.decorate(LightweightDecoratorDefinition.java:233)
at org.eclipse.ui.internal.decorators.LightweightDecoratorManager$LightweightRunnable.run(LightweightDecoratorManager.java:66)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:785)
at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.decorate(LightweightDecoratorManager.java:323)
at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.getDecorations(LightweightDecoratorManager.java:309)
at org.eclipse.ui.internal.decorators.DecorationScheduler$1.run(DecorationScheduler.java:292)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Caused by: java.lang.NullPointerException
at org.eclipse.jface.resource.JFaceResources.getResources(JFaceResources.java:183)
at org.eclipse.jface.resource.ImageRegistry.<init>(ImageRegistry.java:145)
at org.eclipse.jface.resource.ImageRegistry.<init>(ImageRegistry.java:117)
at org.eclipse.mylar.tasklist.ui.TaskListImages.<clinit>(TaskListImages.java:37)
... 42 more
Comment 1 Mik Kersten CLA 2005-12-17 22:48:14 EST
Thanks for identifying these problems Brock!  I'm plan on putting out a service build tomorrow or Monday morning.
Comment 2 Brock Janiczak CLA 2005-12-17 22:52:29 EST
Created attachment 31908 [details]
patch to org.eclipse.mylar.tasklist

Lazily load the ImageRegistry in TaskListImages.  Images should only be requested on the UI thread, so there should be no need to synchronize getImageRegistry.  It is also guarantees that Display.getCurrent will return a valid object.
Comment 3 Mik Kersten CLA 2005-12-18 18:54:29 EST
Excellent Brock--very elegant solution for the sort of problem that can be really annoying to track down (startup issues have been a pain in the past).  We have 3 image registries (ui, tasklist, and bugzilla) so I introduced this idiom to the other two as well, although they wouldn't have caused a problem because they don't require early startup.

When you make any substatial patch of an existing class, could you add yourself to a new @author line with a short description?  It's not necessary for minor stuff, but I like to ensure that credit goes where it's due, e.g.:

@author Mik Kersten
@author Brock Janiczak (lazy loading of image registry)
Comment 4 Mik Kersten CLA 2005-12-18 19:06:05 EST
This was resolved by Brock, so reassigning.
Comment 5 Mik Kersten CLA 2005-12-18 19:07:06 EST
Resolved.
Comment 6 Mik Kersten CLA 2005-12-19 13:07:26 EST
*** Bug 121436 has been marked as a duplicate of this bug. ***
Comment 7 Mik Kersten CLA 2005-12-20 11:35:57 EST
*** Bug 121381 has been marked as a duplicate of this bug. ***