<commit_before>package ch.ice.controller.web;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import ch.ice.exceptions.HttpStatusException;

public class WebCrawler {

	Document document;
	Connection connection;

	// Get Document object after parsing the html from given url.
	public void connnect(String url) throws IOException, Exception {
	
		
			try {
				connection = Jsoup.connect(url).userAgent("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.21 (KHTML, like Gecko) Chrome/19.0.1042.0 Safari/535.21");
				document = connection.get();
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				System.out.println("lkasldkaldka");
			}
	
	}

	// Get Metatags from document object and return Map
	public Map<String, String> getMetaTags(List<String> metaDef) throws HttpStatusException{

		Map<String, String> map = new HashMap<String, String>();

		
		int statusCode =   connection.response().statusCode();
		if(statusCode == 200) {
		 
		
		for (String metaWord : metaDef) {
			try {
				String metaTags = document.select("meta[name=" + metaWord + "]").first().attr("content");
				map.put(metaWord, metaTags);
			} catch (Exception e) {
				// MetaTags not available
				//TODO Throw custom Exception -> gui handle
				map.put(metaWord, "n/a");
			}
		}
	    }
		
			else {
				  System.out.println("received error code : " + statusCode +" "+ connection.response().statusMessage());
				throw new HttpStatusException("received error code : " +statusCode +" "+ connection.response().statusMessage());
			  
			}

		return map;
	}
}<commit_msg>Minor changes in Exeptionhandling<commit_after>package ch.ice.controller.web;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import ch.ice.exceptions.HttpStatusException;

public class WebCrawler {

	Document document;
	Connection connection;

	// Get Document object after parsing the html from given url.
	public void connnect(String url) throws IOException, Exception {
	
				connection = Jsoup.connect(url).userAgent("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.21 (KHTML, like Gecko) Chrome/19.0.1042.0 Safari/535.21");
				document = connection.get();
		
	}

	// Get Metatags from document object and return Map
	public Map<String, String> getMetaTags(List<String> metaDef) throws HttpStatusException{

		Map<String, String> map = new HashMap<String, String>();

		
		int statusCode =   connection.response().statusCode();
		if(statusCode == 200) {
		 
		
		for (String metaWord : metaDef) {
			try {
				String metaTags = document.select("meta[name=" + metaWord + "]").first().attr("content");
				map.put(metaWord, metaTags);
			} catch (Exception e) {
				// MetaTags not available
				//TODO Throw custom Exception -> gui handle
				map.put(metaWord, "n/a");
			}
		}
	    }
		
			else {
				  System.out.println("Received HTTP error code : " + statusCode +" "+ connection.response().statusMessage());
				throw new HttpStatusException("Received HTTP error code : " +statusCode +" "+ connection.response().statusMessage());
			  
			}

		return map;
	}
}
{'fraction_non_alphanumeric': 0.12713643178410794, 'fraction_numerical': 0.017391304347826087, 'mean_word_length': 3.6985915492957746, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '6434468', 'n_tokens_mistral': 1205, 'n_tokens_neox': 1014, 'n_words': 259}