<commit_before>/**
 * 
 */
package com.trendrr.oss.taskprocessor;

import java.util.Date;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.trendrr.oss.executionreport.ExecutionReport;




/**
 * @author <NAME>
 * @created Sep 24, 2012
 * 
 */
class TaskFilterRunner implements Runnable {

	protected static Log log = LogFactory.getLog(TaskFilterRunner.class);

	Task task;
	
	TaskFilterRunner(Task task) {
		this.task = task;
	}
	
	@Override
	public void run() {
		Task t = task;
		if (t == null) {
			log.error("Task is null, can't run anything..");
			return;
		}
		TaskFilter f = t.popFilter();
		Exception error = null;
		while(f != null && error == null) {
			Date start = new Date();
			
			try {
				Task newT = f.doFilter(t);
				if (newT == null) {
					if (!t.asynch) {
						t.getProcessor().taskComplete(t);
					}
					return;
				}
				t = newT;
				
			} catch (Exception x) {
				log.error("Caught",x);
				error = x;
			} finally {
				ExecutionReport report = ExecutionReport.instance("TaskProcessor");
				report.inc(t.getProcessor().getName() + "." + f.getClass().getSimpleName(), start);
			}
			
			if (t.asynch) {
				return;
			}
			
			if (error == null) {
				f = t.popFilter();
			}
			
		}
		if (error != null) {
			t.getProcessor().taskError(t, error);
		} else if (!t.asynch) {
			t.getProcessor().taskComplete(t);
		}
	}
}<commit_msg>add more to execution report<commit_after>/**
 * 
 */
package com.trendrr.oss.taskprocessor;

import java.util.Date;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.trendrr.oss.executionreport.ExecutionReport;




/**
 * @author <NAME>
 * @created Sep 24, 2012
 * 
 */
class TaskFilterRunner implements Runnable {

	protected static Log log = LogFactory.getLog(TaskFilterRunner.class);

	Task task;
	
	TaskFilterRunner(Task task) {
		this.task = task;
	}
	
	@Override
	public void run() {
		Task t = task;
		if (t == null) {
			log.error("Task is null, can't run anything..");
			return;
		}
		ExecutionReport report = ExecutionReport.instance("TaskProcessor");
		TaskFilter f = t.popFilter();
		Exception error = null;
		while(f != null && error == null) {
			Date start = new Date();
			
			try {
				Task newT = f.doFilter(t);
				if (newT == null) {
					if (!t.asynch) {
						t.getProcessor().taskComplete(t);
					}
					return;
				}
				t = newT;
				
			} catch (Exception x) {
				log.error("Caught",x);
				error = x;
			} finally {
				report.inc(t.getProcessor().getName() + "." + f.getClass().getSimpleName(), start);
			}
			
			if (t.asynch) {
				return;
			}
			
			if (error == null) {
				f = t.popFilter();
			}
			
		}
		if (error != null) {
			t.getProcessor().taskError(t, error);
		} else if (!t.asynch) {
			t.getProcessor().taskComplete(t);
			report.inc(t.getProcessor().getName(), t.getSubmitted());
		}
	}
}
{'fraction_non_alphanumeric': 0.1578221915920055, 'fraction_numerical': 0.004135079255685734, 'mean_word_length': 2.77012987012987, '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': '3138069', 'n_tokens_mistral': 1242, 'n_tokens_neox': 999, 'n_words': 218}