Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration and repair actions fail to close modified opened diagrams and throws NPEs #2860

Open
mPorhel opened this issue Apr 24, 2024 · 3 comments

Comments

@mPorhel
Copy link
Contributor

mPorhel commented Apr 24, 2024

Several scenarios have been identified leading to unsafe state of the Workbench after the use of the migration or repair actions on modified projects with opened diagram editors.

The underlying issue is an NPE during attempt to closed opened an dirty diagrams editors :

java.lang.NullPointerException: Cannot invoke "org.eclipse.sirius.ui.business.internal.session.RestoreToLastSavePointListener.isAllowedToReturnToSyncState()" because "this.restoreToSavePointListener" is null
  at org.eclipse.sirius.ui.business.internal.session.EditingSession.promptToSaveOnClose(EditingSession.java:276)
  at org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramEditorImpl.promptToSaveOnClose(DDiagramEditorImpl.java:1981)
  at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelper.java:231)
  at org.eclipse.ui.internal.SaveablesList.preCloseParts(SaveablesList.java:522)
  at org.eclipse.ui.internal.SaveablesList.preCloseParts(SaveablesList.java:484)
  at org.eclipse.ui.internal.SaveablesList.preCloseParts(SaveablesList.java:479)
  at org.eclipse.ui.internal.SaveablesList.preCloseParts(SaveablesList.java:474)
  at org.eclipse.ui.internal.WorkbenchPage.closeEditors(WorkbenchPage.java:1416)
  at org.eclipse.ui.internal.WorkbenchPage.closeEditor(WorkbenchPage.java:1588)
  at org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramEditorImpl.lambda$5(DDiagramEditorImpl.java:529)
  at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
  at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)
  at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4029)
  at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3645)
  at org.eclipse.jface.operation.ModalContext$ModalContextThread.block(ModalContext.java:166)
  at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:368)
  at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:470)
  at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:230)
  at org.eclipse.ui.internal.progress.ProgressManager.lambda$26(ProgressManager.java:836)
  at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
  at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:869)
  at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:845)
  at org.eclipse.ui.internal.SaveableHelper.waitForBackgroundSaveJobs(SaveableHelper.java:442)
  at org.eclipse.ui.internal.SaveablesList.promptForSaving(SaveablesList.java:660)
  at org.eclipse.ui.internal.SaveablesList.promptForSaving(SaveablesList.java:629)
  at org.eclipse.ui.internal.SaveablesList.promptForSavingIfNecessary(SaveablesList.java:595)
  at org.eclipse.ui.internal.SaveablesList.preCloseParts(SaveablesList.java:550)
  at org.eclipse.ui.internal.SaveablesList.preCloseParts(SaveablesList.java:484)
  at org.eclipse.ui.internal.SaveablesList.preCloseParts(SaveablesList.java:479)
  at org.eclipse.ui.internal.SaveablesList.preCloseParts(SaveablesList.java:474)
  at org.eclipse.ui.internal.WorkbenchPage.closeEditors(WorkbenchPage.java:1416)
  at org.eclipse.sirius.ui.business.internal.session.EditingSession$CloseOthersEditorsRunnable.run(EditingSession.java:470)
  at org.eclipse.sirius.ui.business.internal.session.EditingSession.closeOthersEditors(EditingSession.java:317)
  at org.eclipse.sirius.ui.business.internal.session.EditingSession.close(EditingSession.java:311)
  at org.eclipse.sirius.ui.tools.internal.actions.repair.RepresentationFilesNeedCloseSessionValidator.closeSessions(RepresentationFilesNeedCloseSessionValidator.java:172)
  at org.eclipse.sirius.ui.tools.internal.actions.repair.RepresentationFilesNeedCloseSessionValidator.validate(RepresentationFilesNeedCloseSessionValidator.java:106)
  at org.polarsys.capella.core.data.migration.handlers.ProjectMigrationHandler.execute(ProjectMigrationHandler.java:47)
  at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:283)
  at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:97)
  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
  at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.base/java.lang.reflect.Method.invoke(Method.java:568)
  at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
  at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:317)
  at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:251)
  at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
  at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
  at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
  at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:485)
  at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
  at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:438)
  at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.handleWidgetSelection(AbstractContributionItem.java:449)
  at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.lambda$2(AbstractContributionItem.java:475)
  at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
  at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4256)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
  at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4054)
  at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3642)
  at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
  at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
  at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
  at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
  at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:643)
  at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
  at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:550)
  at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:171)
  at org.polarsys.capella.core.platform.sirius.ui.app.CapellaApplication.start(CapellaApplication.java:118)
  at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
  at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.base/java.lang.reflect.Method.invoke(Method.java:568)
  at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
  at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
  at org.eclipse.equinox.launcher.Main.run(Main.java:1467)

  
