[fix] Avoid a potential NPE

The test org.eclipse.sirius.tests.swtbot.SessionEditorProjectRemovalTest
sometimes fails in NPE (see stack tract at the end of the comment).
It is possible if the DASI is closed before the
org.eclipse.sirius.business.internal.session.danalysis.DViewOperations.getSelectedViewpoints(boolean)
is called. In this case, session.getMainAnalysis() return null.

Corresponding stack trace:
java.lang.NullPointerException
	at org.eclipse.sirius.business.internal.session.danalysis.DViewOperations.getSelectedViews(DViewOperations.java:83)
	at org.eclipse.sirius.business.internal.session.danalysis.DViewOperations.getSelectedViewpoints(DViewOperations.java:71)
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.getSelectedViewpoints(DAnalysisSessionImpl.java:1298)
	at org.eclipse.sirius.ui.tools.internal.viewpoint.ViewpointHelper.isViewpointEnabledInSession(ViewpointHelper.java:113)
	at org.eclipse.sirius.ui.tools.internal.wizards.pages.SiriusRepresentationWithInactiveStatusLabelProvider.getText(SiriusRepresentationWithInactiveStatusLabelProvider.java:62)
	at org.eclipse.ui.internal.navigator.NavigatorDecoratingLabelProvider$StyledLabelProviderAdapter.getStyledText(NavigatorDecoratingLabelProvider.java:71)
...
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3919)
...

Change-Id: I8a2290c53edd4ef1282885d06ebb2fdcdc91a7ca
Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
1 file changed
tree: cdb16c0c207378c91cec258a3fdd5ce0d64f3824
  1. packaging/
  2. plugins/
  3. releng/
  4. .gitattributes
  5. .gitignore
  6. .travis.yml
  7. build.sh
  8. CONTRIBUTING
  9. Jenkinsfile
  10. LICENSE
  11. NOTICE
  12. pom.xml
  13. README.md
README.md

Eclipse Sirius

Build Status

Sirius enables the specification of a modeling workbench in terms of graphical, table or tree editors with validation rules and actions using declarative descriptions.

For more details see the project page and the main wiki page.

Building

The build uses Tycho. To launch a complete build, issue

mvn clean package

from the top-level directory. The resulting update-site (p2 repository) can be found in packaging/org.eclipse.sirius.update/target/repository.

By default the build uses a Neon-based target platform. You can specify a different platform like this:

mvn clean package -Dplatform-version-name=name

where name can be any of the following values:

  • mars (Eclipse 4.5)
  • neon (Eclipse 4.6, the default and reference target platform)
  • canary (uses nightly builds of all our dependencies, only used for testing)

The corresponding target platform definitions can be found in releng/org.eclipse.sirius.targets.