flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Justin Mclean (JIRA)" <j...@apache.org>
Subject [jira] [Reopened] (FLEX-24296) ListCollectionView should throw a RangeError instead of Error when accessed with negative index via squared brackets
Date Mon, 11 Nov 2013 21:19:18 GMT

     [ https://issues.apache.org/jira/browse/FLEX-24296?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Justin Mclean reopened FLEX-24296:
----------------------------------

      Assignee: Justin Mclean

> 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
>            Assignee: Justin Mclean
>              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 was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message