You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Carsten Karkola (JIRA)" <ji...@codehaus.org> on 2006/10/30 20:44:01 UTC

[jira] Created: (MCHECKSTYLE-59) Checkstyle Report fails if propertyExpansion contains file names

Checkstyle Report fails if propertyExpansion contains file names
----------------------------------------------------------------

                 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


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
            if ( StringUtils.isNotEmpty( propertyExpansion ) )
            {
                p.load( new StringInputStream( propertyExpansion ) );
            }

with the new 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();
      }

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

        

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

Posted by "Carsten Karkola (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MCHECKSTYLE-59?page=comments#action_79119 ] 
            
Carsten Karkola commented on MCHECKSTYLE-59:
--------------------------------------------

Thank you for your hint, I tried the suggested solution. In the parent pom I have:

          <suppressionsLocation>de/mms_dresden/checkstyle/suppressions.xml</suppressionsLocation>
          <headerLocation>de/mms_dresden/checkstyle/mms_header_regexp.txt</headerLocation>

On the console I get:
...
[INFO] Generate "Checkstyle" report.
[DEBUG] resolveLocation(de/mms_dresden/checkstyle/t_cruiting_checks.xml, checkstyle-checker.xml)
[DEBUG] Location is not a URL.
[DEBUG] Location is not a File.
[DEBUG] Potential Resource: jar:file:/D:/ckk/m2/de/telekom/mms-dresden/checkstyle/1.0/checkstyle-1.0.jar!/de/mms_dresden
/checkstyle/t_cruiting_checks.xml
[DEBUG] resolveLocation(null, checkstyle-checker.properties)
[DEBUG] resolveLocation(de/mms_dresden/checkstyle/mms_header_regexp.txt, checkstyle-header.txt)
[DEBUG] Location is not a URL.
[DEBUG] Location is not a File.
[DEBUG] Potential Resource: jar:file:/D:/ckk/m2/de/telekom/mms-dresden/checkstyle/1.0/checkstyle-1.0.jar!/de/mms_dresden
/checkstyle/mms_header_regexp.txt
[DEBUG] resolveLocation(null, checkstyle-packages.xml)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error during page generation

Embedded error: Error rendering Maven report: Failed during checkstyle configuration
Property ${checkstyle.suppressions.location} has not been set
[INFO] ------------------------------------------------------------------------

The header variable is resolved, but the suppresions variable not?


> Checkstyle Report fails if propertyExpansion contains file names
> ----------------------------------------------------------------
>
>                 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
>         Assigned To: Joakim Erdfelt
>
> 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
>             if ( StringUtils.isNotEmpty( propertyExpansion ) )
>             {
>                 p.load( new StringInputStream( propertyExpansion ) );
>             }
> with the new 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();
>       }
> 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

        

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

Posted by "Edward Ciramella (JIRA)" <ji...@codehaus.org>.
    [ 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

        

[jira] Updated: (MCHECKSTYLE-59) Checkstyle Report fails if propertyExpansion contains file names

Posted by "Lars Behnke (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MCHECKSTYLE-59?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lars Behnke updated MCHECKSTYLE-59:
-----------------------------------

    Attachment: MCHECKSTYLE-59-PATCH.patch

Please find the attached patch. It resolves the issue Carsten pointed out by quoting all backslash characters of the propertyExpansion value. Hence, expressions like <propertyExpansion>dir=${basedir}</propertyExpansion> will work on Windows systems. However, there is also a trade-off: You won't be able to pass unicode characters such as \u20ac anymore (which is a minor problem IMO).




> Checkstyle Report fails if propertyExpansion contains file names
> ----------------------------------------------------------------
>
>                 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: Joakim Erdfelt
>         Attachments: MCHECKSTYLE-59-PATCH.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
>             if ( StringUtils.isNotEmpty( propertyExpansion ) )
>             {
>                 p.load( new StringInputStream( propertyExpansion ) );
>             }
> with the new 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();
>       }
> 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

        

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

Posted by "Dennis Lundberg (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MCHECKSTYLE-59?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dennis Lundberg closed MCHECKSTYLE-59.
--------------------------------------

         Assignee: Dennis Lundberg
       Resolution: Fixed
    Fix Version/s: 2.2

I applied the patch from Leif Bennett, but it included Java 1.5+ language features, so I used a similar method from StringUtils instead.

A new SNAPSHOT has been deployed. Please verify that it solves this issue.

> 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

        

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

Posted by "Joakim Erdfelt (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MCHECKSTYLE-59?page=comments#action_78870 ] 
            
Joakim Erdfelt commented on MCHECKSTYLE-59:
-------------------------------------------

Seeing mms.suppressions.file=${basedir}/../../project/resources/checkstyle/suppressions.xml

I can see that you have a multi-module project, and you are attempting to set up a project relative xml definition.
This is undesired, and unsupported by the maven 2.0 checkstyle plugin.

