Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 341179 - StackOverflow in AttributesReconcileAdapter while manually editing xml schema doc
Summary: StackOverflow in AttributesReconcileAdapter while manually editing xml schema...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: WTP Incubator (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Dimitar Tenev CLA
QA Contact: Dimitar Tenev CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-28 19:57 EDT by Dimitar Donchev CLA
Modified: 2021-11-18 16:19 EST (History)
1 user (show)

See Also:


Attachments
just write xmlns (1.76 KB, text/plain)
2011-03-28 19:57 EDT, Dimitar Donchev CLA
no flags Details
All exceptions after the StackOverflow (1002.12 KB, text/plain)
2011-03-28 19:57 EDT, Dimitar Donchev CLA
no flags Details
proposed patch (5.88 KB, patch)
2011-06-19 03:25 EDT, Stanislav Nichev CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitar Donchev CLA 2011-03-28 19:57:09 EDT
Created attachment 192055 [details]
just write xmlns

Try to add the follwoing string to the <schema element of the attached document : 
" xmlns="" " (write it symbol by symbol).

CAUTION - SAVE YOUR CURRENT WORK, STACK OVERFLOW WILL OCCUR! ;)
Comment 1 Dimitar Donchev CLA 2011-03-28 19:57:58 EDT
Created attachment 192056 [details]
All exceptions after the StackOverflow

You should reproduce this :
Comment 2 Nitin Dahyabhai CLA 2011-04-28 01:52:05 EDT
Notified adapters are not allowed to change the model/document during their notification.  What's the reason for trying to do so?
Comment 3 Stanislav Nichev CLA 2011-06-19 03:25:15 EDT
Created attachment 198227 [details]
proposed patch

Hi Guys,

This was a very interesting issue.
Each time you start typing an attribute name, the DOM API is creating attribute. 

For example for "xmlns", we receive notifications for several attributes with names "x", "xm", ... and "xmlns". The value of the attribute is the default one: an empty string.

In the decribed test case, when we received a full attribute name we were intersted in ("xmlns") we made some checks if such namespace already existed and made some changes on it. 
Unfortunently, the EMF API updated all the DOM attributes, including the existing ones. In order to prevent that, I've added some checks for the count of the attributes. 
This solved the issue or even - preserved the first and existing value.

Also, I've decided to test the problem when deliting attribute. For example, imagine we have two attributes: "xmlns" and "xmlns:abc". When renaming "xmlns:abc" to "xmlns", the DOM is firing event for delete of "xmlns:abc" with the new value of "xmlns". Thus, we assumed that we were deleting the "xmlns" attribute and fired some emf notification, which, in turn, deleted both the attributes.
This is no longer the case, since we check the attribute count here as well.

I've not prepared a test for this issue. I'm interested in your proposals on how we can test this.

So far, we have not introduced such tests in SIE - writing in source, or at least, I'm unaware of such.

Anyway, I'm attaching the patch.

Regards,
Stanislav
Comment 4 Stanislav Nichev CLA 2011-06-19 03:26:47 EDT
Comment on attachment 198227 [details]
proposed patch

forgot to set as patch
Comment 5 Dimitar Tenev CLA 2011-07-04 01:54:42 EDT
Hi Stanislav,

Thanks for the fix. I have retested and submitted it. It seems to works fine.

Best regards,
DImitar