Getting ArrayList from Custom Code

0 votes


I have created a custom coded jar. It has an array which contains some of messages from buddies of a user. I deployed it, on tests everyting went fine.

I got response and traced well. But when I want to get response as array, there is a problem.

On server side; 

ArrayList<Buddy> buddies = getMessagesOfUser(messageIds);
JSONObject jsonResponse = new JSONObject();
On client side; ( I am using AS3 API)
var array:Array = new BuddyResponseBuilder().buildArrayResponse(response.buddies);
I got error :
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.shephertz.app42.paas.sdk.as3::App42ResponseBuilder/getServiceJSONObject()[E:\Samita_work\gitProject_API\App42_Flash_API_Desktop\App42_ActionScript_API\src\com\shephertz\app42\paas\sdk\as3\]
at com.shephertz.app42.paas.sdk.as3.buddy::BuddyResponseBuilder/buildArrayResponse()[E:\Samita_work\gitProject_API\App42_Flash_API_Desktop\App42_ActionScript_API\src\com\shephertz\app42\paas\sdk\as3\buddy\]

How can I solve that?



asked Sep 13, 2014 in App42 Cloud API-BaaS by Tufan (64 points)
recategorized Mar 3, 2015 by sushil
Can you just parse only for first element and check if it works? Something like this.

var array:Array = new BuddyResponseBuilder().buildArrayResponse(response.buddies[0]);
nope. I received  property 0 not found on String error.

1 Answer

0 votes


On the server side, when you are putting the value in json object update the code snippet with below code: 
ArrayList<Buddy> buddies = getMessagesOfUser(messageIds);
JSONObject jsonResponse = new JSONObject();
And fetch it back in your app using the below code snippet:
var buddyMessageArray:Array = new BuddyResponseBuilder().buildArrayResponse(jsonResponse["buddies"]);
let us know if it helps.
HImanshu Sharma


answered Sep 16, 2014 by hs00105 (2,005 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on