Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 28381 - [OLE] OleEditor.setResource does not guard against null resource location
Summary: [OLE] OleEditor.setResource does not guard against null resource location
Status: CLOSED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P2 normal (vote)
Target Milestone: 2.1 M5   Edit
Assignee: Tod Creasey CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 29492 29493 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-12-16 10:53 EST by Knut Radloff CLA
Modified: 2005-05-10 14:54 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 Knut Radloff CLA 2002-12-16 10:53:28 EST
build 20021210

The linked resource ui will eventually allow creating linked resource using non-
existent path variables. In that case IResource.getLocation will return null. 
ExternalEditor.open should test this condition. See bug 28303.
Comment 1 Knut Radloff CLA 2002-12-16 11:12:45 EST
Also check ExternalEditor.openWithUserDefinedProgram, 
EditorManager.openSystemEditor, OleEditor.setResource. They aren't necessarily 
a problem but they don't check getLocation() for null.
Comment 2 Eduardo Pereira CLA 2003-01-20 16:20:40 EST
Fixed EditorManager and ExternalEditor.
Assigned to Tod to check OLEEditor.
Comment 3 Eduardo Pereira CLA 2003-01-20 16:23:34 EST
*** Bug 29492 has been marked as a duplicate of this bug. ***
Comment 4 Eduardo Pereira CLA 2003-01-20 16:24:05 EST
*** Bug 29493 has been marked as a duplicate of this bug. ***
Comment 5 Tod Creasey CLA 2003-01-22 09:13:59 EST
The OLEEditor is completely useless without the java.io.File - swt cannot 
handle this case at all. If there is no File then we should not open this 
editor at all.

This test is not going to be suffienct anyways. It is currently possible to 
have a location in a file but no valid file associated with it. THis will fall 
through and create an exception.

STEPS
1) Create a file linked to a bogus variable.
2) Open it - getLocation will return a value but the file will still not exist.
Comment 6 Tod Creasey CLA 2003-01-22 09:16:25 EST
I have added the following check to OLEEditor

//Cannot create this with a file and no physical location
		if(!new File(file.getLocation().toOSString()).exists())
			throw new PartInitException(
				WorkbenchMessages.format
("OleEditor.noFileInput", new Object[] { file.getLocation() })); //$NON-NLS-1$
Comment 7 Tod Creasey CLA 2003-01-22 09:18:02 EST
Fixed in build >20020122
Comment 8 Tod Creasey CLA 2005-05-10 14:54:16 EDT
Marking as closed.