<commit_before>package com.orctom.laputa.translator;

import com.orctom.laputa.exception.IllegalConfigException;
import com.orctom.laputa.service.exception.TemplateProcessingException;
import com.orctom.laputa.service.model.RequestWrapper;
import com.orctom.laputa.service.model.ResponseWrapper;
import com.orctom.laputa.service.translator.content.TemplateContentTranslator;
import de.neuland.jade4j.Jade4J;
import de.neuland.jade4j.model.JadeModel;
import de.neuland.jade4j.template.JadeTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.Map;
import java.util.concurrent.ExecutionException;

public class JadeContentTranslator extends TemplateContentTranslator<JadeTemplate> {

  private static final Logger LOGGER = LoggerFactory.getLogger(JadeContentTranslator.class);

  private static final String TEMPLATE_SUFFIX = ".jade";

  @Override
  public byte[] translate(RequestWrapper requestWrapper, ResponseWrapper responseWrapper) throws IOException {
    try {
      JadeTemplate template = getTemplate(responseWrapper.getTemplate());
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      Writer writer = new BufferedWriter(new OutputStreamWriter(out));
      Map<String, Object> model = getModel(responseWrapper);
      template.process(new JadeModel(model), writer);
      return out.toByteArray();
    } catch (ExecutionException e) {
      throw new TemplateProcessingException(e.getMessage(), e);
    }
  }
<commit_msg>Refactored translator for logging url for empty template exception<commit_after>package com.orctom.laputa.translator;

import com.orctom.laputa.exception.IllegalConfigException;
import com.orctom.laputa.service.exception.TemplateProcessingException;
import com.orctom.laputa.service.model.RequestWrapper;
import com.orctom.laputa.service.model.ResponseWrapper;
import com.orctom.laputa.service.translator.content.TemplateContentTranslator;
import de.neuland.jade4j.Jade4J;
import de.neuland.jade4j.model.JadeModel;
import de.neuland.jade4j.template.JadeTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.Map;
import java.util.concurrent.ExecutionException;

public class JadeContentTranslator extends TemplateContentTranslator<JadeTemplate> {

  private static final Logger LOGGER = LoggerFactory.getLogger(JadeContentTranslator.class);

  private static final String TEMPLATE_SUFFIX = ".jade";

  @Override
  public byte[] translate(RequestWrapper requestWrapper, ResponseWrapper responseWrapper) throws IOException {
    try {
      JadeTemplate template = getTemplate(requestWrapper, responseWrapper);
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      Writer writer = new BufferedWriter(new OutputStreamWriter(out));
      Map<String, Object> model = getModel(responseWrapper);
      template.process(new JadeModel(model), writer);
      return out.toByteArray();
    } catch (ExecutionException e) {
      throw new TemplateProcessingException(e.getMessage(), e);
    }
  }

{'fraction_non_alphanumeric': 0.0892372625866747, 'fraction_numerical': 0.0036177268616219473, 'mean_word_length': 5.813141683778234, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3407606', 'n_tokens_mistral': 962, 'n_tokens_neox': 956, 'n_words': 191}