<commit_before>package com.flytxt.tp.processor;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import com.flytxt.tp.processor.FolderEventListener.Watch;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;


@ConfigurationProperties(prefix = "compiler")
@Data
@Slf4j
public class ProxyScripts {

	public String getScript;

	public String getJar;

	public String remoteHost;

	public String hostName;

	private List<LineProcessor> lps = new ArrayList<>();

	private List<com.flytxt.tp.processor.FolderEventListener.Watch> folderWatch;

	@Autowired
	private JobRepo repo;

	public List<LineProcessor> getLPInstance() {
		return lps;
	}

	static class DbClassLoader extends ClassLoader {

		@SuppressWarnings("unchecked")
		Class<LineProcessor> getClass(byte[] d, String name) {
			return (Class<LineProcessor>) defineClass(name, d, 0, d.length);
		}
	}

	@PostConstruct
	public void init() throws Exception {
		DbClassLoader loader = new DbClassLoader();
		String hostName = getHostname();
		log.debug("who am i ? :" + hostName);
		List<Job> jobs = repo.findByhostNameAndActiveTrueAndStatusTrue(hostName);

		folderWatch = new ArrayList<>(jobs.size());
		for (Job aJob : jobs) {
			lps.add(loader.getClass(aJob.getByteCode(), aJob.getName()).newInstance());
			String destination = "/tmp/" + aJob.getName() + "/" + aJob.getInputPath();
			com.flytxt.tp.processor.FolderEventListener.Watch w = new Watch(aJob.getInputPath(), aJob.getRegex(),
					destination);<commit_msg>added null check to getHostName<commit_after>package com.flytxt.tp.processor;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import com.flytxt.tp.processor.FolderEventListener.Watch;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;


@ConfigurationProperties(prefix = "compiler")
@Data
@Slf4j
public class ProxyScripts {

	public String getScript;

	public String getJar;

	public String remoteHost;

	public String hostName;

	private List<LineProcessor> lps = new ArrayList<>();

	private List<com.flytxt.tp.processor.FolderEventListener.Watch> folderWatch;

	@Autowired
	private JobRepo repo;
	private final Logger appLog = LoggerFactory.getLogger("applicationLog");
	
	public List<LineProcessor> getLPInstance() {
		return lps;
	}

	static class DbClassLoader extends ClassLoader {

		@SuppressWarnings("unchecked")
		Class<LineProcessor> getClass(byte[] d, String name) {
			return (Class<LineProcessor>) defineClass(name, d, 0, d.length);
		}
	}

	@PostConstruct
	public void init() throws Exception {
		DbClassLoader loader = new DbClassLoader();
		String hostName = getHostname();
		log.debug("who am i ? :" + hostName);
		if(hostName == null || hostName.trim().length() == 0){
			appLog.error("getHostName returned null, This reader will not function");
			throw new RuntimeException("getHostName returned null, This reader will not function");
		}
		List<Job> jobs = repo.findByhostNameAndActiveTrueAndStatusTrue(hostName);

		folderWatch = new ArrayList<>(jobs.size());
		for (Job aJob : jobs) {
			lps.add(loader.getClass(aJob.getByteCode(), aJob.getName()).newInstance());
			String destination = "/tmp/" + aJob.getName() + "/" + aJob.getInputPath();
			com.flytxt.tp.processor.FolderEventListener.Watch w = new Watch(aJob.getInputPath(), aJob.getRegex(),
					destination);
{'fraction_non_alphanumeric': 0.11473835813730197, 'fraction_numerical': 0.0031204992798847817, 'mean_word_length': 5.624801271860095, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '4332833', 'n_tokens_mistral': 1308, 'n_tokens_neox': 1237, 'n_words': 276}