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

Bug 322850

Summary: SQLUpdater.updateAnnotation does not report problems for first token in the editor
Product: [Tools] Data Tools Reporter: Charles Eutsler <charles.eutsler>
Component: SQL Editor FrameworkAssignee: dtp.sqldevtools-inbox <dtp.sqldevtools-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: bpayton
Version: 1.7   
Target Milestone: 1.8.2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
A patch to fix the problem none

Description Charles Eutsler CLA 2010-08-16 17:59:09 EDT
Build Identifier: 20100617-1415

SQLUpdater.updateAnnotation always returns if ex.currentToken.beginLine < 1. The problem with this is that if the errorToken is the first token in the editor, the currentToken is the null token on line zero. Thus, if the error is on the first token, the updateAnnotation ignores it.

The fix is to return if currentToken.beginLine <1 and the errorToken's image is null or empty.  This way, the errorToken, if it exists or, if not, the currentToken exists, is annotated.

Reproducible: Always

Steps to Reproduce:
1. Open SQL Editor whose type is set to a type that does not consume exceptions. (I can't find one that is delivered with DTP.)
2. Enter a statement that has an error in the first token. For Teradata's parser, this is something like "selet * from tbl;" (That is, misspell "select")
3. See that nothing is annotated in the SQL Editor.
4. See that the Problems view shows the error with the Location showing "Unknown"
Comment 1 Charles Eutsler CLA 2010-08-16 18:00:49 EDT
Created attachment 176742 [details]
A patch to fix the problem

The patch simply checks that there is a token to annotate, either the errorToken is visible or there is a currentToken.
Comment 2 Brian Payton CLA 2010-09-22 19:46:38 EDT
The patch looks pretty safe, so I'll go ahead and apply it.
Comment 3 Brian Payton CLA 2010-09-22 19:50:41 EDT
Checked in patch, tagged to v201009230800