Use the advice provided in http://maven.apache.org/plugins/maven-checkstyle-plugin/customize.html to setup a Custom Checkstyle build tools jar.
This will provide maximum reuse and proper isolation between components.

As well as being supported by continuous integration servers.

Using the build tools advice, and a parent pom, will result in less work for yourself.


> Checkstyle Report fails if propertyExpansion contains file names
> ----------------------------------------------------------------
>
>                 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
>         Assigned To: Joakim Erdfelt
>
> 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
>             if ( StringUtils.isNotEmpty( propertyExpansion ) )
>             {
>                 p.load( new StringInputStream( propertyExpansion ) );
>             }
> with the new 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();
>       }
> 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

        

[jira] Updated: (MCHECKSTYLE-59) Checkstyle Report fails if propertyExpansion contains file names

Posted by "Dennis Lundberg (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MCHECKSTYLE-59?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dennis Lundberg updated MCHECKSTYLE-59:
---------------------------------------

    Patch Submitted: [Yes]

> Checkstyle Report fails if propertyExpansion contains file names
> ----------------------------------------------------------------
>
>                 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
>         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
>             if ( StringUtils.isNotEmpty( propertyExpansion ) )
>             {
>                 p.load( new StringInputStream( propertyExpansion ) );
>             }
> with the new 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();
>       }
> 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

        

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

Posted by "Kevin Huang (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MCHECKSTYLE-59?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=133005#action_133005 ] 

Kevin Huang commented on MCHECKSTYLE-59:
----------------------------------------

Where is 2.2?

I got the 2.2-SNAPSHOT as maven-checkstyle-plugin-2.2-20080416.215959-20 from:

http://people.apache.org/repo/m2-snapshot-repository/org/apache/maven/plugins/maven-checkstyle-plugin/2.2-SNAPSHOT/

The problem is there still.

Thanks in advance.

Regards,
Kevin


> 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

        

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

Posted by "Olivier Lamy (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MCHECKSTYLE-59?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=215528#action_215528 ] 

Olivier Lamy commented on MCHECKSTYLE-59:
-----------------------------------------

can you please open a new issue (or clone this issue) and a provide a sample project to reproduce this issue.
Thanks

> 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

        

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

Posted by "Edward Ciramella (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MCHECKSTYLE-59?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=215539#action_215539 ] 

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

Sorry Olivier - 

I found my solution and figured it'd be good to post here in case someone else searches and finds this thing.

I switched:

<module name="GenericIllegalRegexp">

to 

<module name="Regexp">

and everything is happy now.

Sorry for the noise!

> 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

        

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

Posted by "Dennis Lundberg (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MCHECKSTYLE-59?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dennis Lundberg updated MCHECKSTYLE-59:
---------------------------------------

    Summary: Checkstyle Report fails if propertyExpansion contains backslash characters  (was: Checkstyle Report fails if propertyExpansion contains file names)

> 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
>         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

        

[jira] Updated: (MCHECKSTYLE-59) Checkstyle Report fails if propertyExpansion contains file names

Posted by "Dennis Lundberg (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MCHECKSTYLE-59?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dennis Lundberg updated MCHECKSTYLE-59:
---------------------------------------

    Description: 
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


  was:
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
            if ( StringUtils.isNotEmpty( propertyExpansion ) )
            {
                p.load( new StringInputStream( propertyExpansion ) );
            }

with the new 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();
      }

and it works.

Regards, carsten



> Checkstyle Report fails if propertyExpansion contains file names
> ----------------------------------------------------------------
>
>                 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
>         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

        

[jira] Updated: (MCHECKSTYLE-59) Checkstyle Report fails if propertyExpansion contains file names

Posted by "Leif Bennett (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MCHECKSTYLE-59?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leif Bennett updated MCHECKSTYLE-59:
------------------------------------

    Attachment: MCHECKSTYLE-59-PATCH2.patch

The problem appears to occur because of the documented behavior of java.util.Properties.load(InputStream), which interprets all backslash characters as escape sequences, and silently drops the backslash if it is not part of a valid escape sequence. On a Windows machine, the propertyExpansion field will contain backslash characters as part of the directory path in 'resourcedir'. These are either removed or changed (e.g., a path containing "plugin\trunk" will convert to "plugin<tab>runk").

The patch I supply appears to have identical functionality to the one submitted by Lars Behnke, but is perhaps more terse.

A similar strategy could be needed for some of the other values in this method, but have not caused a problem for me.

> Checkstyle Report fails if propertyExpansion contains file names
> ----------------------------------------------------------------
>
>                 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
>         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
>             if ( StringUtils.isNotEmpty( propertyExpansion ) )
>             {
>                 p.load( new StringInputStream( propertyExpansion ) );
>             }
> with the new 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();
>       }
> 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