package mil.nga.giat.mage.sdk.http.resource;

import android.content.Context;

import com.squareup.okhttp.ResponseBody;

import mil.nga.giat.mage.sdk.http.HttpClientManager;
import retrofit.Call;
import retrofit.Callback;
import retrofit.Retrofit;
import retrofit.http.GET;

/***
 * RESTful communication for the API
 *
 * @author newmanw
 */

public class ApiResource {

    public interface ApiService {

        @GET("/api")
        Call<ResponseBody> getApi();
    }

    private static final String LOG_NAME = ApiResource.class.getName();

    private Context context;

    public ApiResource(Context context) {
        this.context = context;
    }

    public void getApi(String url, Callback<ResponseBody> callback) {
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(url)
                .client(HttpClientManager.getInstance(context).httpClient())
                .build();

        ApiService service = retrofit.create(ApiService.class);
        service.getApi().enqueue(callback);
    }
}
@@ -715,24 +715,42 @@
 callback) %7B%0A
+        try %7B%0A    
         Retr
@@ -804,16 +804,20 @@
         
+    
 .baseUrl
@@ -838,16 +838,20 @@
         
+   
+ 
 .client(
@@ -919,16 +919,20 @@
         
+    
 .build()
@@ -942,16 +942,20 @@
         
+   
+ 
 ApiServi
@@ -1010,16 +1010,20 @@
         
+    
 service.
@@ -1050,15 +1050,107 @@
 lback);%0A
+        %7D catch (IllegalArgumentException e) %7B%0A            callback.onFailure(e);%0A        %7D%0A
     %7D%0A%7D

Fix crash on invalid URL