/**
 * redpen: a text inspection tool
 * Copyright (C) 2014 Recruit Technologies Co., Ltd. and contributors
 * (see CONTRIBUTORS.md)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.bigram.docvalidator;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.bigram.docvalidator.config.Configuration;
import org.bigram.docvalidator.parser.Parser;
import org.bigram.docvalidator.parser.DocumentParserFactory;
import org.bigram.docvalidator.model.DocumentCollection;

/**
 * Generate DocumentCollection object loading input file.
 */
public final class DocumentGenerator {
  /**
   * Generate DocumentCollection from input file.
   *
   * @param inputFileNames input file name
   * @param configuration       configuration configuration
   * @param format         input file format
   * @return a generated DocumentCollection object
   */
  static DocumentCollection generate(String[] inputFileNames,
                           Configuration configuration,
                           Parser.Type format) {
    DocumentCollection.Builder documentBuilder =
        new DocumentCollection.Builder();
    Parser docparser;
    try {
      docparser = DocumentParserFactory.generate(format,
          configuration, documentBuilder);
    } catch (DocumentValidatorException e) {
      LOG.error("Failed to create documentCollection parser: " + e.getMessage());
      return null;
    }

    for (String inputFileName : inputFileNames) {
      try {
        docparser.generateDocument(inputFileName);
      } catch (DocumentValidatorException e) {
        e.printStackTrace();
        return null;
      }
    }
    // @TODO extract summary information to validate documentCollection effectively
    return documentBuilder.build();
  }

  private static final Logger LOG =
      LoggerFactory.getLogger(DocumentGenerator.class);

  private DocumentGenerator() {
    super();
  }
}

@@ -722,65 +722,8 @@
 r;%0A%0A
-import org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A
 impo
@@ -1471,16 +1471,50 @@
  format)
+ throws DocumentValidatorException
  %7B%0A    D
@@ -1614,38 +1614,8 @@
 ser 
-docparser;%0A    try %7B%0A      doc
 pars
@@ -1704,160 +1704,8 @@
 er);
-%0A    %7D catch (DocumentValidatorException e) %7B%0A      LOG.error(%22Failed to create documentCollection parser: %22 + e.getMessage());%0A      return null;%0A    %7D
 %0A%0A  
@@ -1762,25 +1762,10 @@
     
-try %7B%0A        doc
+  
 pars
@@ -1804,113 +1804,8 @@
 e);%0A
-      %7D catch (DocumentValidatorException e) %7B%0A        e.printStackTrace();%0A        return null;%0A      %7D%0A
     
@@ -1935,101 +1935,8 @@
  %7D%0A%0A
-  private static final Logger LOG =%0A      LoggerFactory.getLogger(DocumentGenerator.class);%0A%0A
   pr

Make DobumentGenerator.generate throw a exception