3 Replies Latest reply on Nov 10, 2011 10:10 PM by philip.mair

    TypeError: Error #1009 (null object access) after manually commit of deleteItem

    philip.mair

      Hello!

       

      I'm getting a error with LCDS 3.1.0.315496

       

      I'm using a DataService to edit some entities with

       

      dataService.autoCommit = false;

       

       

      I fill a arrayCollection like:

       

       

      dataService.fill(entitiesAC); //fill with all entites
      

       

       

      If i want to update a entity i do:

       

      dataService.commit([entitiy]); //works fine
      

       

      If i want to create a entity i do:

       

      dataService.createItem(entity);
      dataService.commit([entity]); //works fine
      

       

      If i want to undo my made changes i do:

      dataService.revertChanges( entity ); //works fine
      

       

      If i want to delete a entity i do:

      dataService.deleteItem( entity );
      dataService.commit( [entity] );
      

       

      In this case the entity will be deleted, but i get this ugly flex error:

       

      TypeError: Error #1009: Cannot access a property or method of a null object reference.
          at mx.data::DataList/getItemIndex()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\DataList.as:376]
          at mx.collections::ListCollectionView/getFilteredItemIndex()[E:\dev\4.x\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:710]
          at mx.collections::ListCollectionView/addItemsToView()[E:\dev\4.x\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:1102]
          at mx.collections::ListCollectionView/listChangeHandler()[E:\dev\4.x\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:1284]
          at flash.events::EventDispatcher/dispatchEventFunction()
          at flash.events::EventDispatcher/dispatchEvent()
          at mx.data::DataList/internalDispatchCollectionEvent()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\DataList.as:2296]
          at mx.data::DataList/internalDispatchOneAddRemoveEvent()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\DataList.as:2285]
          at mx.data::DataList/http://www.adobe.com/2006/flex/mx/internal::applyUpdateCollectionRangeIndex()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\DataList.as:1920]
          at mx.data::DataList/http://www.adobe.com/2006/flex/mx/internal::applyUpdateCollection()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\DataList.as:1703]
          at mx.data::DataList/http://www.adobe.com/2006/flex/mx/internal::applyPendingUpdateCollections()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\DataList.as:1466]
          at mx.data::DataList/http://www.adobe.com/2006/flex/mx/internal::processUpdateCollection()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\DataList.as:1634]
          at mx.data::ConcreteDataService/http://www.adobe.com/2006/flex/mx/internal::processUpdateCollection()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\ConcreteDataService.as:4683]
          at mx.data::DataStore/http://www.adobe.com/2006/flex/mx/internal::commitResultHandler()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\DataStore.as:2264]
          at mx.data::CommitResponder/internalProcessResults()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\CommitResponder.as:559]
          at mx.data::CommitResponder/processResult()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\CommitResponder.as:487]
          at mx.data::CommitResponder/result()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\CommitResponder.as:228]
          at mx.rpc::AsyncRequest/acknowledge()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:84]
          at NetConnectionMessageResponder/resultHandler()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\channels\NetConnectionChannel.as:547]
          at mx.messaging::MessageResponder/result()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\MessageResponder.as:235]
      

       

      I don't get any error if i do

       

      dataService.deleteItem( entity );
      dataService.commit( ); //but this also will commit unsaved changes in other entities
      

       

      Thanks for your help