Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 369244

Summary: [implementation] Possible NPE in PresentationReconciler
Product: [Eclipse Project] Platform Reporter: Sven Efftinge <sven.efftinge>
Component: TextAssignee: Dani Megert <daniel_megert>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert
Version: 3.8   
Target Milestone: 3.8 M5   
Hardware: All   
OS: All   
Whiteboard:

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