Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 199770 - Check for invalid FileEditorInputs
Summary: Check for invalid FileEditorInputs
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: 3.4 M2   Edit
Assignee: Tod Creasey CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 187877
Blocks:
  Show dependency tree
 
Reported: 2007-08-13 11:33 EDT by Tod Creasey CLA
Modified: 2007-09-18 15:33 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tod Creasey CLA 2007-08-13 11:33:40 EDT
See Bug 191694.

Currently it is possible to have an invalid file (no location or URI) on construction of a FileEditorInput. We should throw an IllegalArgumentException like  we do for a null file.
Comment 1 Tod Creasey CLA 2007-08-13 11:39:24 EDT
Fix released in build >20070813
Comment 2 John Arthorne CLA 2007-08-13 13:58:45 EDT
Hmm.. this change makes it illegal to create a FileEditorInput on a file that is not in the local file system.  While this avoids clients getting an NPE from getLocation(), it prevents the use case for which we created IURIEditorInput, etc.
Comment 3 Tod Creasey CLA 2007-08-13 14:06:35 EDT
So what is your suggestion John? Should be leave it as it was in 3.3 and warn in the constructor about this.

The other option is to be more aggressive about the PartInitException and throw it when this case occurs in the constructor.

Also from an EFS point of view are we preventing updates?
Comment 4 Tod Creasey CLA 2007-08-13 15:55:15 EDT
We have decided on a more conservative path in the end. We will not be doing this in the constructor as it adds subtle behavioural issues to getURI.

We will now throw an IllegalArguementException rather than an NPE and I have added a static method isLocalFile to allow developers to check without having to catch IllegalArgumentException.
Comment 5 Tod Creasey CLA 2007-08-13 16:14:37 EDT
An entry has also been added to the porting guide.
Comment 6 Tod Creasey CLA 2007-09-18 15:33:26 EDT
Verified in I20070918-0100 by code inspection