You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@creadur.apache.org by "Marlon Pierce (JIRA)" <ji...@apache.org> on 2011/03/11 20:57:59 UTC

[jira] Commented: (RAT-86) License insertion doesn't work with just the -a and/or -a -f options.

    [ https://issues.apache.org/jira/browse/RAT-86?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13005808#comment-13005808 ] 

Marlon Pierce commented on RAT-86:
----------------------------------

SVN version still isn't working for me.  I had to add the line "	configuration.setHeaderMatcher(Defaults.createDefaultMatcher());" to the styleReport(...) method. That is, SVN has the code
 public void styleReport(PrintStream out,
302	                            ReportConfiguration configuration)
303	        throws Exception {
304	        final IReportable base = getDirectory(out);
305	        if (base != null) {
306	            InputStream style = Defaults.getDefaultStyleSheet();
307	            report(out, base, style, configuration);
308	        }
309	    }

but this throws NullPointerExceptions (not reproduced here).  My local fix (see also the original note) is


    public void styleReport(PrintStream out,
                            ReportConfiguration configuration)
        throws Exception {
        final IReportable base = getDirectory(out);
        if (base != null) {
            InputStream style = Defaults.getDefaultStyleSheet();
            //----Add line below------
	    configuration.setHeaderMatcher(Defaults.createDefaultMatcher());
            report(out, base, style, configuration);
        }
    }



> License insertion doesn't work with just the -a and/or -a -f options.
> ---------------------------------------------------------------------
>
>                 Key: RAT-86
>                 URL: https://issues.apache.org/jira/browse/RAT-86
>             Project: RAT
>          Issue Type: Bug
>    Affects Versions: 0.7
>         Environment: Mac OSX, java -version
> java version "1.6.0_22"
> Java(TM) SE Runtime Environment (build 1.6.0_22-b04-307-10M3261)
> Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03-307, mixed mode)
>            Reporter: Marlon Pierce
>             Fix For: 0.8
>
>
> This bug applies to the SVN checkout.  org.apache.rat.Report's command line processing logic seems flawed: if you want to insert a license header in your files (-a or -a -f), and unless you specify a stylesheet with the -s option, the report creation goes through report.styleReport(), which throws away any previously specified configuration settings: 
> pubic void styleReport(..) {
> ...
>   final ReportConfiguration configuration = new ReportConfiguration();
> ...
> }
> I assume you want something somewhat like
> public void styleReport(PrintStream out, ReportConfiguration pConfiguration) throws Exception {
>         final IReportable base = getDirectory(out);
>         if (base != null) {
>             InputStream style = Defaults.getDefaultStyleSheet();
>             pConfiguration.setHeaderMatcher(Defaults.createDefaultMatcher());
>             report(out, base, style, pConfiguration);
>         }
> }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira