Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#9332 closed defect (fixed)

ItemFileReadStore: deserialize fails when _value = 0

Reported by: drcoelho Owned by: Jared Jurkiewicz
Priority: blocker Milestone: 1.4
Component: Data Version: 1.3.1
Keywords: Cc:
Blocked By: Blocking:

Description

If a value _value is set to 0, the deserialize function is not called properly, and an invalid deserialized value is returned. In a grid, instead of getting a deserialized value, one would get '[object Object]' displayed.

dojo/data/ItemFileReadStore.js has the following test:

if (value._type && value._value) { ...

which should be changed to:

if (value._type !== null && value._value !== null) { ...

to avoid bypass of deserialize call when _value=0. Diff of changes required to fix this bug are included in attachment.

Attachments (3)

ItemFileReadStore.diff (112 bytes) - added by drcoelho 11 years ago.
diff for ItemFileReadStore?.js showing patch to fix bug
customTypes_IFS.patch (10.2 KB) - added by Jared Jurkiewicz 11 years ago.
customTypes_AndOr.patch (8.7 KB) - added by Jared Jurkiewicz 11 years ago.

Download all attachments as: .zip

Change History (12)

Changed 11 years ago by drcoelho

Attachment: ItemFileReadStore.diff added

diff for ItemFileReadStore?.js showing patch to fix bug

comment:1 Changed 11 years ago by Jared Jurkiewicz

Actually, the checks should be !=, so that both null and undefined are caught.

comment:2 Changed 11 years ago by Jared Jurkiewicz

Actually, there's a better check, such as (if ((_type in value) && (_value in value)), which makes sure they're defined and can have any value. Need to experiment with these and pick one.

comment:3 Changed 11 years ago by Jared Jurkiewicz

Added a patch that lets _value be anything from explicit undefined, null, 0, false, "", etc, without causing a problem with it deserializing. Added in UT for it as well.

Changed 11 years ago by Jared Jurkiewicz

Attachment: customTypes_IFS.patch added

comment:4 Changed 11 years ago by Jared Jurkiewicz

(In [17606]) Adding in better custom type deserialization + UT. \!strict (Also added in UT for #9322) refs #9332

comment:5 Changed 11 years ago by Jared Jurkiewicz

(In [17607]) Adding in better custom type deserialization + UT. Forgot a debug console. Removed \!strict refs #9332

Changed 11 years ago by Jared Jurkiewicz

Attachment: customTypes_AndOr.patch added

comment:6 Changed 11 years ago by Jared Jurkiewicz

(In [17608]) Adding in better custom type deserialization + UT. \!strict refs #9332

comment:7 Changed 11 years ago by Jared Jurkiewicz

Tested on:

FF3

IE7

Safari 3.2.3

Opera 9.62

comment:8 Changed 11 years ago by Jared Jurkiewicz

Milestone: tbd1.4
Resolution: fixed
Status: newclosed

comment:9 Changed 11 years ago by Jared Jurkiewicz

Note you will also want fixes from: #9322

Note: See TracTickets for help on using tickets.