Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Playlists: ClassCastException when JSONObject$Null is returned in response #3

Open
thecodeag opened this issue Feb 1, 2012 · 0 comments

Comments

@thecodeag
Copy link

This error occurs when FindPlaylistsByIds(..) is called with an id that no longer matches to any playlist (the Playlist has been deleted at Brightcove - or never existed).

In this case, JSONObject$Null is being returned within the result array and gets cast to JSONObject, which raises a ClassCastException:

public class Playlists extends ArrayList {
...

public Playlists(JSONObject jsonObj) throws JSONException {
    JSONArray jsonItems = jsonObj.getJSONArray("items");
    for(int itemIdx=0;itemIdx<jsonItems.length();itemIdx++){
                    JSONObject jsonItem = (JSONObject)jsonItems.get(itemIdx);
        Playlist playlist = new Playlist(jsonItem);
        add(playlist);
    }

    ...

}

    ...

}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants