Bug 414116

Summary: NPE in AbstractTaskEditorPage.getTaskRepository() when loading of the task model fails
Product: z_Archived Reporter: Tomasz Zarna <tomasz.zarna>
Component: MylynAssignee: Tomasz Zarna <tomasz.zarna>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.0.1   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Gerrit Editor test
none
mylyn/context/zip none

Description Tomasz Zarna CLA 2013-07-31 07:14:09 EDT
master

Found in the log when opening a review:

!ENTRY org.eclipse.mylyn.tasks.ui 4 0 2013-07-31 13:08:49.593
!MESSAGE Could not create editor via factory: org.eclipse.mylyn.internal.gerrit.ui.editor.GerritTaskEditorPageFactory@4ed0efda
!STACK 0
java.lang.NullPointerException
	at org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage.getTaskRepository(AbstractTaskEditorPage.java:1195)
	at org.eclipse.mylyn.reviews.ui.spi.editor.AbstractReviewTaskEditorPage.getFactoryProvider(AbstractReviewTaskEditorPage.java:130)
	at org.eclipse.mylyn.reviews.ui.spi.editor.AbstractReviewTaskEditorPage.checkIfModelIsCached(AbstractReviewTaskEditorPage.java:89)
	at org.eclipse.mylyn.reviews.ui.spi.editor.AbstractReviewTaskEditorPage.init(AbstractReviewTaskEditorPage.java:77)
	at org.eclipse.ui.forms.editor.FormEditor.registerPage(FormEditor.java:657)
	at org.eclipse.ui.forms.editor.FormEditor.configurePage(FormEditor.java:348)
	at org.eclipse.ui.forms.editor.FormEditor.addPage(FormEditor.java:190)
	at org.eclipse.mylyn.tasks.ui.editors.TaskEditor.addPages(TaskEditor.java:410)
	at org.eclipse.ui.forms.editor.FormEditor.createPages(FormEditor.java:138)
	at org.eclipse.ui.forms.editor.SharedHeaderFormEditor.createPages(SharedHeaderFormEditor.java:98)
	at org.eclipse.mylyn.tasks.ui.editors.TaskEditor.createPages(TaskEditor.java:196)
	at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:348)
	at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:670)
	at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
	at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:315)
	at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
	at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
	at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
	at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
	at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1245)
	at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1198)
	at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1597)
	at org.eclipse.ui.internal.PartStack.add(PartStack.java:493)
	at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103)
	at org.eclipse.ui.internal.PartStack.add(PartStack.java:479)
	at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112)
	at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:63)
	at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:225)
	at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:213)
	at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:808)
	at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:707)
	at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:666)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2955)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2863)
	at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2855)
	at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2806)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2802)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2786)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2769)
	at org.eclipse.mylyn.tasks.ui.TasksUiUtil.openEditor(TasksUiUtil.java:182)
	at org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal.openTask(TasksUiInternal.java:923)
	at org.eclipse.mylyn.tasks.ui.TasksUiUtil.openTask(TasksUiUtil.java:283)
	at org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal$3$1.run(TasksUiInternal.java:317)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4144)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	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:353)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1414)

Closing and reopening the editor helped.
Comment 1 Miles Parker CLA 2013-07-31 14:52:03 EDT
I actually had a review a while back to check for this NPE, but it probably would have simply diferred the issue anyway. I think this is happening because we don't have a TaskDataModel yet, and I'm not sure what circumstances would cause that.
Comment 2 Steffen Pingel CLA 2013-08-11 23:09:49 EDT
This happens when the task model can not be loaded. You should be able to reproduce the problem by deleting/corrupting the task data from the offline cache prior to opening the editor. The code could simply use the repository from the input rather than model to work around it.
Comment 3 Steffen Pingel CLA 2013-08-12 02:20:45 EDT
Pushed a proposed fix here: https://git.eclipse.org/r/15329. We should add a test case before merging.
Comment 4 Tomasz Zarna CLA 2013-08-13 11:28:36 EDT
Created attachment 234359 [details]
Gerrit Editor test

A test for opening the editor from corrupted (here: non-existing) cache.

I'm not able to push on behalf of others thus attaching the class.
Comment 5 Tomasz Zarna CLA 2013-08-13 11:28:44 EDT
Created attachment 234360 [details]
mylyn/context/zip
Comment 6 Steffen Pingel CLA 2013-08-13 12:19:16 EDT
Tomasz, can you simply push your change as a new review that depends on the existing review?
Comment 7 Tomasz Zarna CLA 2013-08-13 12:35:58 EDT
(In reply to comment #6)
> push your change as a new review that depends on the existing review

It's https://git.eclipse.org/r/#/c/15441/
Comment 8 Steffen Pingel CLA 2013-08-13 13:01:40 EDT
Thanks very much! I merged both changes.