diff --git a/oxygine/SDL/android/lib/src/org/oxygine/lib/HttpRequests.java b/oxygine/SDL/android/lib/src/org/oxygine/lib/HttpRequests.java index 0576d66aa..7f1daff91 100644 --- a/oxygine/SDL/android/lib/src/org/oxygine/lib/HttpRequests.java +++ b/oxygine/SDL/android/lib/src/org/oxygine/lib/HttpRequests.java @@ -14,7 +14,7 @@ import java.net.InetSocketAddress; import java.net.Proxy; import java.net.URL; - +import java.util.concurrent.RejectedExecutionException; /** * Created by Denis on 31.12.2014. */ @@ -37,11 +37,12 @@ public HttpRequestHolder() { @TargetApi(Build.VERSION_CODES.HONEYCOMB) // API 11 - public static void executeAsyncTask(AsyncTask asyncTask, T... params) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) - asyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params); - else - asyncTask.execute(params); + public static void executeAsyncTask(AsyncTask asyncTask, T... params) throws RejectedExecutionException { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + asyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params); + } else { + asyncTask.execute(params); + } } @@ -50,8 +51,11 @@ public void run(final RequestDetails details) { @Override public void run() { HttpRequest task = new HttpRequest(); - //task.execute(details); - executeAsyncTask(task, details); + try { + executeAsyncTask(task, details); + }catch(RejectedExecutionException ree) { + HttpRequest.nativeHttpRequestError(details.handle); + } } }); } @@ -145,7 +149,7 @@ protected String doInBackground(RequestDetails... details_) { } catch (Exception e) { Log.v("HttpRequest", "error: " + e.toString()); - nativeHttpRequestError(details.handle); + nativeHttpRequestError(details.handle); return e.toString(); } finally { try { @@ -205,4 +209,4 @@ static public HttpRequestHolder createRequest(String url, String[] headerKeys, S return downloadTask; } -} \ No newline at end of file +}