On May 5, 2009, at 12:55 PM, Thomas Mortagne wrote: > On Tue, May 5, 2009 at 12:49, Vincent Massol <[email protected]> > wrote: >> >> On May 5, 2009, at 12:40 PM, tmortagne (SVN) wrote: >> >>> Author: tmortagne >>> Date: 2009-05-05 12:40:47 +0200 (Tue, 05 May 2009) >>> New Revision: 19378 >>> >>> Added: >>> platform/core/branches/xwiki-core-1.8/xwiki-bridge/src/test/ >>> platform/core/branches/xwiki-core-1.8/xwiki-bridge/src/test/java/ >>> platform/core/branches/xwiki-core-1.8/xwiki-bridge/src/test/java/ >>> org/ >>> platform/core/branches/xwiki-core-1.8/xwiki-bridge/src/test/java/ >>> org/xwiki/ >>> platform/core/branches/xwiki-core-1.8/xwiki-bridge/src/test/java/ >>> org/xwiki/bridge/ >>> platform/core/branches/xwiki-core-1.8/xwiki-bridge/src/test/java/ >>> org/xwiki/bridge/DocumentNameTest.java >>> Modified: >>> platform/core/branches/xwiki-core-1.8/xwiki-bridge/src/main/java/ >>> org/xwiki/bridge/DocumentName.java >>> platform/core/branches/xwiki-core-1.8/xwiki-core/src/main/java/ >>> com/ >>> xpn/xwiki/doc/XWikiDocument.java >>> platform/core/branches/xwiki-core-1.8/xwiki-core/src/test/java/ >>> com/ >>> xpn/xwiki/doc/XWikiDocumentTest.java >>> Log: >>> XWIKI-3754: XWikiDocument.getLinkedPages loose multiwiki information >> >> [snip] >>> >>> + >>> + /** >>> + * {...@inheritdoc} >>> + * >>> + * @see java.lang.Object#equals(java.lang.Object) >>> + */ >>> + @Override >>> + public boolean equals(Object obj) >>> + { >>> + boolean equals = false; >>> + >>> + if (obj == this) { >>> + equals = true; >>> + } else if (obj instanceof DocumentName) { >>> + DocumentName documentName = (DocumentName) obj; >>> + >>> + equals = >>> + documentName.getWiki().equals(this.getWiki()) && >>> documentName.getSpace().equals(this.getSpace()) >>> + && >>> documentName.getPage().equals(this.getPage()); >>> + } >>> + >>> + return equals; >>> + } >> >> You're not handling null I think. > > Yes but I assume DocumentName is supposed to be valid
Equals methods should not assume this. I personally use this resource when coding equals/hashcode: http://www.geocities.com/technofundo/tech/java/equalhash.html -Vincent _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

