<commit_before>package com.google.enterprise.adaptor;

import com.google.common.base.Strings;

import java.io.OutputStream;
import java.lang.reflect.Constructor;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * The content transform factory holds all document content transformers
 * and puts them in series connection.
 *
 * @author <NAME> (<EMAIL>)
 */
public class ContentTransformFactory {

  private static final Logger LOG =
      Logger.getLogger(ContentTransformFactory.class.getName());

  private List<Map<String, String>> contentTransformers;

  public ContentTransformFactory(
      final List<Map<String, String>> contentTransformers) {
    this.contentTransformers = contentTransformers;
  }

  /**
   * Creates a new transformer pipeline.
   *
   * @param original    original content stream
   * @param contentType content type
   * @param metadata    metadata
   * @return stream pipeline or original output stream
   */
  public final OutputStream createPipeline(final OutputStream original,
                                           final String contentType,
                                           final Metadata metadata) {
    if (contentTransformers.size() <= 0) {
      return original;
    }
    DocumentContentTransformer contentTransformer = null;
    for (int i = contentTransformers.size(); i >= 0; i--) {
      final Map<String, String> tConfig = contentTransformers.get(i);
      final String className = tConfig.get("class");
      if (Strings.isNullOrEmpty(className)) {
        LOG.log(Level.SEVERE,
            "Document Content Transformer class is missing {0}", className);
        throw new RuntimeException(
            "Document Content Transformer class is missing " + className);
      }
      try {
        //noinspection unchecked
        final Class<DocumentContentTransformer> clazz =
            (Class<DocumentContentTransformer>) Class.forName(className);
        final Constructor<DocumentContentTransformer> constructor =
            clazz.getConstructor(Map.class,
                OutputStream.class, String.class, Metadata.class);
        if (null == contentTransformer) {
          contentTransformer =
              constructor.newInstance(tConfig, original, contentType,
                  metadata);
        } else {
          contentTransformer =
              constructor.newInstance(tConfig, contentTransformer,
                  contentType, metadata);
        }
      } catch (Exception e) {
        LOG.log(Level.SEVERE,
            "Cannot use document content transformer of type {0}", className);
        throw new RuntimeException(
            "Cannot use document content transformer of type " + className);
      }
    }
    return contentTransformer;
  }
}<commit_msg>removed logging cause of already handled exception<commit_after>package com.google.enterprise.adaptor;

import com.google.common.base.Strings;

import java.io.OutputStream;
import java.lang.reflect.Constructor;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * The content transform factory holds all document content transformers
 * and puts them in series connection.
 *
 * @author <NAME> (<EMAIL>)
 */
public class ContentTransformFactory {

  private static final Logger LOG =
      Logger.getLogger(ContentTransformFactory.class.getName());

  private List<Map<String, String>> contentTransformers;

  public ContentTransformFactory(
      final List<Map<String, String>> contentTransformers) {
    this.contentTransformers = contentTransformers;
  }

  /**
   * Creates a new transformer pipeline.
   *
   * @param original    original content stream
   * @param contentType content type
   * @param metadata    metadata
   * @return stream pipeline or original output stream
   */
  public final OutputStream createPipeline(final OutputStream original,
                                           final String contentType,
                                           final Metadata metadata) {
    if (contentTransformers.size() <= 0) {
      return original;
    }
    DocumentContentTransformer contentTransformer = null;
    for (int i = contentTransformers.size(); i >= 0; i--) {
      final Map<String, String> tConfig = contentTransformers.get(i);
      final String className = tConfig.get("class");
      if (Strings.isNullOrEmpty(className)) {
        LOG.log(Level.SEVERE,
            "Document Content Transformer class is missing {0}", className);
        throw new RuntimeException(
            "Document Content Transformer class is missing " + className);
      }
      try {
        //noinspection unchecked
        final Class<DocumentContentTransformer> clazz =
            (Class<DocumentContentTransformer>) Class.forName(className);
        final Constructor<DocumentContentTransformer> constructor =
            clazz.getConstructor(Map.class,
                OutputStream.class, String.class, Metadata.class);
        if (null == contentTransformer) {
          contentTransformer =
              constructor.newInstance(tConfig, original, contentType,
                  metadata);
        } else {
          contentTransformer =
              constructor.newInstance(tConfig, contentTransformer,
                  contentType, metadata);
        }
      } catch (Exception e) {
        throw new RuntimeException(
            "Cannot use document content transformer of type " + className);
      }
    }
    return contentTransformer;
  }
}
{'fraction_non_alphanumeric': 0.08489545782263878, 'fraction_numerical': 0.0012617159336697908, 'mean_word_length': 2.648257725180802, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3749436', 'n_tokens_mistral': 1353, 'n_tokens_neox': 1325, 'n_words': 381}