Opened 9 years ago

Closed 9 years ago

#11610 closed defect (invalid)

ItemFileReadStore gives no indication of error when json data contains duplicate index

Reported by: anton544 Owned by: Jared Jurkiewicz
Priority: low Milestone: tbd
Component: Data Version: 1.4.3
Keywords: ItemFileReadStore Duplicate Index Cc:
Blocked By: Blocking:

Description

FireFox? 3.6.8 Ubuntu 10.04

The ItemFileReadStore? store fails to give any indication of an error when the store reads from a JSON object with duplicates indexes. fetch will perform the proper query and return a list of items, however those items return fail the isItem check because the items are missing the _0 and _S attributes.

Attachments (1)

test2.html (2.8 KB) - added by anton544 9 years ago.
sample html file with 2 duplicates

Download all attachments as: .zip

Change History (3)

Changed 9 years ago by anton544

Attachment: test2.html added

sample html file with 2 duplicates

comment:1 Changed 9 years ago by Jared Jurkiewicz

It does throw an error, actually:

Lines:

Step 4: Some data files specify an optional 'identifier', which is the name of an attribute that holds the identity of each item. If this data file specified an identifier attribute, then build a hash table of items keyed by the identity of the items. var arrayOfValues;

var identifier = dataObject.identifier; if(identifier){

this._itemsByIdentity = {}; this._featuresdojo.data.api.Identity? = identifier; for(i = 0; i < this._arrayOfAllItems.length; ++i){

item = this._arrayOfAllItems[i]; arrayOfValues = item[identifier]; var identity = arrayOfValues[0]; if(!this._itemsByIdentity[identity]){

this._itemsByIdentity[identity] = item;

}else{

if(this._jsonFileUrl){

throw new Error("dojo.data.ItemFileReadStore?: The json data as specified by: + this._jsonFileUrl +? is malformed. Items within the list have identifier: + identifier +?. Value collided: + identity +?");

}else if(this._jsonData){

throw new Error("dojo.data.ItemFileReadStore?: The json data provided by the creation arguments is malformed. Items within the list have identifier: + identifier +?. Value collided: + identity +?");

}

}

}

}else{

..

Your tests are invalid because none of them actually call a fetch. The data is not processed until a fetch is made.

comment:2 Changed 9 years ago by Jared Jurkiewicz

Resolution: invalid
Status: newclosed

Closing as invalid. Please reopen with a testcase that shows a fetch call being made, with query, where it fails/does not report an error.

Note: See TracTickets for help on using tickets.