Bug 501910 - NPE in SiriusCommonContentProvider.getProjectsToRefresh(Session)
Summary: NPE in SiriusCommonContentProvider.getProjectsToRefresh(Session)
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 4.0.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.1.0   Edit
Assignee: Pierre-Charles David CLA
QA Contact: Julien Dupont CLA
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2016-09-21 08:09 EDT by Stephane Begaudeau CLA
Modified: 2016-10-18 11:08 EDT (History)
3 users (show)

See Also:


Attachments
Reproduction case (1.93 KB, application/zip)
2016-09-23 05:57 EDT, Maxime Porhel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.