Project

General

Profile

bug #7679

NPE when creating root child in classification

Added by Andreas Müller 4 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Highest
Category:
taxeditor
Target version:
Start date:
08/23/2018
Due date:
% Done:

100%

Severity:
critical
Found in Version:

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

Copied to Edit - feature request #7680: Refactor TaxonNodeDetailElement In Progress 08/24/2018

Associated revisions

Revision 9d74201a (diff)
Added by Patrick Plitzner 4 months ago

ref #7679 Temporary hotfix for NPE in taxon node wizard

Revision 9e01ec16 (diff)
Added by Patrick Plitzner 4 months ago

ref #7679 Temporary hotfix for NPE in taxon node wizard

Revision 22daad3e (diff)
Added by Patrick Plitzner 4 months ago

ref #7679 Change order of UI elements

Revision 17acac26 (diff)
Added by Patrick Plitzner 4 months ago

ref #7679 Change order of UI elements

Revision 46f913aa (diff)
Added by Patrick Plitzner 4 months ago

ref #7679 Evaluate DB prefs for publish flag

Revision ff687253 (diff)
Added by Patrick Plitzner 3 months ago

ref #7679 Evaluate DB prefs for publish flag

History

#1 Updated by Andreas Müller 4 months ago

  • Status changed from New to In Progress
  • Priority changed from New to Highest
  • Severity changed from normal to critical

#2 Updated by Patrick Plitzner 4 months ago

  • Assignee changed from Katja Luther to Patrick Plitzner

#3 Updated by Patrick Plitzner 4 months 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)

#4 Updated by Patrick Plitzner 4 months 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())

#5 Updated by Patrick Plitzner 4 months ago

#6 Updated by Patrick Plitzner 4 months ago

I created a new ticket for the redesign -> #7680

#7 Updated by Katja Luther 4 months ago

  • Target version changed from Release 5.3 to Release 5.2

#8 Updated by Andreas Müller 4 months 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?

#9 Updated by Patrick Plitzner 4 months 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?

#10 Updated by Andreas Müller 4 months 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.

#11 Updated by Patrick Plitzner 4 months ago

  • Status changed from Feedback to Resolved
  • Assignee changed from Patrick Plitzner to Andreas Müller
  • % Done changed from 50 to 70

#12 Updated by Andreas Müller 4 months ago

  • Subject changed from NPE when creating root child in classificatoin to NPE when creating root child in classification

#13 Updated by Andreas Müller 4 months 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.

#14 Updated by Patrick Plitzner 3 months 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

#15 Updated by Andreas Müller 3 months 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.

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 40 MB)