bug #7679
closedNPE when creating root child in classification
100%
Description
When calling "new" on classification, the dialog does not show the "publish" checkbox for some reason. Also the unplaced and excluded and ExludedNotes controls are not shown. At least the isPublic checkbox is critical as it throws the below NPE and the taxon can not be created.
I canot see a reason why these fields should not be shown when being called from a classification.
login : admin editor version : 5.2.0.201808162248 server : test.e-taxonomy.eu (edit-test) / rem_conf_am schema version : 5.0.0.0.20180514 os : Windows Server 2012 R2 6.3 amd64 java : 1.8.0_121 java.lang.NullPointerException at eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeDetailElement.is_publish(TaxonNodeDetailElement.java:392) at eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeWizardPage.createTaxon(TaxonNodeWizardPage.java:143) at eu.etaxonomy.taxeditor.newWizard.NewTaxonNodeWizard.saveEntity(NewTaxonNodeWizard.java:56) at eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard.performFinish(AbstractNewEntityWizard.java:54) at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:790) at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:423) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:618) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:249) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4418) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4236) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3824) at org.eclipse.jface.window.Window.runEventLoop(Window.java:818) at org.eclipse.jface.window.Window.open(Window.java:794) at eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.NewTaxonNodeHandlerE4.execute(NewTaxonNodeHandlerE4.java:56) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55) at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:282) at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:264) at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132) at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:152) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:494) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:488) at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:433) at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.handleWidgetSelection(AbstractContributionItem.java:454) at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem$3.handleEvent(AbstractContributionItem.java:482) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4418) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4236) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3824) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:693) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148) at eu.etaxonomy.taxeditor.Application.start(Application.java:24) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610) at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
Related issues
Updated by Andreas Müller over 4 years ago
- Status changed from New to In Progress
- Priority changed from New to Highest
- Severity changed from normal to critical
Updated by Patrick Plitzner over 4 years ago
- Assignee changed from Katja Luther to Patrick Plitzner
Updated by Patrick Plitzner over 4 years ago
When entering data in "Detail" an exception is thrown with every key stroke
login : admin editor version : 5.3.0.qualifier server : localhost (localhost-dev) schema version : 5.0.0.0.20180514 os : Linux 4.15.0-32-generic amd64 java : 1.8.0_121 java.lang.ClassCastException: eu.etaxonomy.cdm.model.taxon.Classification cannot be cast to eu.etaxonomy.cdm.model.taxon.TaxonNode at eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeDetailElement.handleEvent(TaxonNodeDetailElement.java:245) at eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement.propertyChange(AbstractCdmDetailElement.java:227) at eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement.firePropertyChangeEvent(AbstractCdmFormElement.java:238) at eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement.modifyText(TextWithLabelElement.java:188) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:180) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5227) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1340) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4561) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4151) at org.eclipse.jface.window.Window.runEventLoop(Window.java:818) at org.eclipse.jface.window.Window.open(Window.java:794) at eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.NewTaxonNodeHandlerE4.execute(NewTaxonNodeHandlerE4.java:56) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55) at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:282) at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:264) at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132) at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:152) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:494) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:488) at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:433) at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.handleWidgetSelection(AbstractContributionItem.java:454) at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem$3.handleEvent(AbstractContributionItem.java:482) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5227) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1340) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4561) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4151) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:693) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148) at eu.etaxonomy.taxeditor.Application.start(Application.java:24) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610) at org.eclipse.equinox.launcher.Main.run(Main.java:1519) at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
Updated by Patrick Plitzner over 4 years ago
- Subject changed from Can't create root child in classificatoin to Can't create root child in classificatoin - Refactor TaxonNodeDetailElement
While investigating this issue I realized that the NewTaxonNodeWizard does not work like all the other "new" wizards.
Usually the sequence is as follows:
1.In AbstractNewEntityWizard.createNewEntity() a new instance of the class is created.
protected Reference createNewEntity() {
return ReferenceFactory.newGeneric();
}
2.The wizard page returns a detail element for the newly created entity via AbstractCdmEntityWizardPage.getDetailElement() This is the same element as used in the DetailsView.
3.The handleEvent() method listens to editing changes in the detail element and stores the parameters to the newly created entity
public void handleEvent(Object eventSource) {
if (eventSource == combo_referenceType) {
getEntity().setType(combo_referenceType.getSelection());
4.When closing the wizard AbstractNewEntityWizard.saveEntity() is invoked
protected void saveEntity() {
CdmStore.getService(IReferenceService.class).save(getEntity());
}
- The new taxon node wizard does not create a new entity but uses the current selection.
- This is why all these exception are thrown when creating a root child because the entity used in the wizard is the classification and not the new taxon node as it should be.
- Only during saveEntity() a new taxon instance is created (should be done createNewEntity()) and all the UI parameter fields are stored to the taxon (should be done in handleEvent())
Updated by Patrick Plitzner over 4 years ago
- Copied to feature request #7680: Refactor TaxonNodeDetailElement added
Updated by Patrick Plitzner over 4 years ago
I created a new ticket for the redesign -> #7680
Updated by Katja Luther over 4 years ago
- Target version changed from Release 5.3 to Release 5.2
Updated by Andreas Müller over 4 years ago
- Subject changed from Can't create root child in classificatoin - Refactor TaxonNodeDetailElement to NPE when creating root child in classificatoin
- % Done changed from 0 to 40
Can't we put this to resolved already?
Updated by Patrick Plitzner over 4 years ago
- Status changed from In Progress to Resolved
- Assignee changed from Patrick Plitzner to Andreas Müller
- % Done changed from 40 to 50
Andreas Müller wrote:
Can't we put this to resolved already?
As we already moved it to 5.2 because of the hotfix we could also just close. Or have you not yet reviewed it?
Updated by Andreas Müller over 4 years ago
- Status changed from Resolved to Feedback
- Assignee changed from Andreas Müller to Patrick Plitzner
The setting of the publish flag does not yet work in this case. It should either be "true" (but currently is "false") or should use admin preferences. Preference "inherit" from parent should set the flag to "true" as Classification as parent has no publish flag but is always public.
Updated by Patrick Plitzner over 4 years ago
- Status changed from Feedback to Resolved
- Assignee changed from Patrick Plitzner to Andreas Müller
- % Done changed from 50 to 70
Updated by Andreas Müller over 4 years ago
- Subject changed from NPE when creating root child in classificatoin to NPE when creating root child in classification
Updated by Andreas Müller over 4 years ago
- Status changed from Resolved to Feedback
- Assignee changed from Andreas Müller to Patrick Plitzner
Looks like commit 46f913aa went only into the hotfix branch but needs to be committed to both branches.
Can't test this way as my IDE currently does not work.
Updated by Patrick Plitzner over 4 years ago
- Assignee changed from Patrick Plitzner to Andreas Müller
Andreas Müller wrote:
Looks like commit 46f913aa went only into the hotfix branch but needs to be committed to both branches.
Can't test this way as my IDE currently does not work.
I cherry-picked it into develop
Updated by Andreas Müller over 4 years ago
- Status changed from Feedback to Closed
- Assignee changed from Andreas Müller to Patrick Plitzner
- % Done changed from 70 to 100
OK, seems to work now.