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


##########
apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Report.java:
##########
@@ -93,128 +103,230 @@ public void add(ResourceCollection rc) {
         nestedResources.add(rc);
     }
 
-    public void setInputFileFilter(FilenameFilter inputFileFilter) {
-        configuration.setFilesToIgnore(inputFileFilter);
+    /**
+     * Adds an input file filter.
+     * @param inputFileFilter The input file filter to add.
+     */
+    @Deprecated
+    public void setInputFileFilter(IOFileFilter inputFileFilter) {
+        deprecatedConfig.inputFileFilter = inputFileFilter;
     }
 
+    /**
+     * Sets the report file.
+     * @param reportFile the report file.
+     * @deprecated use {@link #setOut(String)}
+     */
+    @Deprecated
     public void setReportFile(File reportFile) {
-        configuration.setOut(reportFile);
+        setOut(reportFile.getAbsolutePath());
     }
 
-    public void addLicense(License lic) {
-        licenses.add(lic);
+    /**
+     * Adds an inline License definition to the system.
+     * @param license the license to add.
+     */
+    public void addLicense(License license) {
+        licenses.add(license);
     }
 
+    /**
+     * Add an inline license family defintion to the system.
+     * @param family the license family to add.
+     */
     public void addFamily(Family family) {
         families.add(family);
     }
 
     /**
-     * 
+     * Adds a style sheet to the system.
      * @param styleSheet
-     * @deprecated use {@link #addStyleSheet(Resource)}
+     * @deprecated use {@link #setStylesheet(String)}
      */
     @Deprecated
     public void addStylesheet(Resource styleSheet) {
-        addStyleSheet(styleSheet);
+        deprecatedConfig.styleSheet = styleSheet;
     }
 
     /**
      * Adds a given style sheet to the report.
      * @param styleSheet style sheet to use in this report.
+     * @deprecated use {@link #setStylesheet(String)}
      */
+    @Deprecated
     public void addStyleSheet(Resource styleSheet) {
-        configuration.setStyleSheet(styleSheet::getInputStream);
-        configuration.setStyleReport(true);
+        deprecatedConfig.styleSheet = styleSheet;
     }
 
+    /**
+     * Sets a stylesheet for the report.
+     * @param styleReport
+     * @deprecated use {@link #setXml(boolean)}.  Note reversal of boolean 
value
+     */
+    @Deprecated
     public void setStyleReport(boolean styleReport) {
-        configuration.setStyleReport(styleReport);
+        setXml(!styleReport);
     }
 
     /**
-     * 
+     * Determines if the output should be styled.
      * @param style
-     * @deprecated use #setStyleReport
+     * @deprecated use {@link #setStylesheet(String)} or {@link 
#setXml(boolean)}
      */
     @Deprecated
     public void setFormat(String style) {
         setStyleReport("styled".equalsIgnoreCase(style));
-
     }
 
+    /**
+     * Adds as a file containing the definitions of licenses to the system.
+     * @param fileName the file to add.
+     * @deprecated use licenses child element.
+     */
     public void setLicenses(File fileName) {
         try {
-            URL url = fileName.toURI().toURL();
-            Format fmt = Format.fromFile(fileName);
-            MatcherReader mReader = fmt.matcherReader();
-            if (mReader != null) {
-                mReader.addMatchers(url);
-            }
-            LicenseReader lReader = fmt.licenseReader();
-            if (lReader != null) {
-                lReader.addLicenses(url);
-                configuration.addLicenses(lReader.readLicenses());
-                
configuration.addApprovedLicenseCategories(lReader.approvedLicenseId());
-            }
-        } catch (MalformedURLException e) {
+            createLicenses().addText(fileName.getCanonicalPath());
+        } catch (IOException e) {
             throw new BuildException("Can not read license file " + fileName, 
e);
         }
     }
 
     /**
-     * @param useDefaultLicenses Whether to add the default list of license
-     * matchers.
+     * Specifies whether to add the default list of license matchers.
+     * @param useDefaultLicenses if {@code true} use the default licenses.
+     * @deprecated  use noDefaultLicenses attribute
      */
+    @Deprecated
     public void setUseDefaultLicenses(boolean useDefaultLicenses) {
-        if (!useDefaultLicenses) {
-            defaultsBuilder.noDefault();
-        }
+        setNoDefaultLicenses(!useDefaultLicenses);
     }
 
+    /**
+     * Adds a family category to the list of approved licenses.
+     * @param familyCategory the category to add.
+     * @deprecated use addApprovedLicense child element.
+     */
+    @Deprecated
     public void setAddApprovedLicense(String familyCategory) {
-        configuration.addApprovedLicenseCategory(familyCategory);
+        deprecatedConfig.approvedLicenseCategories.add(familyCategory);
     }
 
+    /**
+     * Adds a family category to the list of approved licenses.
+     * @param familyCategory the category to add
+     */
     public void addAddApprovedLicense(String familyCategory) {
-        configuration.addApprovedLicenseCategory(familyCategory);
+        deprecatedConfig.approvedLicenseCategories.add(familyCategory);
     }
 
+    /**
+     * Removes a family category to the list of approved licenses.
+     * @param familyCategory the category to add.
+     * @deprecated use removeApprovedLicense child element}
+     */
+    @Deprecated
     public void setRemoveApprovedLicense(String familyCategory) {
-        configuration.removeApprovedLicenseCategory(familyCategory);
+        deprecatedConfig.removedLicenseCategories.add(familyCategory);
+    }
+
+    /**
+     * Removes a family category to the list of approved licenses.
+     * @param familyCategory the category to add.
+     */
+    public void addRemoveApprovedLicense(String familyCategory) {
+        deprecatedConfig.removedLicenseCategories.add(familyCategory);
     }
 
+    /**
+     * Removes a family category to the list of approved licenses.
+     * @param familyCategory the category to add.
+     * @deprecated use removeApprovedLicense element
+     */
+    @Deprecated
     public void setRemoveApprovedLicense(String[] familyCategory) {
-        
configuration.removeApprovedLicenseCategories(Arrays.asList(familyCategory));
+        
deprecatedConfig.removedLicenseCategories.addAll(Arrays.asList(familyCategory));
     }
 
+    /**
+     * Removes a family category to the list of approved licenses.
+     * @param familyCategory the category to add.
+     */
+    public void addRemoveApprovedLicense(String[] familyCategory) {
+        
deprecatedConfig.removedLicenseCategories.addAll(Arrays.asList(familyCategory));
+    }
+    /**
+     * Sets the copyright message
+     * @param copyrightMessage the copyright message
+     * @deprecated use copyright attribute
+     */
+    @Deprecated
     public void setCopyrightMessage(String copyrightMessage) {
-        configuration.setCopyrightMessage(copyrightMessage);
+       setCopyright(copyrightMessage);
     }
 
+    /**
+     * Determines if license headers should be added.
+     * @param setting the setting.
+     * @deprecated use addLicense and force attributes
+     */
+    @Deprecated
     public void setAddLicenseHeaders(AddLicenseHeaders setting) {
-        configuration.setAddLicenseHeaders(setting.getNative());
+        switch (setting.getNative()) {
+            case TRUE:
+                setAddlicense(true);
+                break;
+            case FALSE:
+                setAddlicense(false);
+                break;
+            case FORCED:
+                setAddlicense(true);
+                setForce(true);
+                break;
+        }
     }
 
+    /**
+     * Adds definition information
+     * @param fileName the file to add
+     * @deprecated Use {@link #addLicense}
+     */
+    @Deprecated
     public void setAddDefaultDefinitions(File fileName) {
         try {
-            defaultsBuilder.add(fileName);
-        } catch (MalformedURLException e) {
-            throw new BuildException("Can not open additional default 
definitions: " + fileName.toString(), e);
+            Licenses lic = createLicenses();
+            lic.addText(fileName.getCanonicalPath());
+        } catch (IOException e) {
+            throw new BuildException("Can not read license file " + fileName, 
e);

Review Comment:
   Personally I'd prefer "Unable to read license file: "



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to