Bug 323825

Summary: Exception in SourceModuleAnnotationModel.createPositionFromProblem
Product: [Technology] DLTK Reporter: Eric Boureau <eric.boureau>
Component: CommonAssignee: dltk.common-inbox <dltk.common-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: alex.panchenko
Version: 2.0Flags: alex.panchenko: iplog+
Target Milestone: 2.0.1   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description Eric Boureau CLA 2010-08-27 10:09:50 EDT
Build Identifier: Eclipse 20100218-1602 / DLTK 2.0.0.v20100518-1923-7L--EAAoOVMSKg6AVz-vN

When editing my source code, I sometime have an exception in SourceModuleDocumentProvider.SourceModuleAnnotationModel.createPositionFromProblem.

The exception is raised because the start position is greater than the documentLength which led to create a new Position with a negative length

I suggest to add this test:

	int documentLength = fDocument.getLength();
>>>>	if (start > documentLength)
>>>>		start = documentLength;
	if(start + length > documentLength){
		length = documentLength - start;
	}




Reproducible: Sometimes

Steps to Reproduce:
1. have an error marker on the end of the document
2. press the backspace rapidly to delete some part of code in the document body
Comment 1 Alex Panchenko CLA 2010-09-06 05:14:01 EDT
Applied in HEAD & 2.0 maintenance branch