Bug 7583 - DOMNode#getChild(String) needs to handle children with null names
Summary: DOMNode#getChild(String) needs to handle children with null names
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P1 normal (vote)
Target Milestone: 2.0 M2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-01-14 17:50 EST by Jed Anderson CLA
Modified: 2002-01-16 17:46 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jed Anderson CLA 2002-01-14 17:50:09 EST
DOMNode#getChild(String) does not take into consideration that there are nodes
that have null names (constructors, initializers).  It should be rewritten as:

/**
 * @see IDOMNode#getChild(String)
 */
public IDOMNode getChild(String name) {
	DOMNode child= fFirstChild;
	while (child != null) {
		String n= child.getName();
		if (name == null) {
			if (n == null)
				return child;
		} else {
			if (name.equals(n))
				return child;
		}
		child= child.fNextNode;
	}
	return null;
}
Comment 1 Olivier Thomann CLA 2002-01-15 12:36:41 EST
I can release this version, but I would like a test case that failed before and 
doesn't fail with this version.
Comment 2 Olivier Thomann CLA 2002-01-16 17:46:53 EST
Released in HEAD.