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

Bug 478831

Summary: TypeError: Cannot set property 'annotation' of null (in hover.js)
Product: [ECD] Orion Reporter: Grant Gayed <grant_gayed>
Component: ClientAssignee: Curtis Windatt <curtis.windatt.public>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: curtis.windatt.public, Michael_Rennie
Version: unspecified   
Target Milestone: 12.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Grant Gayed CLA 2015-10-01 12:46:36 EDT

    
Comment 1 Grant Gayed CLA 2015-10-01 12:51:02 EDT
This has happened at least twice on Prod in the last day (Chrome).  In hover.js the following can fail:

renderQuickFixes: function(annotation, parentDiv) {
	if  (!annotation || !parentDiv){
		return;
	}

	var actionsDiv = document.createElement("div"); //$NON-NLS-0$
	actionsDiv.className = "commandList"; //$NON-NLS-0$ 
//	this._qfToolbars.push(actionsDiv);
			
	var nodeList = [];
	var metadata = this.inputManager.getFileMetadata();
	metadata.annotation = annotation; // <--------- metadata can be null
Comment 2 Grant Gayed CLA 2015-10-01 14:26:20 EDT
The stack that led to this:

at renderQuickFixes
at (missing fn name)
at _getAnnotationContents
at _renderImmediateInfo
at _processInfo
at onHover
Comment 3 Curtis Windatt CLA 2015-10-01 14:50:38 EDT
The simple solution would be to not add quick fixes if we can't find file metadata.  For all of the existing quickfixes that seems fine as they can't function without modifying the file.  However, someone could have a quickfix that doesn't need file metadata, just which annotation it applies to.  In that case we should just create a temporary object to pass into the command renderer.

Any opinions Eric?
Comment 4 Michael Rennie CLA 2016-05-27 13:55:18 EDT
(In reply to Curtis Windatt from comment #3)
> The simple solution would be to not add quick fixes if we can't find file
> metadata.  For all of the existing quickfixes that seems fine as they can't
> function without modifying the file.  However, someone could have a quickfix
> that doesn't need file metadata, just which annotation it applies to.  In
> that case we should just create a temporary object to pass into the command
> renderer.
> 
> Any opinions Eric?

Managed to figure out some steps:

1. open server.js (in the modules folder)
2. scroll down to line 114 (has var electron = require('electron') on it)
3. notice the warning on 'electron' - scroll the warning such that its in the middle of the page
4. open search to open another file (Ctrl+Shift+F) - the search dialog should be right over the warning from 3.
5. find a file and go to open it. 

After you dismiss the little dialog, a hover request is sent for the warning from 3. and the exception happens. I'm guessing because the inputManager is in the middle of changing editor input, it returns a null metadata object, that leads to the exception.
Comment 5 Curtis Windatt CLA 2016-06-06 14:10:47 EDT
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=60dc0ba4efe4faa4e3ce04ecab377a5906a758a0
Fixed in master

If for any reason we can't get file metadata we should not render quick fixes at all.  Even if we could display them, the fixes couldn't alter the file contents.