package com.alexstyl.specialdates.events.namedays.calendar.resource;

import com.alexstyl.specialdates.events.namedays.NamedayLocale;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

class NamedayJSONResourceProvider {

    private final NamedayJSONResourceLoader loader;
    private final JSONArray jsonArray = new JSONArray();

    NamedayJSONResourceProvider(NamedayJSONResourceLoader loader) {
        this.loader = loader;
    }

    NamedayJSON getNamedayJSONFor(NamedayLocale locale) throws JSONException {
        JSONObject json = loader.loadJSON(locale);
        JSONArray data = json.getJSONArray("data");
        JSONArray special = getSpecialOf(json);
        return new NamedayJSON(data, special);
    }

    private JSONArray getSpecialOf(JSONObject json) throws JSONException {
        if (json.has("special")) {
            return json.getJSONArray("special");
        }
        return jsonArray;
    }

}

@@ -268,103 +268,107 @@
 ate 
-final NamedayJSONResourceLoader loader;%0A    private final JSONArray jsonArray = new JSONArray()
+static final JSONArray EMPTY = new JSONArray();%0A%0A    private final NamedayJSONResourceLoader loader
 ;%0A%0A 
@@ -943,17 +943,13 @@
 urn 
-jsonArray
+EMPTY
 ;%0A  

Mark empty object as static