You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Edward Ciramella (JIRA)" <ji...@codehaus.org> on 2010/03/26 16:10:24 UTC

[jira] Commented: (MCHECKSTYLE-59) Checkstyle Report fails if propertyExpansion contains backslash characters

    [ http://jira.codehaus.org/browse/MCHECKSTYLE-59?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=215496#action_215496 ] 

Edward Ciramella commented on MCHECKSTYLE-59:
---------------------------------------------

I'm running maven 2.2.1, Checkstyle plugin 2.5 and I'm running into this exact same problem:

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error during page generation

Embedded error: Error rendering Maven report: Failed during checkstyle configuration
Unable to instantiate GenericIllegalRegexpCheck

Our Module is configured as follows:

        <module name="GenericIllegalRegexp">
	    <property name="format" value="System\.out\.print"/>
            <property name="message" value="System.out.print not allowed"/>
	</module>

This is just like the example checkstyle gives in their documentation.

Full output here:

Unable to instantiate GenericIllegalRegexpCheck
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error during page generation
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387
)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:592)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error during page generation
        at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:114)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        ... 17 more
Caused by: org.apache.maven.doxia.siterenderer.RendererException: Error rendering Maven report: Failed during checkstyle conf
iguration
        at org.apache.maven.plugins.site.ReportDocumentRenderer.renderDocument(ReportDocumentRenderer.java:174)
        at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderModule(DefaultSiteRenderer.java:328)
        at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render(DefaultSiteRenderer.java:132)
        at org.apache.maven.plugins.site.SiteMojo.renderLocale(SiteMojo.java:142)
        at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:109)
        ... 19 more
Caused by: org.apache.maven.reporting.MavenReportException: Failed during checkstyle configuration
        at org.apache.maven.plugin.checkstyle.CheckstyleReport.executeReport(CheckstyleReport.java:591)
        at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:131)
        at org.apache.maven.plugins.site.ReportDocumentRenderer.renderDocument(ReportDocumentRenderer.java:164)
        ... 23 more
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module TreeWalker - Unable to instantia
te GenericIllegalRegexp
        at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:177)
        at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:207)
        at org.apache.maven.plugin.checkstyle.DefaultCheckstyleExecutor.executeCheckstyle(DefaultCheckstyleExecutor.java:176)

        at org.apache.maven.plugin.checkstyle.CheckstyleReport.executeReport(CheckstyleReport.java:576)
        ... 25 more
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable to instantiate GenericIllegalRegexp
        at com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(PackageObjectFactory.java:156)
        at com.puppycrawl.tools.checkstyle.TreeWalker.setupChild(TreeWalker.java:159)
        at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:207)
        at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:156)
        ... 28 more
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable to instantiate GenericIllegalRegexpCheck
        at com.puppycrawl.tools.checkstyle.PackageObjectFactory.doMakeObject(PackageObjectFactory.java:99)
        at com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(PackageObjectFactory.java:153)
        ... 31 more
[INFO] ------------------------------------------------------------------------

> Checkstyle Report fails if propertyExpansion contains backslash characters
> --------------------------------------------------------------------------
>
>                 Key: MCHECKSTYLE-59
>                 URL: http://jira.codehaus.org/browse/MCHECKSTYLE-59
>             Project: Maven 2.x Checkstyle Plugin
>          Issue Type: Bug
>    Affects Versions: 2.1
>         Environment: Windows XP, JDK 1.4, Maven 2.0.4
>            Reporter: Carsten Karkola
>            Assignee: Dennis Lundberg
>             Fix For: 2.2
>
>         Attachments: MCHECKSTYLE-59-PATCH.patch, MCHECKSTYLE-59-PATCH2.patch
>
>
> The chechkstyle plugin fails on windows plattforms, if the propertyExpansion element contains file names like 
>   mms.suppressions.file=${basedir}/../../project/resources/checkstyle/suppressions.xml
> The backslashes in ${basedir} (like D:\foo\bar) are missing (D:foobar) and checkstyle fails. It seems to be an issue with StringInputStream.
> I've replaced the following old code in CheckstyleReport.java
> {code}
>             if ( StringUtils.isNotEmpty( propertyExpansion ) )
>             {
>                 p.load( new StringInputStream( propertyExpansion ) );
>             }
> {code}
> with the new Code
> {code}
>       if ( StringUtils.isNotEmpty( propertyExpansion ) ) {
>         BufferedReader reader = new BufferedReader(new StringReader(propertyExpansion));
>         String line = reader.readLine();
>         while (line != null) {
>           int delimPosition = line.indexOf('=');
>           if (delimPosition > -1) {
>             String name = line.substring(0, delimPosition).trim();
>             delimPosition++;
>             if (delimPosition < line.length()) {
>               String value = line.substring(delimPosition).trim();
>               if (value.length() > 0) {
>                 p.put(name, value);
>                 getLog().info("Property: " + name + " = " + p.getProperty(name));
>               }
>             }
>           }
>           line = reader.readLine();
>         }
>         reader.close();
>       }
> {code}
> and it works.
> Regards, carsten

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira