Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322850 - SQLUpdater.updateAnnotation does not report problems for first token in the editor
Summary: SQLUpdater.updateAnnotation does not report problems for first token in the e...
Status: RESOLVED FIXED
Alias: None
Product: Data Tools
Classification: Tools
Component: SQL Editor Framework (show other bugs)
Version: 1.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.8.2   Edit
Assignee: dtp.sqldevtools-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-16 17:59 EDT by Charles Eutsler CLA
Modified: 2010-09-22 19:50 EDT (History)
1 user (show)

See Also:


Attachments
A patch to fix the problem (1.01 KB, patch)
2010-08-16 18:00 EDT, Charles Eutsler CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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