<commit_before>package play.utils.crud;

import java.lang.reflect.Method;

import org.springframework.util.ReflectionUtils;

import play.Logger;
import play.Logger.ALogger;
import play.twirl.api.Html;
import play.twirl.api.Content;
import play.mvc.Controller;
import play.mvc.Result;

public class TemplateController extends Controller {

	protected final ALogger log = Logger.of(getClass());
	
	private ClassLoader classLoader;
	protected String templatePackageName = "views.html."; //derived classes can change this. MUST end in "."

	public TemplateController(ClassLoader classLoader) {
		this.classLoader = classLoader;
	}

	public TemplateController() {
	}

	protected Result ok(String template, Parameters params) {
		return ok(render(template, params));
	}

	protected Result badRequest(String template, Parameters params) {
		return badRequest(render(template, params));
	}
	
	protected Content render(String template, Parameters params) {
		Content content;
		try {
			content = call(templatePackageName + template, "render", params);
		} catch (ClassNotFoundException | MethodNotFoundException e) {
			if (log.isDebugEnabled())
				log.debug("template not found : '" + template + "'");
			return templateNotFound(template, params);<commit_msg>Update TemplateController.java<commit_after>package play.utils.crud;

import java.lang.reflect.Method;

import org.springframework.util.ReflectionUtils;

import play.Logger;
import play.Logger.ALogger;
import play.twirl.api.Html;
import play.twirl.api.Content;
import play.mvc.Controller;
import play.mvc.Result;

public class TemplateController extends Controller {

	protected final ALogger log = Logger.of(getClass());
	
	private ClassLoader classLoader;
	protected String templatePackageName = "views.html."; //derived classes can change this by reassigning it in a constructor. MUST end in "."

	public TemplateController(ClassLoader classLoader) {
		this.classLoader = classLoader;
	}

	public TemplateController() {
	}

	protected Result ok(String template, Parameters params) {
		return ok(render(template, params));
	}

	protected Result badRequest(String template, Parameters params) {
		return badRequest(render(template, params));
	}
	
	protected Content render(String template, Parameters params) {
		Content content;
		try {
			content = call(templatePackageName + template, "render", params);
		} catch (ClassNotFoundException | MethodNotFoundException e) {
			if (log.isDebugEnabled())
				log.debug("template not found : '" + template + "'");
			return templateNotFound(template, params);
{'fraction_non_alphanumeric': 0.10125097732603597, 'fraction_numerical': 0.0, 'mean_word_length': 5.256723716381418, 'pattern_counts': {'":': 0, '<': 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': '6076802', 'n_tokens_mistral': 731, 'n_tokens_neox': 680, 'n_words': 196}