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

Bug 353512

Summary: Incorrect use of getElementsByTagName in DBGp property decoding
Product: [Technology] DLTK Reporter: Julien Desgats <jdesgats>
Component: Common-DebugAssignee: dltk.common-inbox <dltk.common-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: alex.panchenko, contact
Version: 3.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Use only on direct child nodes for property parsing alex.panchenko: iplog+

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!