Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 501910

Summary: NPE in SiriusCommonContentProvider.getProjectsToRefresh(Session)
Product: [Modeling] Sirius Reporter: Stephane Begaudeau <stephane.begaudeau>
Component: CoreAssignee: Pierre-Charles David <pierre-charles.david>
Status: CLOSED FIXED QA Contact: Julien Dupont <julien.dupont>
Severity: normal    
Priority: P3 CC: julien.dupont, maxime.porhel, pierre-charles.david
Version: 4.0.0Keywords: triaged
Target Milestone: 4.1.0   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/81578
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=1538f922fcdd4fdac25158dfe2ec8efa067bf7a2
Whiteboard:
Attachments:
Description Flags
Reproduction case none

Description Stephane Begaudeau CLA 2016-09-21 08:09:21 EDT
When Sirius tries to open an odesign that it cannot load, for example if the odesign has been migrated with a newer version of Sirius or if the odesign is missing, the list of resources can contain null and this code can crash with a NPE:

for (Resource res : resources) {
   try {
      if (res.getURI() != null && res.getURI().isPlatformResource()) {
          // do some stuff
      }
   }
}


It should be "if (res != null && res.getURI() != null ........"
Comment 1 Eclipse Genie CLA 2016-09-21 08:52:27 EDT
New Gerrit change created: https://git.eclipse.org/r/81578
Comment 2 Pierre-Charles David CLA 2016-09-21 08:53:52 EDT
Stéphane, can you provide steps to reproduce? How does it manifest from a user's point of view?

I've proposed a patch in Gerrit with the obvious test, but a proper scenario would be nice.
Comment 3 Maxime Porhel CLA 2016-09-23 05:55:18 EDT
Steps to reproduce: 
 * Import the attached project, it contains a modeling project with its VSM inside. 
 * Open the Project
> You will encounter the NPE mentionned by Stéphane.


The VSM has been manually modified to change the version major number to 99.
Comment 4 Maxime Porhel CLA 2016-09-23 05:57:56 EDT
Created attachment 264374 [details]
Reproduction case
Comment 6 Pierre-Charles David CLA 2016-10-04 09:24:11 EDT
Fixed.
Comment 7 Pierre-Charles David CLA 2016-10-18 11:08:50 EDT
Available in Sirius 4.1.0, see https://wiki.eclipse.org/Sirius/4.1.0 for details.