I'm using async tasks to get info from an api server and update the UI. However I get an error at this line of the code:
public Drawable[] getSummonerSpells(int game) throws JSONException, IOException {
    Drawable drawable[] = new Drawable[] {null, null};
    Bitmap bd = null;
    int spell1 = 0, spell2 = 0;
    if(jsonSummonerRecentGames!=null){
        JSONArray array = jsonSummonerRecentGames.getJSONArray("games");
        if((game) <= array.length()) {
            JSONObject object = array.getJSONObject(game - 1);
            if(object.has("spell1")) {
                spell1 = object.getInt("spell1");
            }
            if(object.has("spell2")){
                spell2 = object.getInt("spell2");
            }
        }
    }
    StringBuilder url = new StringBuilder("https://global.api.pvp.net/api/lol/static-data/" + region + "/v1.2/summoner-spell/" + spell1 + "?api_key=9ed10e48-7ac1-422e-b3d0-fd75dedcc3b2");
    HttpGet get = new HttpGet(url.toString());
    HttpResponse r = httpClient.execute(get); *********ERROR HERE*********
    HttpEntity e = r.getEntity();
    String data = EntityUtils.toString(e);
    JSONObject jsonObject = new JSONObject(data);
    String key = jsonObject.getString("key");
    try        {
        URL url2 = new URL("http://ddragon.leagueoflegends.com/cdn/5.2.1/img/spell/" + key + ".png");
        InputStream is = new BufferedInputStream(url2.openStream());
        bd = BitmapFactory.decodeStream(is);
    } catch(Exception e2){}
    if(bd != null){
        drawable[0] = new BitmapDrawable(bd);
    }
    url = new StringBuilder("https://global.api.pvp.net/api/lol/static-data/" + region + "/v1.2/summoner-spell/" + spell2 + "?api_key=9ed10e48-7ac1-422e-b3d0-fd75dedcc3b2");
    get = new HttpGet(url.toString());
    r = httpClient.execute(get);
    e = r.getEntity();
    data = EntityUtils.toString(e);
    jsonObject = new JSONObject(data);
    key = jsonObject.getString("key");
    try        {
        URL url2 = new URL("http://ddragon.leagueoflegends.com/cdn/5.2.1/img/spell/" + key + ".png");
        InputStream is = new BufferedInputStream(url2.openStream());
        bd = BitmapFactory.decodeStream(is);
    } catch(Exception e2){}
    if(bd != null){
        drawable[1] = new BitmapDrawable(bd);
    }
    return drawable;
}
When I debug it, the URL that is put in is this :
and this website gives an JSON response back.
I call this method in my doInBackground() method for the async task here:
        Drawable[] summonerSpell = null;
        try {
            summonerSpell = data.getSummonerSpells(2);
        } catch (JSONException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
And the async task is called from my first async task here:
    protected void onPostExecute(Long aLong) {
        super.onPostExecute(aLong);
        new BackgroundStuffGameOne().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, dataClass);
        new BackgroundStuffGameTwo().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, dataClass);
    }
Any ideas as to why this error is called? Thanks :)
 
     
    