Then several NPEs or Unhandled Event Loop exception can be thrown as side effect by actions, properties views or any elements trying to perform some refresh and access the model or the session:

  • CapellaDeleteCommand / preferences initialization:
java.lang.NullPointerException: Cannot invoke "org.eclipse.sirius.business.api.session.Session.getSessionResource()" because "session" is null
    at org.polarsys.capella.core.commands.preferences.util.PreferencesHelper.getSelectedCapellaProject(PreferencesHelper.java:166)
    at org.polarsys.capella.core.commands.preferences.service.ScopedCapellaPreferencesStore.getBoolean(ScopedCapellaPreferencesStore.java:187)
    at org.polarsys.capella.core.commands.preferences.service.AbstractPreferencesInitializer.getBoolean(AbstractPreferencesInitializer.java:157)
    at org.polarsys.capella.core.model.preferences.DeletePreferences.isConfirmationRequired(DeletePreferences.java:45)
    at org.polarsys.capella.core.platform.sirius.ui.commands.CapellaDeleteCommand.<init>(CapellaDeleteCommand.java:83)
    at org.polarsys.capella.core.platform.sirius.ui.commands.CapellaDeleteCommand.<init>(CapellaDeleteCommand.java:59)
    at org.polarsys.capella.core.platform.sirius.ui.actions.CapellaDeleteAction.createCommand(CapellaDeleteAction.java:75)
    at org.polarsys.capella.core.ui.toolkit.AbstractCommandActionHandler.getCommand(AbstractCommandActionHandler.java:94)
    at org.polarsys.capella.core.ui.toolkit.AbstractCommandActionHandler.updateSelection(AbstractCommandActionHandler.java:65)
    at org.eclipse.ui.actions.BaseSelectionListenerAction.selectionChanged(BaseSelectionListenerAction.java:128)
    at org.eclipse.ui.actions.BaseSelectionListenerAction.selectionChanged(BaseSelectionListenerAction.java:142)
    at org.eclipse.jface.viewers.Viewer$1.run(Viewer.java:151)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)
    at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:148)
    at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2128)
  • Errors in asynchronous notifications (Capella Navigator, saveable, ...)
java.lang.NullPointerException: Cannot invoke "org.eclipse.ui.ISaveablesLifecycleListener.handleLifecycleEvent(org.eclipse.ui.SaveablesLifecycleEvent)" because "this.listener" is null
   at org.eclipse.ui.navigator.SaveablesProvider.fireSaveablesOpened(SaveablesProvider.java:70)
   at org.polarsys.capella.core.platform.sirius.ui.navigator.viewer.CapellaSaveablesProvider.access$3(CapellaSaveablesProvider.java:1)
   at org.polarsys.capella.core.platform.sirius.ui.navigator.viewer.CapellaSaveablesProvider$4.run(CapellaSaveablesProvider.java:213)
   at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40) 

  • null representationDesxriptor in LinkWithEditor refresh in org.polarsys.capella.core.platform.sirius.ui.navigator.view.AirdDiagramLinkHelper.findSelection(IEditorInput)
  • failed figure paint attempt with Team for Capella connected project
    org.eclipse.net4j.util.lifecycle.LifecycleException: Not active: Transaction 2 [closed]
  at org.eclipse.net4j.util.lifecycle.LifecycleUtil.checkActive(LifecycleUtil.java:102)
  at org.eclipse.net4j.util.lifecycle.Lifecycle.checkActive(Lifecycle.java:223)
  at org.eclipse.emf.internal.cdo.view.AbstractCDOView.getStore(AbstractCDOView.java:463)
  at org.eclipse.emf.internal.cdo.CDOObjectImpl.cdoStore(CDOObjectImpl.java:685)
  at org.eclipse.emf.internal.cdo.CDOObjectImpl.eStore(CDOObjectImpl.java:699)
  at org.eclipse.emf.internal.cdo.CDOObjectImpl.dynamicGet(CDOObjectImpl.java:777)
  at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSettingDelegateSingleEObject.dynamicGet(EStructuralFeatureImpl.java:2589)
  at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicGet(BasicEObjectImpl.java:1084)
  at org.eclipse.sirius.diagram.cdo.impl.DDiagramElementContainerImpl.getOwnedStyle(DDiagramElementContainerImpl.java:204)
  at org.eclipse.sirius.diagram.model.business.internal.cdo.spec.DNodeContainerSpec.getStyle(DNodeContainerSpec.java:58)
  at org.eclipse.sirius.diagram.ui.tools.internal.figure.ContainerWithTitleBlockFigure.geBorderColor(ContainerWithTitleBlockFigure.java:185)
  at org.eclipse.sirius.diagram.ui.tools.internal.figure.ContainerWithTitleBlockFigure.paintBorder(ContainerWithTitleBlockFigure.java:75)
  at org.eclipse.draw2d.Figure.paint(Figure.java:1177)

@mPorhel
Copy link
Contributor Author

