Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367317 - [editor] XtextDocument should not call IUnitOfWork with null resource
Summary: [editor] XtextDocument should not call IUnitOfWork with null resource
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.2.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard: v2.8
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-21 08:26 EST by Jan Koehnlein CLA
Modified: 2017-10-31 10:57 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 Jan Koehnlein CLA 2011-12-21 08:26:44 EST
In some situations, e.g. when eclipse is restarted with open editors to no longer existing files, the XtextDocument calls IUnitOfWorks with a 'null' state.

Instead of dealing with that condition in all clients, I'd rather not call the IUnitOfWork when there is no resource.
Comment 1 Karsten Thoms CLA 2016-04-13 14:08:39 EDT
An NPE guard was added with #fb09ed5c5be11955772544226a17ca4e878ab053 on 2015-02-16. Considering as fixed.

internalModify(new IUnitOfWork.Void<XtextResource>() {
  @Override
  public void process(XtextResource state) throws Exception {
    // the resource may already be null if the document was opened for a bogus
    // storage / stream - NPE guard here
    if (state != null) { ... }
Comment 2 Eclipse Webmaster CLA 2017-10-31 10:46:33 EDT
Requested via bug 522520.

-M.
Comment 3 Eclipse Webmaster CLA 2017-10-31 10:57:48 EDT
Requested via bug 522520.

-M.