tracker issue : CF-3041261

select a category, or use search below
(searches all categories and all time range)
Title:

Bug 82577:the underlying hashCode() operation of a CFC (TemplateProxy), only considers the 'this' scope when creating it's hashCode

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/

Reporter/Name(from Bugbase): Mark Mandel / Mark Mandel (mark.mandel)

Created: 04/01/2010

Components: Language, CF Component

Versions: 9.0

Failure Type: Unspecified

Found In Build/Fixed In Build: 0000 /

Priority/Frequency: Minor / Unknown

Locale/System: English / Platforms All

Vote Count: 0

Problem:

the underlying hashCode() operation of a CFC (TemplateProxy), only considers the 'this' scope when creating it's hashCode.This becomes an issue when utilising Java Collections, as they cannot differentiate between instance of a CFC of the same type, as they each have the same hashcode.The hashCode() implementation should either (a) consider both the 'this' and 'variables' scope of a CFC - or, (b) just consider the variables scope, which will make it unique per instance.
Method:

SimpleObject.cfc:----------------------------component {}index.cfm-------------------------<cfscript>array = createObject("java", "java.util.ArrayList").init();obj1 = new SimpleObject();obj2 = new SimpleObject();array.add(obj1);</cfscript><cfoutput>Have object 1 (Should be true): #array.contains(obj1)#<br/>Have object 2 (Should be false): #array.contains(obj2)#<br/></cfoutput>Outputs:Have object 1 (Should be true): YESHave object 2 (Should be false): YES
Result:

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3041261

Deployment Phase:	Release Candidate

External Customer Info:
External Company:  
External Customer Name: Mark Mandel
External Customer Email: 3EA9517D445A9E8999201549
External Test Config: 04/01/2010

Attachments:

Comments: