package cz.jiripinkas.jsitemapgenerator;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

public class HttpClientUtil {

    private HttpClientUtil() {

    }

    /**
     * HTTP GET to URL, return status
     *
     * @param url URL
     * @return status code (for example 200)
     * @throws Exception When error
     */
    public static int get(String url) throws Exception {
        OkHttpClient client = new OkHttpClient();
        Request request = new Request.Builder()
                .url(url)
                .build();
        Response response = client.newCall(request).execute();
        if (!response.isSuccessful()) {
            throw new Exception("error sending HTTP GET to this URL: " + url);
        }
        return response.code();
    }
}

@@ -563,16 +563,20 @@
         
+try(
 Response
@@ -620,26 +620,29 @@
 xecute()
-;%0A
+) %7B%0A 
         
 if (!res
@@ -633,16 +633,19 @@
         
+   
 if (!res
@@ -664,24 +664,28 @@
 essful()) %7B%0A
+    
             
@@ -759,18 +759,26 @@
         
+ 
-%7D%0A
+   %7D%0A    
         
@@ -797,20 +797,30 @@
 nse.code();%0A
+        %7D%0A
     %7D%0A%7D%0A

fix bug in closing okhttp Response