[ https://issues.apache.org/jira/browse/FLEX-24296?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Justin Mclean resolved FLEX-24296. ---------------------------------- Resolution: Fixed Fix Version/s: Apache Flex 4.10.0 Checked into develop > ListCollectionView should throw a RangeError instead of Error when accessed > with negative index via squared brackets > --------------------------------------------------------------------------------------------------------------------- > > Key: FLEX-24296 > URL: https://issues.apache.org/jira/browse/FLEX-24296 > Project: Apache Flex > Issue Type: Bug > Components: Collections > Affects Versions: Adobe Flex SDK 3.5 (Release) > Environment: Affected OS(s): All OS Platforms > Affected OS(s): All OS Platforms > Language Found: English > Reporter: Adobe JIRA > Labels: easyfix, easytest > Fix For: Apache Flex 4.10.0 > > > Steps to reproduce: > 1. create a ListCollectionView or a subclass of it like ArrayCollection > 2. access the collection with index -1. > > Actual Results: > an error is thrown stating invalid property (e.g "invalid property: > -1") > > Expected Results: > a RangeError is thrown, like for positive invalid indices > Note: The error has been seen in > mx.controls.treeClasses.HierarchicalViewCursor which uses > array like access but only catches range errors. > > Workaround (if any): > Use getItemAt instead or modify ListCollectionView#getProperty > > override flash_proxy function getProperty(name:*):* > { > if (name is QName) > name = name.localName; > var index:int = -1; > var isNumber:Boolean = false; //<= added > try > { > // If caller passed in a number such as 5.5, it will be floored. > var n:Number = parseInt(String(name)); > if (!isNaN(n)) { > index = int(n); > isNumber = true; //<= added > } > } > catch(e:Error) // localName was not a number > { > } > if (!isNumber) //<= changed > { > var message:String = resourceManager.getString( > "collections", "unknownProperty", [ name ]); > throw new Error(message); > } > else > { > return getItemAt(index); //will do the range checks > } > } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira