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

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

Open
@ghost

Description

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);
    }

    ...

}

    ...

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions