Bug 34576 - isAncestorOf returns true for the component itself
Summary: isAncestorOf returns true for the component itself
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: awt (show other bugs)
Version: unspecified
: P3 normal
Target Milestone: 0.97
Assignee: Andrew John Hughes
URL:
Keywords:
Depends on:
Blocks: 34078
  Show dependency treegraph
 
Reported: 2007-12-24 21:27 UTC by Andrew John Hughes
Modified: 2008-02-15 21:33 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Test Case (144 bytes, text/x-java)
2007-12-25 00:16 UTC, Andrew John Hughes
Details
Committed patch. (298 bytes, patch)
2007-12-25 00:22 UTC, Andrew John Hughes
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew John Hughes 2007-12-24 21:27:49 UTC
The method isAncestorOf in java.awt.Container should return true if the supplied argument is an ancestor of the container.  However, the GNU Classpath implementation also returns true for the container itself i.e.

Container c = new Container();
c.isAncestorOf(c);

returns true.
Comment 1 Andrew John Hughes 2007-12-25 00:16:08 UTC
Created attachment 14822 [details]
Test Case

Test case for this bug.  Also committed to Mauve.
Comment 2 cvs-commit@developer.classpath.org 2007-12-25 00:21:28 UTC
Subject: Bug 34576

CVSROOT:	/cvsroot/classpath
Module name:	classpath
Changes by:	Andrew John Hughes <gnu_andrew>	07/12/25 00:21:02

Modified files:
	.              : ChangeLog 
	java/awt       : Container.java 

Log message:
	2007-12-25  Andrew John Hughes  <gnu_andrew@member.fsf.org>
	
	        PR classpath/34576:
		* java/awt/Container.java:
		(isAncestorOf(Component)): Swap ordering so that
		the parent is retrieved prior to checking against 
		this, thus preventing a component being an ancestor of
		itself.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpath&r1=1.9450&r2=1.9451
http://cvs.savannah.gnu.org/viewcvs/classpath/java/awt/Container.java?cvsroot=classpath&r1=1.112&r2=1.113



Comment 3 Andrew John Hughes 2007-12-25 00:22:27 UTC
Created attachment 14823 [details]
Committed patch.
Comment 4 Andrew John Hughes 2007-12-25 00:22:44 UTC
Fixed in CVS. Closing.