Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 319730 - IllegalArgumentException while editing file with Xtext Editor
Summary: IllegalArgumentException while editing file with Xtext Editor
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: SR1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-13 10:28 EDT by Ludwig Straub CLA
Modified: 2017-09-19 17:28 EDT (History)
2 users (show)

See Also:
sebastian.zarnekow: helios+


Attachments
archive with all files to reproduce the issue (73.56 KB, application/x-zip-compressed)
2010-07-13 10:30 EDT, Ludwig Straub CLA
no flags Details
Patch for HEAD on 2010-07-28 on o.e.x.ui (1.74 KB, patch)
2010-07-28 11:06 EDT, Benjamin Schwertfeger CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ludwig Straub CLA 2010-07-13 10:28:29 EDT
Build Identifier: 20100617-1415

In certain circumstances the generated dsl editor throws an IllegalArgumentException resulting either in a corrupt editor or a corrupt in-memory-model.
(Exception detail: see attachment: "Exception.txt" in "xtext_issue.zip")

Reproducible: Always

Steps to Reproduce:
1. extract attachment
2. use org.xtext.example.mydsl + org.xtext.example.mydsl.ui from archive to launch an eclipse application
3. load project "mydsl" from archive in workspace
4. edit the file "test.mydsl" in imported project as follows:
a) remove the "(" of line 3
b) clean all characters of line 2
c) enter "(" in line 2
d) as soon as you try to enter ")" after the "(" in line 2, the Exception occurs and the ")" is not printed.

Note: If you then save the model and reopen the file, the ")" does exist.
Comment 1 Ludwig Straub CLA 2010-07-13 10:30:24 EDT
Created attachment 174153 [details]
archive with all files to reproduce the issue
Comment 2 Benjamin Schwertfeger CLA 2010-07-28 11:04:35 EDT
The SingleLineTerminalsStrategy tries to overwrite always one character more in #handleInsertRightTerminal, if the number of right and left are balanced before insertion and right is inserted. 

If your document is balanced and behind the curser is not a right-Terminal, the next character is replaced. If the next character is a \n the editor throws an IllegalArgument exception, as mentioned above, or removes the new line.

What should be:
If the next text right behind the new text position is the right-Terminal, this should be replaced. If not, the terminal should be included without changed.
Comment 3 Benjamin Schwertfeger CLA 2010-07-28 11:06:24 EDT
Created attachment 175416 [details]
Patch for HEAD on 2010-07-28 on o.e.x.ui

Patch for SingleLineTerminalsStrategy to not always overwrite the next character
Comment 4 Sebastian Zarnekow CLA 2010-07-28 15:21:10 EDT
Fixed in HEAD. 

As I did not apply the patch directly, I'ld like you to verify the fix. Thanks.
Comment 5 Benjamin Schwertfeger CLA 2010-07-28 16:29:49 EDT
the current head works also.
Thanks
Comment 6 Karsten Thoms CLA 2017-09-19 17:16:55 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 7 Karsten Thoms CLA 2017-09-19 17:28:15 EDT
Closing all bugs that were set to RESOLVED before Neon.0