mPorhel commented Apr 24, 2024

Scenario 1

  • Open Capella 7 and create a project with a few diagrams
  • Open the project : ActivityExplorer is opened
  • Open a diagram, perform some modifications
  • Run the migration on a freshly imported Capella project created in 6.1
  • Choose to save the opened and modified projects
  • When the migration ask you to perform a backup before the migration execution, you can cancel, this issue is not related to the effective migration behavior but with the preparation steps performed by the action before launching it.
  • Check the errors in error log
  • Expected: all editors (activityEditor and open diagrams) must be closed, project must be closed
  • Expected: after reopening : your changes have been saved.

Scenario 12

  • Open Capella 7 and create a project with a few diagrams
  • Open the project : ActivityExplorer is opened
  • Open a diagram, perform some modifications
  • Right clic the .aird and run the Repair action
  • Choose to save the opened and modified projects
  • Check the errors in error log
  • Expected: all editors (activityEditor and open diagrams) must be closed, project must be closed
  • Expected: after reopening : your changes have been saved.

mPorhel added a commit to mPorhel/capella that referenced this issue Apr 24, 2024
…ot been restored

Signed-off-by: Maxime Porhel <maxime.porhel@obeo.fr>
mPorhel added a commit to mPorhel/capella that referenced this issue Apr 24, 2024
Signed-off-by: Maxime Porhel <maxime.porhel@obeo.fr>
mPorhel added a commit to mPorhel/capella that referenced this issue Apr 24, 2024
- Do not fire events if the saveable session is null or already closed
- Catch NPE due to saveable provider reinitalization between runnables
creation and their async execution.

Signed-off-by: Maxime Porhel <maxime.porhel@obeo.fr>
@mPorhel
Copy link
Contributor Author

mPorhel commented Apr 24, 2024

mPorhel added a commit to mPorhel/capella that referenced this issue Apr 24, 2024
…tion cancelled

Change-Id: I8154bed5896419bcc1055b954941a9c710aca437
Signed-off-by: Maxime Porhel <maxime.porhel@obeo.fr>
@mPorhel
Copy link
Contributor Author

mPorhel commented Apr 24, 2024

New fix added to the PR, seen while testing the other fixes:

  • When Capella Migration runnable starts, it disables CapellaExplorer notifications
  • When Capella migration is cancelled by user by clicking on Cancel button in backup creation popup: Capella notifications are not re-enabled : next project opening does not refresh the explorer, no children displayed under the .aird

Steps to reproduce:

  • Open a project
  • (opt) open a diagrma and do some modification
  • create/import another project
  • launch the migration on this second project
  • cancel the migration at the backup creation popup
  • re-open first project session by double clicking on the aird
  • Activity Explorer is opened,, but session seems to be closed in the Capella explorer: no child displayed under the .aird
  • workaround : close and reopen the project, or open a diagram from the Activity explorer.

See 5524500

lfasani pushed a commit to lfasani/capella that referenced this issue May 15, 2024
…ot been restored

Signed-off-by: Maxime Porhel <maxime.porhel@obeo.fr>
lfasani pushed a commit to lfasani/capella that referenced this issue May 15, 2024
Signed-off-by: Maxime Porhel <maxime.porhel@obeo.fr>
lfasani pushed a commit to lfasani/capella that referenced this issue May 15, 2024
- Do not fire events if the saveable session is null or already closed
- Catch NPE due to saveable provider reinitalization between runnables
creation and their async execution.

Signed-off-by: Maxime Porhel <maxime.porhel@obeo.fr>
lfasani pushed a commit to lfasani/capella that referenced this issue May 15, 2024
…tion cancelled

Change-Id: I8154bed5896419bcc1055b954941a9c710aca437
Signed-off-by: Maxime Porhel <maxime.porhel@obeo.fr>
pdulth pushed a commit to lfasani/capella that referenced this issue May 21, 2024
…tion cancelled

Change-Id: I8154bed5896419bcc1055b954941a9c710aca437
Signed-off-by: Maxime Porhel <maxime.porhel@obeo.fr>
pdulth pushed a commit that referenced this issue May 21, 2024
Signed-off-by: Maxime Porhel <maxime.porhel@obeo.fr>
pdulth pushed a commit that referenced this issue May 21, 2024
Signed-off-by: Maxime Porhel <maxime.porhel@obeo.fr>
pdulth pushed a commit that referenced this issue May 21, 2024
- Do not fire events if the saveable session is null or already closed
- Catch NPE due to saveable provider reinitalization between runnables
creation and their async execution.

Signed-off-by: Maxime Porhel <maxime.porhel@obeo.fr>
pdulth pushed a commit that referenced this issue May 21, 2024
Change-Id: I8154bed5896419bcc1055b954941a9c710aca437
Signed-off-by: Maxime Porhel <maxime.porhel@obeo.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant