<commit_before>package com.profiler.data.read;

import org.apache.log4j.Logger;
import org.apache.thrift.TBase;

import com.profiler.data.manager.RequestTransactionDataManager;
import com.profiler.dto.RequestDataListThriftDTO;

import java.net.DatagramPacket;

public class ReadRequestData implements ReadHandler {
	private static final Logger logger = Logger.getLogger("RequestInfo");

    long receiveTime=0;

    public ReadRequestData() {
	}

	public ReadRequestData(long receiveTime) {
		this.receiveTime=receiveTime;
	}

	public void handler(TBase<?, ?> tbase, DatagramPacket datagramPacket) {
        RequestDataListThriftDTO dto = (RequestDataListThriftDTO) tbase;
		try {
			RequestTransactionDataManager manager=new RequestTransactionDataManager();
			
			//For Debug start
			int hostHashCode=dto.getHostHashCode();
			CharSequence agentName=manager.getAgentName(hostHashCode);
			int requestHashCode=dto.getRequestHashCode();
			String url=manager.getRequestURL(requestHashCode);
			StringBuilder message=RequestDataPrinter.printRequestData(dto, agentName, url,"\n");
			logger.debug(message);
			//For Debug end

			// TODO packet을 slice해서 넣어야 될거 같음
			manager.addRequestDataList(dto, datagramPacket.getData());
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}


}<commit_msg>[강운덕] [LUCYSUS-1744] udp socket data receiver의 받은 패킷을 slice하게 변경.<commit_after>package com.profiler.data.read;

import org.apache.log4j.Logger;
import org.apache.thrift.TBase;

import com.profiler.data.manager.RequestTransactionDataManager;
import com.profiler.dto.RequestDataListThriftDTO;

import java.lang.reflect.Array;
import java.net.DatagramPacket;
import java.util.Arrays;

public class ReadRequestData implements ReadHandler {
	private static final Logger logger = Logger.getLogger("RequestInfo");

    long receiveTime=0;

    public ReadRequestData() {
	}

	public ReadRequestData(long receiveTime) {
		this.receiveTime=receiveTime;
	}

	public void handler(TBase<?, ?> tbase, DatagramPacket datagramPacket) {
        if (logger.isDebugEnabled()) {
            logger.debug("handle " + tbase);
        }
        RequestDataListThriftDTO dto = (RequestDataListThriftDTO) tbase;
		try {
			RequestTransactionDataManager manager=new RequestTransactionDataManager();
			
			//For Debug start
			int hostHashCode=dto.getHostHashCode();
			CharSequence agentName=manager.getAgentName(hostHashCode);
			int requestHashCode=dto.getRequestHashCode();
			String url=manager.getRequestURL(requestHashCode);
			StringBuilder message=RequestDataPrinter.printRequestData(dto, agentName, url,"\n");
			logger.debug(message);
			//For Debug end

			// TODO packet을 slice해서 넣어야 될거 같음
            manager.addRequestDataList(dto, Arrays.copyOf(datagramPacket.getData(), datagramPacket.getLength()));
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}


}
{'fraction_non_alphanumeric': 0.10010500525026252, 'fraction_numerical': 0.00280014000700035, 'mean_word_length': 4.773737373737374, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5041682', 'n_tokens_mistral': 961, 'n_tokens_neox': 908, 'n_words': 170}