Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 369244 - [implementation] Possible NPE in PresentationReconciler
Summary: [implementation] Possible NPE in PresentationReconciler
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.8   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.8 M5   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-20 10:10 EST by Sven Efftinge CLA
Modified: 2012-01-20 11:17 EST (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 Sven Efftinge CLA 2012-01-20 10:10:45 EST
Build is : org.eclipse.jface.text_3.8.0.v20111115-0800.jar

In org.eclipse.jface.text.presentation.PresentationReconciler line 211 org.eclipse.jface.text.presentation.PresentationReconciler.InternalListener.widgetRegion2ModelRegion(TextEvent) might return null but it's not checked in the following, resulting in an NPE.
Comment 1 Dani Megert CLA 2012-01-20 10:26:04 EST
Do you have steps to reproduce the NPE or did only observe it in the code?
Comment 2 Sven Efftinge CLA 2012-01-20 10:39:31 EST
In my context 

1) a BadLocationException is thrown in org.eclipse.jface.text.projection.ProjectionMapping.checkImageOffset(int) because imageOffset < getImageLength()

2) that one is caught in org.eclipse.jface.text.TextViewer.widgetRange2ModelRange(IRegion) where modelEndOffset == -1. So the method returns null.
Comment 3 Dani Megert CLA 2012-01-20 11:17:05 EST
Fixed in master: 1f15eb8dc3e0a2f94ae44220c4601ba5bee46318