문제

I have the following piece of code:

        TableViewer tv = new TableViewer(attributeTable);
        tv.setContentProvider(new BOAttributeTableContentProvider());
        tv.setLabelProvider(new BOAttributeTableLabelProvider());

where while setting the label provider i am getting AssertionFailedError. can anybody tell me what wrong i am doing here? or in which case it throws this error?

error Log:

org.eclipse.jface.util.Assert$AssertionFailedException: null argument;
    at org.eclipse.jface.util.Assert.isNotNull(Assert.java:150)
    at org.eclipse.jface.util.Assert.isNotNull(Assert.java:126)
    at org.eclipse.jface.viewers.StructuredViewer.disassociate(StructuredViewer.java:615)
    at org.eclipse.jface.viewers.TableViewer.internalRefreshAll(TableViewer.java:904)
    at org.eclipse.jface.viewers.TableViewer.internalRefresh(TableViewer.java:818)
    at org.eclipse.jface.viewers.TableViewer.internalRefresh(TableViewer.java:807)
    at org.eclipse.jface.viewers.StructuredViewer$7.run(StructuredViewer.java:1388)
    at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1323)
    at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1386)
    at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1345)
    at org.eclipse.jface.viewers.ContentViewer.setLabelProvider(ContentViewer.java:281)
    at org.eclipse.jface.viewers.StructuredViewer.setLabelProvider(StructuredViewer.java:2003)
    at org.eclipse.jface.viewers.TableViewer.setLabelProvider(TableViewer.java:1086)
    at com.misys.bankfusion.bpdesigner.boeditor.pages.BOAttributesPage.populateAttributeTableContents(BOAttributesPage.java:458)
    at com.misys.bankfusion.bpdesigner.boeditor.pages.BOAttributesPage.access$000(BOAttributesPage.java:128)
    at com.misys.bankfusion.bpdesigner.boeditor.pages.BOAttributesPage$1.setToModel(BOAttributesPage.java:341)
    at com.trapedza.bankfusion.editor.AbstractEditorDelegate.updateData(AbstractEditorDelegate.java:173)
    at com.trapedza.bankfusion.editor.AbstractEditorDelegate$1.dialogFieldChanged(AbstractEditorDelegate.java:181)
    at com.trapedza.bankfusion.utils.dialogs.internal.DialogField.dialogFieldChanged(DialogField.java:132)
    at com.trapedza.bankfusion.utils.dialogs.internal.ListBoxDialogField.doModifySelection(ListBoxDialogField.java:51)
    at com.trapedza.bankfusion.utils.dialogs.internal.ComboDialogField$2.widgetSelected(ComboDialogField.java:153)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90)
    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:1930)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:422)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    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(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)
도움이 되었습니까?

해결책

Constructor that you are using (TableViewer) or two setters (setContentProvider, setLabelProvider) have guarding assert statements which are throwing these exceptions. Author of the code had an idea to protect its code from irregular parameters that you are using when invoking her/his code.

다른 팁

Make sure the "test" at the beginning of the method name is lower case. If you say TestMethod you will get this error message. You should say testMethod.

For example:

@Test
    public void test_VPlugin() throws Exception {

This works for me and I hope it will work for you

The stack trace shows that your call to 'TableViewer.setLabelProvider()' from 'BOAttributesPage.populateAttributeTableContents()' eventually results in call to 'org.eclipse.jface.viewers.StructuredViewer.disassociate()' with null argument and that method constraints input argument to be not-null.

It looks like BOAttributeTableContentProvider provides a null object somewhere along line (one of the elements you are trying to display in the table is null). Debug the content provider. Hope my late answer will help.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top