ottlinger commented on code in PR #233:
URL: https://github.com/apache/creadur-rat/pull/233#discussion_r1555619725


##########
apache-rat-core/src/main/java/org/apache/rat/analysis/DocumentHeaderAnalyser.java:
##########
@@ -18,50 +18,50 @@
  */
 package org.apache.rat.analysis;
 
+import static java.lang.String.format;
+
 import java.io.IOException;
 import java.io.Reader;
+import java.util.Collection;
 
 import org.apache.rat.api.Document;
 import org.apache.rat.document.IDocumentAnalyser;
-import org.apache.rat.document.RatDocumentAnalysisException;
 import org.apache.rat.license.ILicense;
 import org.apache.rat.utils.Log;
 
-import static java.lang.String.format;
-
 /**
  * A Document analyzer that analyses document headers for a license.
  */
 class DocumentHeaderAnalyser implements IDocumentAnalyser {
 
-    /**
-     * The license to analyse
-     */
-    private final ILicense license;
+    /** The license to analyse */
+    private final Collection<ILicense> licenses;
     /** the logger to use */
     private final Log log;
 
     /**
      * Constructs the HeaderAnalyser for the specific license.
-     * 
+     *
      * @param license The license to analyse
      */
-    public DocumentHeaderAnalyser(final Log log, final ILicense license) {
+    public DocumentHeaderAnalyser(final Log log, final Collection<ILicense> 
licenses) {
         super();
-        this.license = license;
+        this.licenses = licenses;
         this.log = log;
     }
 
     @Override
-    public void analyse(Document document) throws RatDocumentAnalysisException 
{
+    public void analyse(Document document) {
         try (Reader reader = document.reader()) {
             log.debug(format("Processing: %s", document));
-            HeaderCheckWorker worker = new HeaderCheckWorker(reader, license, 
document);
+            HeaderCheckWorker worker = new HeaderCheckWorker(reader, licenses, 
document);
             worker.read();
         } catch (IOException e) {
-            throw new RatDocumentAnalysisException("Cannot read header", e);
+            log.warn(String.format("Can not read header of %s", document));

Review Comment:
   cannot?



##########
apache-rat-core/src/main/java/org/apache/rat/analysis/DocumentHeaderAnalyser.java:
##########
@@ -18,50 +18,50 @@
  */
 package org.apache.rat.analysis;
 
+import static java.lang.String.format;
+
 import java.io.IOException;
 import java.io.Reader;
+import java.util.Collection;
 
 import org.apache.rat.api.Document;
 import org.apache.rat.document.IDocumentAnalyser;
-import org.apache.rat.document.RatDocumentAnalysisException;
 import org.apache.rat.license.ILicense;
 import org.apache.rat.utils.Log;
 
-import static java.lang.String.format;
-
 /**
  * A Document analyzer that analyses document headers for a license.
  */
 class DocumentHeaderAnalyser implements IDocumentAnalyser {
 
-    /**
-     * The license to analyse
-     */
-    private final ILicense license;
+    /** The license to analyse */
+    private final Collection<ILicense> licenses;
     /** the logger to use */
     private final Log log;
 
     /**
      * Constructs the HeaderAnalyser for the specific license.
-     * 
+     *
      * @param license The license to analyse
      */
-    public DocumentHeaderAnalyser(final Log log, final ILicense license) {
+    public DocumentHeaderAnalyser(final Log log, final Collection<ILicense> 
licenses) {
         super();
-        this.license = license;
+        this.licenses = licenses;
         this.log = log;
     }
 
     @Override
-    public void analyse(Document document) throws RatDocumentAnalysisException 
{
+    public void analyse(Document document) {
         try (Reader reader = document.reader()) {
             log.debug(format("Processing: %s", document));
-            HeaderCheckWorker worker = new HeaderCheckWorker(reader, license, 
document);
+            HeaderCheckWorker worker = new HeaderCheckWorker(reader, licenses, 
document);
             worker.read();
         } catch (IOException e) {
-            throw new RatDocumentAnalysisException("Cannot read header", e);
+            log.warn(String.format("Can not read header of %s", document));
+            document.getMetaData().setDocumentType(Document.Type.unknown);
         } catch (RatHeaderAnalysisException e) {
-            throw new RatDocumentAnalysisException("Cannot analyse header", e);
+            log.warn(String.format("Can not process header of %s", document));

Review Comment:
   cannot?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@creadur.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to