Skip to main content

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 09:57 Go to next message
Eric Boureau is currently offline Eric BoureauFriend
Messages: 3
Registered: July 2009
Junior Member

When editing my source code in my DLTK based editor, I sometime have an exception in:

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.

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

I've applied the changes.

Previous Topic:Unexpected error while trying to create a new project
Next Topic:Where are the DLTK help files?
Goto Forum:

Current Time: Tue Sep 25 13:01:52 GMT 2018

Powered by FUDForum. Page generated in 0.02388 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top