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

Bug 406439

Summary: EMF Compare does not support list with null values
Product: [Modeling] EMFCompare Reporter: Laurent Goubet <laurent.goubet>
Component: CoreAssignee: EMF Compare <emf.compare-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: axel.richard
Version: 2.1.0Keywords: helpwanted
Target Milestone: Luna   
Hardware: PC   
OS: Windows 7   
Whiteboard:

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/