Community
Participate
Working Groups
IllegalArgumentException (see stack trace (1) below) is thrown after an attempt to display EMF properties of an object which has non-containment refernce attribute. Further attempts to display EMF properties of the same object results in an NullPointerException (see stack trace (2) below). Both exceptions disappeared after property descriptors of non-containment refernce attributes in corresponding item provider had been commented. Problem doesn't exist if properties of the same instance are displayed using ordinary EMF properties. See thread news://news.eclipse.org:119/e78g1p$6gr$1@utils.eclipse.org and postings news://news.eclipse.org:119/ea7j9m$cq8$1@utils.eclipse.org and news://news.eclipse.org:119/ea899d$ois$1@utils.eclipse.org for more detailed description of the problem and possible reasons. Stack traces: (1) java.lang.IllegalArgumentException: Argument cannot be null at org.eclipse.swt.SWT.error(SWT.java:3358) at org.eclipse.swt.SWT.error(SWT.java:3297) at org.eclipse.swt.SWT.error(SWT.java:3268) at org.eclipse.swt.widgets.Widget.error(Widget.java:435) at org.eclipse.swt.widgets.TreeItem.setText(TreeItem.java:1542) at org.eclipse.ui.views.properties.PropertySheetViewer.updateEntry(PropertySheetViewer.java:1298) at org.eclipse.ui.views.properties.PropertySheetViewer.createItem(PropertySheetViewer.java:368) at org.eclipse.ui.views.properties.PropertySheetViewer.createChildren(PropertySheetViewer.java:281) at org.eclipse.ui.views.properties.PropertySheetViewer.updateCategory(PropertySheetViewer.java:1153) at org.eclipse.ui.views.properties.PropertySheetViewer.createItem(PropertySheetViewer.java:370) at org.eclipse.ui.views.properties.PropertySheetViewer.updateChildrenOf(PropertySheetViewer.java:1254) at org.eclipse.ui.views.properties.PropertySheetViewer.access$2(PropertySheetViewer.java:1175) at org.eclipse.ui.views.properties.PropertySheetViewer$3.childEntriesChanged(PropertySheetViewer.java:313) at org.eclipse.gmf.runtime.emf.ui.properties.sections.PropertySheetEntry.fireChildEntriesChanged(PropertySheetEntry.java:288) at org.eclipse.gmf.runtime.emf.ui.properties.sections.PropertySheetEntry.refreshChildEntries(PropertySheetEntry.java:560) at org.eclipse.gmf.runtime.emf.ui.properties.sections.PropertySheetEntry.setValues(PropertySheetEntry.java:724) at org.eclipse.gmf.runtime.emf.ui.properties.sections.UndoableModelPropertySheetEntry.setValues(UndoableModelPropertySheetEntry.java:263) at org.eclipse.ui.views.properties.PropertySheetViewer.setInput(PropertySheetViewer.java:943) at org.eclipse.ui.views.properties.PropertySheetPage.selectionChanged(PropertySheetPage.java:473) at org.eclipse.gmf.runtime.diagram.ui.properties.sections.AdvancedPropertySection.setInput(AdvancedPropertySection.java:166) at org.eclipse.ui.internal.views.properties.tabbed.view.Tab$5.run(Tab.java:195) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.runtime.Platform.run(Platform.java:843) at org.eclipse.ui.internal.views.properties.tabbed.view.Tab.setInput(Tab.java:202) at org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage$SelectionChangedListener.selectionChanged(TabbedPropertySheetPage.java:210) at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:162) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.runtime.Platform.run(Platform.java:843) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:149) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:160) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:1976) at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1128) at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1154) at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:213) at org.eclipse.jface.util.OpenStrategy.access$3(OpenStrategy.java:207) at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:374) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:709) at org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyList.select(TabbedPropertyList.java:564) at org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyList$2.mouseUp(TabbedPropertyList.java:129) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:137) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928) 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:149) at com.pilz.ssp.framework.ui.SSPApplication.run(SSPApplication.java:26) 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(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) 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) (2) java.lang.NullPointerException at org.eclipse.gmf.runtime.emf.ui.properties.sections.PropertySheetEntry.refreshChildEntries(PropertySheetEntry.java:528) at org.eclipse.gmf.runtime.emf.ui.properties.sections.PropertySheetEntry.setValues(PropertySheetEntry.java:724) at org.eclipse.gmf.runtime.emf.ui.properties.sections.UndoableModelPropertySheetEntry.setValues(UndoableModelPropertySheetEntry.java:263) at org.eclipse.ui.views.properties.PropertySheetViewer.setInput(PropertySheetViewer.java:943) at org.eclipse.ui.views.properties.PropertySheetPage.selectionChanged(PropertySheetPage.java:473) at org.eclipse.gmf.runtime.diagram.ui.properties.sections.AdvancedPropertySection.setInput(AdvancedPropertySection.java:166) at org.eclipse.ui.internal.views.properties.tabbed.view.Tab$5.run(Tab.java:195) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.runtime.Platform.run(Platform.java:843) at org.eclipse.ui.internal.views.properties.tabbed.view.Tab.setInput(Tab.java:202) at org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage$SelectionChangedListener.selectionChanged(TabbedPropertySheetPage.java:210) at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:162) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.runtime.Platform.run(Platform.java:843) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:149) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:160) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:1976) at org.eclipse.jface.viewers.StructuredViewer.setSelection(StructuredViewer.java:1577) at org.eclipse.jface.viewers.Viewer.setSelection(Viewer.java:384) at org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage.setInput(TabbedPropertySheetPage.java:674) at org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage.selectionChanged(TabbedPropertySheetPage.java:525) at org.eclipse.gmf.runtime.diagram.ui.properties.views.PropertiesBrowserPage.selectionChanged(PropertiesBrowserPage.java:253) at org.eclipse.ui.views.properties.PropertySheet.selectionChanged(PropertySheet.java:218) at org.eclipse.ui.internal.AbstractSelectionService.fireSelection(AbstractSelectionService.java:156) at org.eclipse.ui.internal.AbstractSelectionService$1.selectionChanged(AbstractSelectionService.java:62) at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramGraphicalViewer.flushSelectionEvents(DiagramGraphicalViewer.java:255) at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramGraphicalViewer$1.run(DiagramGraphicalViewer.java:233) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3325) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971) 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:149) at com.pilz.ssp.framework.ui.SSPApplication.run(SSPApplication.java:26) 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(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) 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)
Is the item provider for the type referenced by the non-containment reference feature returning null from its #getText method, by any chance? I think that this could cause the initial IllegalArgumentException to be thrown. If that's the case, I think that its good practice to return a non-null text from your item provider. In any case, the GMF property sheet implementation should be more defensive about this kind of thing.
(In reply to comment #1) > Is the item provider for the type referenced by the non-containment reference > feature returning null from its #getText method, by any chance? I think that > this could cause the initial IllegalArgumentException to be thrown. If that's > the case, I think that its good practice to return a non-null text from your > item provider. > In any case, the GMF property sheet implementation should be more defensive > about this kind of thing. I checked the item provider's getText() method - it is OK - default string is returned if label text is null or it's trimmed length is zero. It works properly in ordinary EMF properties - drop-down list containing all instances of referenced type is displayed in properties sheet.
There are non-containment reference features in the TaiPan example, but I can't reproduce this problem in the example (unless I modify the item provider to return null from #getText). Somehow in your case PropertySheetViewer#updateEntry() is setting the text of the tree item to null. Can you try putting a breakpoint in this method (or one to catch all IllegalArgumentExceptions) and step into the code to see why?
(In reply to comment #3) > There are non-containment reference features in the TaiPan example, but I can't > reproduce this problem in the example (unless I modify the item provider to > return null from #getText). Somehow in your case > PropertySheetViewer#updateEntry() is setting the text of the tree item to null. > Can you try putting a breakpoint in this method (or one to catch all > IllegalArgumentExceptions) and step into the code to see why? Method getText() doesn't called at all when I display tabbed properties of the object. Instead new NullPointerException appeared (see stack trace below). This exception appears only once when I first time display properties of problematic object. The sequence of my actions is the next: 1. display tabbed properties of NON problematic object 2. expand Advanced>>EMF 3. display properties of problematic object getText() is called and returns correct not null value when I use ordinary EMF properties. stack trace : java.lang.NullPointerException at java.text.CollationElementIterator.<init>(CollationElementIterator.java:102) at java.text.RuleBasedCollator.getCollationElementIterator(RuleBasedCollator.java:356) at java.text.RuleBasedCollator.compare(RuleBasedCollator.java:399) at org.eclipse.emf.common.ui.celleditor.ExtendedComboBoxCellEditor$1$StringPositionPair.compareTo(ExtendedComboBoxCellEditor.java:77) at java.util.Arrays.mergeSort(Arrays.java:1156) at java.util.Arrays.mergeSort(Arrays.java:1167) at java.util.Arrays.sort(Arrays.java:1080) at org.eclipse.emf.common.ui.celleditor.ExtendedComboBoxCellEditor.createItems(ExtendedComboBoxCellEditor.java:90) at org.eclipse.emf.common.ui.celleditor.ExtendedComboBoxCellEditor.<init>(ExtendedComboBoxCellEditor.java:141) at org.eclipse.emf.common.ui.celleditor.ExtendedComboBoxCellEditor.<init>(ExtendedComboBoxCellEditor.java:131) at org.eclipse.gmf.runtime.emf.ui.properties.descriptors.EMFCompositeSourcePropertyDescriptor.createComboBoxCellEditor(EMFCompositeSourcePropertyDescriptor.java:355) at org.eclipse.gmf.runtime.emf.ui.properties.descriptors.EMFCompositeSourcePropertyDescriptor.doCreateEditor(EMFCompositeSourcePropertyDescriptor.java:213) at org.eclipse.gmf.runtime.emf.ui.properties.descriptors.EMFCompositeSourcePropertyDescriptor.createPropertyEditor(EMFCompositeSourcePropertyDescriptor.java:175) at org.eclipse.gmf.runtime.emf.ui.properties.sections.PropertySheetEntry.getEditor(PropertySheetEntry.java:365) at org.eclipse.ui.views.properties.PropertySheetViewer.activateCellEditor(PropertySheetViewer.java:154) at org.eclipse.ui.views.properties.PropertySheetViewer.handleSelect(PropertySheetViewer.java:702) at org.eclipse.ui.views.properties.PropertySheetViewer.access$7(PropertySheetViewer.java:680) at org.eclipse.ui.views.properties.PropertySheetViewer$5.mouseDown(PropertySheetViewer.java:790) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:133) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928) 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:149) at com.pilz.ssp.framework.ui.SSPApplication.run(SSPApplication.java:26) 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(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) 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)
That last stack trace makes me think that this may be a duplicate of bug 141314 and bug 125459. Are the problematic features multi-valued reference features, by any chance?
(In reply to comment #5) > That last stack trace makes me think that this may be a duplicate of bug 141314 > and bug 125459. Are the problematic features multi-valued reference features, > by any chance? Checked this. Problematic features are not multi-valued and defined in package as below: initEReference(getDefaultCanOpenDevice_DeviceProperties(), theModelPackage_1.getDeviceProperties(), null, "deviceProperties", null, 0, 1, DefaultCanOpenDevice.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getDefaultCanOpenDevice_ObjectDictionary(), theModelPackage_1.getDeviceObjectDictionary(), null, "objectDictionary", null, 0, 1, DefaultCanOpenDevice.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
Looking at the details of the last NPE stack trace, it still looks like there is a null label being provided somewhere, and sorting the items in the combo box that are choices for the property value fails because one of them has a null key. Can you confirm by putting a breakpoint in org.eclipse.emf.common.ui.celleditor.ExtendedComboBoxCellEditor#createItems() on the line pairs[i] = new StringPositionPair(labelProvider.getText(object), i); to see which label provider is providing a null key to the StringPositionPairs constructor? Other than that, the only thing I see different between your features and the ones in the TaiPan example, for instance, is that you're setting the IS_UNIQUE to false. I can't see how this might cause the problems you see, but just in case you might want to try with that value set to true.
(In reply to comment #7) > Looking at the details of the last NPE stack trace, it still looks like there > is a null label being provided somewhere, and sorting the items in the combo > box that are choices for the property value fails because one of them has a > null key. > Can you confirm by putting a breakpoint in > org.eclipse.emf.common.ui.celleditor.ExtendedComboBoxCellEditor#createItems() > on the line > pairs[i] = new StringPositionPair(labelProvider.getText(object), i); > to see which label provider is providing a null key to the StringPositionPairs > constructor? > Other than that, the only thing I see different between your features and the > ones in the TaiPan example, for instance, is that you're setting the IS_UNIQUE > to false. I can't see how this might cause the problems you see, but just in > case you might want to try with that value set to true. Hi, Linda! Sorry for delay! Yes you are right. Null label is provided at that point by referenced object. And I know why. I can't see one of my AdapterFactories in composed adapter factory. But can't realise why only one. Where the composed adapter factory is created? fillItemProviderFactories() in my DiagramEditorPlugin adds all my adapter factories. Thanks in advance. Roman.
Moving to the next release, GMF 2.1.
[GMF Restructure] Bug 319140 : product GMF and component Runtime was the original product and component for this bug