You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flex.apache.org by "Alexander Mazuruk (JIRA)" <ji...@apache.org> on 2014/06/13 12:04:01 UTC

[jira] [Updated] (FLEX-34201) GridViewLayout getDataProviderItem index out of Bounds issue

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

Alexander Mazuruk updated FLEX-34201:
-------------------------------------

    Affects Version/s: Apache Flex 4.12.1
              Summary: GridViewLayout  getDataProviderItem index out of Bounds issue  (was: GridViewLayout )

> GridViewLayout  getDataProviderItem index out of Bounds issue
> -------------------------------------------------------------
>
>                 Key: FLEX-34201
>                 URL: https://issues.apache.org/jira/browse/FLEX-34201
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Spark: DataGrid
>    Affects Versions: Apache Flex 4.12.0, Apache Flex 4.12.1
>            Reporter: Alexander Mazuruk
>
> Class spark.components.gridClasses.GridViewLayout
> Original method code:
> ===========================================< cut here
>     private function getDataProviderItem(rowIndex:int):Object
>     {
>         const dataProviderView:IList = this.dataProviderView;
> 		
>         if ((dataProviderView == null) || (rowIndex >= dataProviderView.length) || (rowIndex < 0))
>             return null;
>         
>         return dataProviderView.getItemAt(rowIndex);
>     }
> ===========================================< cut here
> // This check assumes that we have "normal" dataProviderView as an IList
>         if ((dataProviderView == null) || (rowIndex >= dataProviderView.length) || (rowIndex < 0))
>             return null;
> BUT, in case our dataProviderView is SubListView, normal check is not sufficient anymore. we have to check against [startIndex and count] as well like:
>         if ((dataProviderView is SubListView) || (rowIndex >= dataProviderView.startIndex + dataProviderView.count) || (rowIndex < dataProviderView.startIndex))
>             return null;
> Include the case when count is equals to -1.
> Better to do it inside SubListView.getItemAt() method, to avoid code duplication and checks all around SubListView usage spots.
> By ignoring this we are getting kind of this traces at runtime:
> RangeError: Index '11' specified is out of bounds.
> 	at mx.collections::ListCollectionView/getItemAt()[/Users/justinmclean/Documents/ApacheFlex4.12.0/frameworks/projects/framework/src/mx/collections/ListCollectionView.as:512]
> 	at spark.collections::SubListView/getItemAt()[/Users/justinmclean/Documents/ApacheFlex4.12.0/frameworks/projects/spark/src/spark/collections/SubListView.as:358]
> 	at spark.components.gridClasses::GridViewLayout/getDataProviderItem()[/Users/justinmclean/Documents/ApacheFlex4.12.0/frameworks/projects/spark/src/spark/components/gridClasses/GridViewLayout.as:1184]
> 	at spark.components.gridClasses::GridViewLayout/layoutItemRenderers()[/Users/justinmclean/Documents/ApacheFlex4.12.0/frameworks/projects/spark/src/spark/components/gridClasses/GridViewLayout.as:1564]
> 	at spark.components.gridClasses::GridViewLayout/updateDisplayList()[/Users/justinmclean/Documents/ApacheFlex4.12.0/frameworks/projects/spark/src/spark/components/gridClasses/GridViewLayout.as:965]
> 	at spark.components.supportClasses::GroupBase/updateDisplayList()[/Users/justinmclean/Documents/ApacheFlex4.12.0/frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as:1302]
> 	at spark.components::Group/updateDisplayList()[/Users/justinmclean/Documents/ApacheFlex4.12.0/frameworks/projects/spark/src/spark/components/Group.as:1179]
> 	at mx.core::UIComponent/validateDisplayList()[/Users/justinmclean/Documents/ApacheFlex4.12.0/frameworks/projects/framework/src/mx/core/UIComponent.as:9531]
> 	at spark.components::Group/validateDisplayList()[/Users/justinmclean/Documents/ApacheFlex4.12.0/frameworks/projects/spark/src/spark/components/Group.as:1101]
> 	at mx.managers::LayoutManager/validateDisplayList()[/Users/justinmclean/Documents/ApacheFlex4.12.0/frameworks/projects/framework/src/mx/managers/LayoutManager.as:744]
> 	at mx.managers::LayoutManager/doPhasedInstantiation()[/Users/justinmclean/Documents/ApacheFlex4.12.0/frameworks/projects/framework/src/mx/managers/LayoutManager.as:827]
> 	at mx.managers::LayoutManager/doPhasedInstantiationCallback()[/Users/justinmclean/Documents/ApacheFlex4.12.0/frameworks/projects/framework/src/mx/managers/LayoutManager.as:1188]



--
This message was sent by Atlassian JIRA
(v6.2#6252)