Bug 406439 - EMF Compare does not support list with null values
Summary: EMF Compare does not support list with null values
Status: CLOSED FIXED
Alias: None
Product: EMFCompare
Classification: Modeling
Component: Core (show other bugs)
Version: 2.1.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: Luna   Edit
Assignee: EMF Compare CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2013-04-24 10:04 EDT by Laurent Goubet CLA
Modified: 2014-03-28 12:01 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent Goubet CLA 2013-04-24 10:04:40 EDT
Attribute lists (and maybe single-valued attributes?) can contain "null", however, EMF Compare uses ImmutableLists... that do not accept the null values. This causes NPEs to be thrown and needs to be investigated further. One such NPE would be :

java.lang.NullPointerException
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:187)
	at com.google.common.collect.SingletonImmutableList.<init>(SingletonImmutableList.java:41)
	at com.google.common.collect.ImmutableList.copyFromCollection(ImmutableList.java:284)
	at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:256)
	at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:217)
	at org.eclipse.emf.compare.utils.DiffUtil.longestCommonSubsequence(DiffUtil.java:168)
	at org.eclipse.emf.compare.utils.DiffUtil.longestCommonSubsequence(DiffUtil.java:211)
	at org.eclipse.emf.compare.diff.DefaultDiffEngine.computeMultiValuedFeatureDifferencesTwoWay(DefaultDiffEngine.java:655)
Comment 1 Laurent Goubet CLA 2013-07-22 05:56:19 EDT
Nulls are a valid value of the attribute lists. An easy fix is to convert the Iterable into a Collection and change the use of ImmutableList here for Collections.unmodifiableList()
Comment 2 Axel RICHARD CLA 2014-03-25 06:07:34 EDT
Review has been proposed: https://git.eclipse.org/r/23848
Comment 3 Axel RICHARD CLA 2014-03-28 12:01:50 EDT
Fixed with https://git.eclipse.org/r/#/c/23848/