| Summary: | textInputListener from OutlinePage is unsafe | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Samantha Chan <chanskw> |
| Component: | Xtext | Assignee: | Jan Koehnlein <jan> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | jan, karsten.thoms, mkomor, sebastian.zarnekow, tmf.xtext-inbox |
| Version: | 2.0.0 | Flags: | sebastian.zarnekow:
indigo+
|
| Target Milestone: | SR2 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
Is it possible to target this for the next 2.0 SR? Thanks! Scheduled for 2.1 *** Bug 345388 has been marked as a duplicate of this bug. *** Added a couple of NPE guards. I'd like to provide a test, too, but I can't figure out how to reproduce the NPE. Can you give me a hint? (In reply to comment #4) > I'd like to provide a test, too, but I can't figure out how to reproduce the > NPE. Can you give me a hint? Ping. As there was no hint how to test this, I am closing this without a test. Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |
In this code here: textInputListener = new ITextInputListener() { public void inputDocumentChanged(IDocument oldInput, IDocument newInput) { try { xtextDocument.removeModelListener(modelListener); xtextDocument = XtextDocumentUtil.get(newInput); xtextDocument.addModelListener(modelListener); scheduleRefresh(); } catch (Throwable t) { LOG.error("Error refreshing outline", t); } } public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) { } }; XTextDocumentUtil.get(newInput) can return null as the xtextDocument. We use the XtextDocument object without checking the return value, causing NPE to happen.