Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » Exception in SourceModuleAnnotationModel.createPositionFromProblem
Exception in SourceModuleAnnotationModel.createPositionFromProblem [message #556946] Fri, 03 September 2010 05:57 Go to next message
Eric Boureau is currently offline Eric Boureau
Messages: 3
Registered: July 2009
Junior Member
Hi,

When editing my source code in my DLTK based editor, 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 modify the method and add the test below:
protected Position createPositionFromProblem(IProblem problem) {
	int start = problem.getSourceStart();
	if (start < 0)
		return null;
	int end = problem.getSourceEnd();
	if (end == 0 && start == 0) {
		return new Position(0, 0);
	}
	int length = end - start;
	if (length < 0)
		return null;
	int documentLength = fDocument.getLength();
>>>	if (start > documentLength)
>>>		start = documentLength;
	if(start + length > documentLength){
		length = documentLength - start;
	}
	return new Position(start, length);
}

I'm using DLTK 2.0.

I also filled the Bug 323825 in bugzilla.

Thanks,
Eric
Re: Exception in SourceModuleAnnotationModel.createPositionFromProblem [message #557257 is a reply to message #556946] Mon, 06 September 2010 06:08 Go to previous message
Alex Panchenko is currently offline Alex Panchenko
Messages: 342
Registered: July 2009
Senior Member
Hi Eric,

I've applied the changes.

Regards,
Alex
Previous Topic:Piping through multiple interpreters
Next Topic:Where are the DLTK help files?
Goto Forum:
  


Current Time: Wed Jul 23 07:56:09 EDT 2014

Powered by FUDForum. Page generated in 0.04988 seconds