Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-34201

GridViewLayout getDataProviderItem index out of Bounds issue

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Apache Flex 4.12.0, Apache Flex 4.12.1
    • None
    • Spark: DataGrid
    • None

    Description

      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]

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            leybniz Alexander Mazuruk

            Dates

              Created:
              Updated:

              Slack

                Issue deployment