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

Bug 139664

Summary: [Preferences][ErrorHandling] SWTException: Unsupported or unrecognized format if icon miscoded in plugin.xml
Product: [Eclipse Project] Platform Reporter: Kevin Hardman <nivek>
Component: UIAssignee: Duong Nguyen <duongn>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: eclipse, Michael.Valenta, Tod_Creasey
Version: 3.2Keywords: helpwanted
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Kevin Hardman CLA 2006-05-02 09:18:35 EDT
If Data Tools Platform SQL Development Tools 0.9.0.200604141 (org.eclipse.datatools.sqldevtools.feature) is installed opening the Preferences dialog and selecting General -> Editors -> File Associations if one clicks add at Associated editors: list the exception below it thrown.  This has already been reported in Bug 136482 and Bug 139016; however, I believe SWT or perhaps the editor file associations code could better handle the case where plugin.xml is improperly coded then throwing the exception.

org.eclipse.swt.SWTException: Unsupported or unrecognized format
at org.eclipse.swt.SWT.error(SWT.java:3374)
at org.eclipse.swt.SWT.error(SWT.java:3297)
at org.eclipse.swt.SWT.error(SWT.java:3268)
at org.eclipse.swt.internal.image.FileFormat.load(FileFormat.java:73)
at org.eclipse.swt.graphics.ImageLoader.load(ImageLoader.java:127)
at org.eclipse.swt.graphics.ImageDataLoader.load(ImageDataLoader.java:18)
at org.eclipse.swt.graphics.ImageData.<init>(ImageData.java:327)
at org.eclipse.jface.resource.URLImageDescriptor.getImageData(URLImageDescriptor.java:57)
at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:279)
at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:233)
at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:211)
at org.eclipse.ui.internal.dialogs.EditorSelectionDialog.getImages(EditorSelectionDialog.java:319)
at org.eclipse.ui.internal.dialogs.EditorSelectionDialog.getInternalEditors(EditorSelectionDialog.java:333)
at org.eclipse.ui.internal.dialogs.EditorSelectionDialog.fillEditorTable(EditorSelectionDialog.java:217)
at org.eclipse.ui.internal.dialogs.EditorSelectionDialog.createDialogArea(EditorSelectionDialog.java:204)
at org.eclipse.jface.dialogs.Dialog.createContents(Dialog.java:802)
at org.eclipse.jface.window.Window.create(Window.java:426)
at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1124)
at org.eclipse.jface.window.Window.open(Window.java:785)
at org.eclipse.ui.internal.dialogs.FileEditorsPreferencePage.promptForEditor(FileEditorsPreferencePage.java:515)
at org.eclipse.ui.internal.dialogs.FileEditorsPreferencePage.handleEvent(FileEditorsPreferencePage.java:440)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:925)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
at org.eclipse.jface.window.Window.open(Window.java:796)
at org.eclipse.ui.internal.OpenPreferencesAction.run(OpenPreferencesAction.java:65)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:925)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
Comment 1 Felipe Heidrich CLA 2006-05-05 15:00:57 EDT
SWT is correctly throwing an exception when it cannot load an image file.  The EditorSelectionDialog should not fail when this happens.

Separate from this is the fact that the image file did not load but probably should have.  Kevin, please enter another bug report against SWT with either the image file or a set of steps that we can use to recreate the problem.
Comment 2 Karice McIntyre CLA 2006-05-08 16:51:19 EDT
*** Bug 140669 has been marked as a duplicate of this bug. ***
Comment 3 Kevin Hardman CLA 2006-05-08 21:18:11 EDT
The following is what was changed to correct the bogus plugin.xml in the SQL editor plug-in.  I would suggest obtaining the old org.eclipse.datagools.sqltools.sqleditor_0.9.0 jar or creating a plugin with bad xml as described to reproduce.

From Bug 136482:

Interesting... I had to work backward from the stack trace to trigger this same
sort of effect in my environment.

Turns out that DTP is indeed the culprit here, specifically the SQL editor.
We'll get this fixed in a build for later this week, but, if you want to change
it yourself, you can:
1. Unpack org.eclipse.datatools.sqltools.sqleditor_0.9.0.......jar
2. Edit the plugin.xml file for the following:
Find the <extension point="org.eclipse.ui.editors"> near the top of the file,
and location the line:

icon=""

change that to

icon="icons/sql_editor.gif"

repack, and replace in your plugins folder. On restarting Eclipse, the problem
should go away.
Comment 4 Tod Creasey CLA 2007-06-13 16:16:54 EDT
There are currently no plans to work on this however I would be happy to look over a contribution