<commit_before>package org.openlmis.fulfillment.web.util;

import net.sf.jasperreports.engine.JRParameter;

import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

import java.io.IOException;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;

public class ReportUtils {

  private static final String REPORTS_RESOURCE = "reports";

  private static final String IMAGES_RESOURCE = "images";

  /**
   * Set parameters of rendered pdf report.
   */
  public static Map<String, Object> createParametersMap() throws IOException {
    Map<String, Object> params = new HashMap<>();
    params.put("format", "pdf");

    Locale currentLocale = LocaleContextHolder.getLocale();
    params.put(JRParameter.REPORT_LOCALE, currentLocale);
    ResourceBundle resourceBundle = ResourceBundle.getBundle("messages", currentLocale);
    params.put(JRParameter.REPORT_RESOURCE_BUNDLE, resourceBundle);

    Resource reportResource = new ClassPathResource(REPORTS_RESOURCE);
    Resource imgResource = new ClassPathResource(IMAGES_RESOURCE);
    String separator = System.getProperty("file.separator");
    params.put("subreport_dir", reportResource.getFile().getAbsolutePath() + separator);
    params.put("image_dir", imgResource.getFile().getAbsolutePath() + separator);
    return params;
  }
}
<commit_msg>Added private constructor to ReportUtils<commit_after>package org.openlmis.fulfillment.web.util;

import net.sf.jasperreports.engine.JRParameter;

import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

import java.io.IOException;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;

public final class ReportUtils {

  private static final String REPORTS_RESOURCE = "reports";

  private static final String IMAGES_RESOURCE = "images";

  private ReportUtils() {
    throw new UnsupportedOperationException();
  }

  /**
   * Set parameters of rendered pdf report.
   */
  public static Map<String, Object> createParametersMap() throws IOException {
    Map<String, Object> params = new HashMap<>();
    params.put("format", "pdf");

    Locale currentLocale = LocaleContextHolder.getLocale();
    params.put(JRParameter.REPORT_LOCALE, currentLocale);
    ResourceBundle resourceBundle = ResourceBundle.getBundle("messages", currentLocale);
    params.put(JRParameter.REPORT_RESOURCE_BUNDLE, resourceBundle);

    Resource reportResource = new ClassPathResource(REPORTS_RESOURCE);
    Resource imgResource = new ClassPathResource(IMAGES_RESOURCE);
    String separator = System.getProperty("file.separator");
    params.put("subreport_dir", reportResource.getFile().getAbsolutePath() + separator);
    params.put("image_dir", imgResource.getFile().getAbsolutePath() + separator);
    return params;
  }
}

{'fraction_non_alphanumeric': 0.10500165617754223, 'fraction_numerical': 0.001324942033786022, 'mean_word_length': 5.452991452991453, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4441107', 'n_tokens_mistral': 853, 'n_tokens_neox': 825, 'n_words': 180}