APAR status
Closed as program error.
Error description
Calling load either via collection.load() or via WL.JSONStore.initCollection with {load: true}, will fail if the value returned from the adapter that is linked to the JSONStore collection is an Object instead of an Array.
Local fix
1) Wrap the data you are returning in an Array. 2) Instead of using the load: true option, you can check the db count and, if it's 0, invoke the adapter and pass the data to the store() function to add it to JSONStore. store() will correctly handle a JS Object.
Problem summary
**************************************************************** * USERS AFFECTED: IBM Worklight and Mobile Foundation 5.0 * * developers who build applications which * * use * * JSONStore with adapters linked to their * * JSONStore collection that return Objects * * instead of Arrays. * **************************************************************** * PROBLEM DESCRIPTION: The native implementation of * * JSONStore always expects an array to * * be passed to the store function, this * * however is not enforced in the load * * method from the JavaScript layer. * **************************************************************** * RECOMMENDATION: * **************************************************************** If the problem is occurring, an error such as "Terminating app due to uncaught exception 'Invalid JSON structure', reason: 'Invalid JSON structure'" may be found in the application log.
Problem conclusion
The code was changed to wrap simple objects in an array so that the error no longer occurs. The fix for this APAR is currently targeted for inclusion in fixpack 5.0.6.0.
Temporary fix
Comments
APAR Information
APAR number
PM84949
Reported component name
WORKLIGHT CONSU
Reported component ID
5725I4301
Reported release
505
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2013-03-17
Closed date
2013-03-17
Last modified date
2013-03-17
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
WORKLIGHT CONSU
Fixed component ID
5725I4301
Applicable component levels
R505 PSY
UP
[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSZH4A","label":"IBM Worklight"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"505","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]
Document Information
Modified date:
17 March 2013