<commit_before>package com.dogeops.cantilever.truss;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException; 

import org.apache.log4j.Logger;

import com.dogeops.cantilever.utils.ConfigurationSingleton;

public class POSTPayloadCacheBuilder {
	private static final Logger logger = Logger.getLogger(POSTPayloadCacheBuilder.class
			.getName());

	public POSTPayloadCacheBuilder() {
		File pattern_file = new File(ConfigurationSingleton.instance
				.getConfigItem("truss.post.patterns"));
		
		if (pattern_file.exists())
		{
			logger.debug("Inspecing Pattern File: " + pattern_file);
			BufferedReader br;
			try {
				br = new BufferedReader(new FileReader(
						pattern_file.getAbsolutePath()));
				String line = null;
				while ((line = br.readLine()) != null) {
					
					try {
						String line2 = null;
						BufferedReader truth_reader = new BufferedReader(new FileReader(
								line.split(":")[1]));
						logger.debug("Processing for Request: " + line.split(":")[0] + " - File: " + line.split(":")[1]);
						while ((line2 = truth_reader.readLine()) != null) {
							POSTPayloadCache.instance.addToCache(line.split(":")[0], line2);
							logger.debug("Adding Key: " + line.split(":")[0] + ", Value: " + line2 + ", to POST cache.");
						}
						truth_reader.close();
					} catch (FileNotFoundException e){
						logger.error(e.getMessage());
					}
				}
				br.close();
			} catch (FileNotFoundException e) {
				logger.error(e.getMessage());
			} catch (IOException e) {
				logger.error(e.getMessage());
			}
		}
		else {
			logger.error("Value truss.post.patterns was empty, so I didn't process POST data. Your results may vary.");
		}<commit_msg>Parameterizing the config singleton reference key<commit_after>package com.dogeops.cantilever.truss;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException; 

import org.apache.log4j.Logger;

import com.dogeops.cantilever.utils.ConfigurationSingleton;

public class POSTPayloadCacheBuilder {
	private static final Logger logger = Logger.getLogger(POSTPayloadCacheBuilder.class
			.getName());
	private final String post_payload_config_key = "truss.post.patterns";

	public POSTPayloadCacheBuilder() {
		File pattern_file = new File(ConfigurationSingleton.instance
				.getConfigItem(post_payload_config_key));
		
		if (pattern_file.exists())
		{
			logger.debug("Inspecting Pattern File: " + pattern_file);
			BufferedReader br;
			try {
				br = new BufferedReader(new FileReader(
						pattern_file.getAbsolutePath()));
				String line = null;
				while ((line = br.readLine()) != null) {
					
					try {
						String line2 = null;
						BufferedReader truth_reader = new BufferedReader(new FileReader(
								line.split(":")[1]));
						logger.debug("Processing for Request: " + line.split(":")[0] + " - File: " + line.split(":")[1]);
						while ((line2 = truth_reader.readLine()) != null) {
							POSTPayloadCache.instance.addToCache(line.split(":")[0], line2);
							logger.debug("Adding Key: " + line.split(":")[0] + ", Value: " + line2 + ", to POST cache.");
						}
						truth_reader.close();
					} catch (FileNotFoundException e){
						logger.error(e.getMessage());
					}
				}
				br.close();
			} catch (FileNotFoundException e) {
				logger.error(e.getMessage());
			} catch (IOException e) {
				logger.error(e.getMessage());
			}
		}
		else {
			logger.error("Value " + post_payload_config_key + " was empty, so I didn't process POST data. Your results may vary.");
		}
{'fraction_non_alphanumeric': 0.1400329489291598, 'fraction_numerical': 0.0054914881933003845, 'mean_word_length': 3.652618135376756, 'pattern_counts': {'":': 10, '<': 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': '7393281', 'n_tokens_mistral': 1386, 'n_tokens_neox': 1121, 'n_words': 236}