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

Bug 352979

Summary: NPE switching to properties view with unmatchedElements
Product: [Modeling] EMFCompare Reporter: Bouchet Stéphane <sbouchet>
Component: CoreAssignee: EMF Compare <emf.compare-inbox>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3 CC: laurent.goubet
Version: 1.2   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
TestCase none

Description Bouchet Stéphane CLA 2011-07-25 04:38:10 EDT
Created attachment 200257 [details]
TestCase

HI,

steps to reproduce : 
use the attached testcase, compare with each others the provided ecore files

There is 5 added elements. 

navigate to one of these
the 'differences' tab will display correctly the added elements. 
switch to properties ->  NPE .

this NPE is causing major breaks in eclipse UI ( refreshes are all broken ) 


investigations : 
The input of properties view is set to null by default. then, the ModelContentMergePropertyTab#setReflectiveInput() methods sets again the input to null ( line 312 ) on unmatchedElements. then the NPE occurs. ( see Stack ) : 
java.lang.NullPointerException
	at org.eclipse.emf.compare.ui.viewer.content.part.property.ModelContentMergePropertyTab.getUIItem(ModelContentMergePropertyTab.java:201)
	at org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder.getUIItem(ModelContentMergeTabFolder.java:189)
	at org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer$CenterCanvas.hasLineBeDrawn(ModelContentMergeViewer.java:1117)
	at org.eclipse.emf.compare.ui.viewer.content.ParameterizedContentMergeViewer$ParameterizedCenterCanvas.hasLineBeDrawn(ParameterizedContentMergeViewer.java:78)
	at org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer$CenterCanvas.doPaint(ModelContentMergeViewer.java:1100)
	at org.eclipse.emf.compare.ui.viewer.content.part.AbstractCenterPart.doubleBufferedPaint(AbstractCenterPart.java:198)
	at org.eclipse.emf.compare.ui.viewer.content.part.AbstractCenterPart$1.paintControl(AbstractCenterPart.java:59)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:229)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1267)
	at org.eclipse.swt.widgets.Composite.gtk_expose_event(Composite.java:724)
	at org.eclipse.swt.widgets.Canvas.gtk_expose_event(Canvas.java:167)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1739)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:5016)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4408)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8394)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1245)
	at org.eclipse.swt.internal.gtk.OS._gdk_window_process_all_updates(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gdk_window_process_all_updates(OS.java:5470)
	at org.eclipse.swt.widgets.Display.update(Display.java:4361)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:832)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.jface.dialogs.MessageDialog.open(MessageDialog.java:334)
	at org.eclipse.jface.dialogs.MessageDialogWithToggle.open(MessageDialogWithToggle.java:114)
	at org.eclipse.jface.dialogs.MessageDialogWithToggle.openOkCancelConfirm(MessageDialogWithToggle.java:209)
	at org.eclipse.ui.internal.ide.application.IDEWorkbenchWindowAdvisor.promptOnExit(IDEWorkbenchWindowAdvisor.java:218)
	at org.eclipse.ui.internal.ide.application.IDEWorkbenchWindowAdvisor.preWindowShellClose(IDEWorkbenchWindowAdvisor.java:171)
	at org.eclipse.ui.internal.WorkbenchWindow.fireWindowShellClosing(WorkbenchWindow.java:1370)
	at org.eclipse.ui.internal.WorkbenchWindow.canHandleShellCloseEvent(WorkbenchWindow.java:850)
	at org.eclipse.jface.window.Window$3.shellClosed(Window.java:686)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:98)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1267)
	at org.eclipse.swt.widgets.Shell.closeWidget(Shell.java:617)
	at org.eclipse.swt.widgets.Shell.gtk_delete_event(Shell.java:1189)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1735)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:5016)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4408)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8394)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1245)
	at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
	at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2258)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3207)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Comment 1 Laurent Goubet CLA 2011-07-25 11:09:10 EDT
This is a regression that was dormant since sept, 2009. Basically, selecting any "UnmatchedElement" (as the very first selection in a given compare editor) and switching to the properties tab was throwing that NPE.

It has now been fixed on master.
Comment 2 Bouchet Stéphane CLA 2011-07-26 07:44:19 EDT
verified in master.