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

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

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

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

class JavaJSONResourceLoader implements NamedayJSONResourceLoader {

    @Override
    public JSONObject loadJSON(NamedayLocale locale) throws JSONException {
        String namedayRaw;
        try {
            BufferedReader br = new BufferedReader(new FileReader(getPathTo(locale)));
            namedayRaw = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
            throw new JSONException(e.getMessage());
        }

        return new JSONObject(namedayRaw);
    }

    private String getPathTo(NamedayLocale locale) {
        String prefix = locale.getCountryCode();
        return String.format("src/main/res/raw/%s_namedays.json", prefix);
    }

}

@@ -151,32 +151,53 @@
 BufferedReader;%0A
+import java.io.File;%0A
 import java.io.F
@@ -661,41 +661,8 @@
 ) %7B%0A
-            e.printStackTrace();%0A
     
@@ -783,16 +783,23 @@
 private 
+static 
 String g
@@ -914,25 +914,322 @@
 at(%22
-src/main/res/raw/
+mobile%22 + File.separator +%0A                                     %22src%22 + File.separator +%0A                                     %22main%22 + File.separator +%0A                                     %22res%22 + File.separator +%0A                                     %22raw%22 + File.separator +%0A                                     %22
 %25s_n

Include mobile dir to the JavaJSONResourceLoader