Opened 12 years ago

Closed 12 years ago

#4691 closed defect (fixed)

ItemFileReadStore.js: issues in _getItemByIdentity and _getItemsFromLoadedData

Reported by: guest Owned by: Jared Jurkiewicz
Priority: high Milestone: 1.0
Component: Data Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description

In ItemFileReadStore?.js, method _getItemByIdentity (line# 671), the else part is "this._arrayOfAllItems[identity];". Should it not be "item=this._arrayOfAllItems[identity];"?

Also, in the JSON data if I have not specified an "identifier", the instance object _itemsByIdentity is meant to be null and this assumption is used in the if condition of _getItemByIdentity (line# 665). But in the method _getItemsFromLoadedData (line# 488), _itemsByIdentity is instantiated whether "identifier" is available or not. Should this instantiation code be moved down one line, into the if condition?

Thanks & Regards, Ganesh Ravindran

Attachments (1)

20071015-ItemFileStore.patch (11.3 KB) - added by Jared Jurkiewicz 12 years ago.
Patch for Identity support in ItemFile?*Store.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 12 years ago by Jared Jurkiewicz

Looking at the first one. There is probably something wrong there.

As for the second, ItemFileReadStore? always supports identity. If you don't specify an identity for an item, it assigns you one (basically the item current item count at the time the item is processed). So it should always initialize the array as it will always have values.

comment:2 Changed 12 years ago by Jared Jurkiewicz

Milestone: 1.0
Status: newassigned

Actually, you were correct on the second one as well. There was a problem with the logic that did auto-assigning of identities if an identifier was not declared in the data set. Easy fix, adding UT for this as well. Thank you for catching that!

comment:3 Changed 12 years ago by Jared Jurkiewicz

Well, hopefully an easy fix, anyway. Write store makes copious use that associative map. Rethinking this a bit...

comment:4 Changed 12 years ago by Jared Jurkiewicz

Requiring changes to ItemFileReadStore?, ItemFileWriteStore?. At least 3 new UT for them as well.

Changed 12 years ago by Jared Jurkiewicz

Patch for Identity support in ItemFile?*Store.

comment:5 Changed 12 years ago by Jared Jurkiewicz

Patch UT tested on:

Firefox 2.0.0.7 Firefox 1.5.0.12 Safari B3 IE 6 IE 7 Seamonkey 1.1.2 Opera 9.2

comment:6 Changed 12 years ago by Jared Jurkiewicz

Resolution: fixed
Status: assignedclosed

(In [10825]) Fix for identity problem. Fixes #4691

Note: See TracTickets for help on using tickets.