Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353512 - Incorrect use of getElementsByTagName in DBGp property decoding
Summary: Incorrect use of getElementsByTagName in DBGp property decoding
Status: RESOLVED FIXED
Alias: None
Product: DLTK
Classification: Technology
Component: Common-Debug (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: dltk.common-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-01 12:24 EDT by Julien Desgats CLA
Modified: 2011-08-02 07:48 EDT (History)
2 users (show)

See Also:


Attachments
Use only on direct child nodes for property parsing (3.95 KB, patch)
2011-08-01 12:24 EDT, Julien Desgats CLA
alex.panchenko: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Desgats CLA 2011-08-01 12:24:03 EDT
Created attachment 200663 [details]
Use only on direct child nodes for property parsing

When property elements are parsed, the DOM method getElementsByTagName is used. This does not search in children but in all descendant nodes. This lead to problems with nested properties because the nodes are returned in the document order.

For example, take the following Python dictionary 
  { "a": "foo", "b" : { "c": 12, "d": [1, True, "vf"]}, "e": False }

It is not displayed like expected because:
  * The first 3 children returned by getElementsByTagName are "a", "b" and "c" instead of "a", "b" and "e"
  * The first "name" element is used and it could be found in a descendant node (at least it is with my debugger)

The proposed patch search only in direct children on property parsing. I've made a quick review of other getElementsByTagName uses on DBGp part, and except for property elements, they look fine (property is the only recursive structure in DBGp protocol AFAIK).
Comment 1 Alex Panchenko CLA 2011-08-02 07:48:18 EDT
Committed the patch.
Thanks!