<commit_before>package com.ibm.sk.ff.gui.client;

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class Client {
	
	private final String URL;
	
	public Client() {
		URL = "http://" + Config.HOSTNAME + ":" + Config.PORT + "/";
	}
	
	public boolean postMessage(String url, String message) {
		boolean ret = true;
		
		try {
			CloseableHttpClient client = HttpClients.createDefault();
		    HttpPost httpPost = new HttpPost(URL + url);
		 
		    StringEntity se = new StringEntity(message);
		    
		    httpPost.setEntity(se);
		    
		    CloseableHttpResponse response = client.execute(httpPost);
		    
		    if (response.getStatusLine().getStatusCode() != 200) {
		    	ret = false;
		    }
		    
		    client.close();
		} catch (Exception e) {
			e.printStackTrace();
			ret = false;
		}
		
		return ret;
	}
	
	public String getMessage(String url) {
		String responseString = "";
		
		try {
			CloseableHttpClient client = HttpClients.createDefault();
			HttpGet httpGet = new HttpGet(URL + url);
		 
		    CloseableHttpResponse response = client.execute(httpGet);
		    
		    if (response.getStatusLine().getStatusCode() != 200) {
		    	responseString = null;;
		    } else {
		    	responseString = EntityUtils.toString(response.getEntity());
		    }
		    
		    client.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	    
		return responseString;
	}
	

}<commit_msg>Autoclose GUI Client when GUI Server is not available<commit_after>package com.ibm.sk.ff.gui.client;

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class Client {
	
	private final String URL;
	
	public Client() {
		URL = "http://" + Config.HOSTNAME + ":" + Config.PORT + "/";
	}
	
	public boolean postMessage(String url, String message) {
		boolean ret = true;
		
		try {
			CloseableHttpClient client = HttpClients.createDefault();
		    HttpPost httpPost = new HttpPost(URL + url);
		 
		    StringEntity se = new StringEntity(message);
		    
		    httpPost.setEntity(se);
		    
		    CloseableHttpResponse response = client.execute(httpPost);
		    
		    if (response.getStatusLine().getStatusCode() != 200) {
		    	ret = false;
		    }
		    
		    client.close();
		} catch (Exception e) {
			e.printStackTrace();
			ret = false;
			System.exit(-1);
		}
		
		return ret;
	}
	
	public String getMessage(String url) {
		String responseString = "";
		
		try {
			CloseableHttpClient client = HttpClients.createDefault();
			HttpGet httpGet = new HttpGet(URL + url);
		 
		    CloseableHttpResponse response = client.execute(httpGet);
		    
		    if (response.getStatusLine().getStatusCode() != 200) {
		    	responseString = null;;
		    } else {
		    	responseString = EntityUtils.toString(response.getEntity());
		    }
		    
		    client.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(-1);
		}
	    
		return responseString;
	}
	

}
{'fraction_non_alphanumeric': 0.11737629459148446, 'fraction_numerical': 0.004027617951668585, 'mean_word_length': 3.001150747986191, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7657447', 'n_tokens_mistral': 1226, 'n_tokens_neox': 1027, 'n_words': 214}