You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by de...@apache.org on 2012/02/19 15:49:25 UTC

svn commit: r1291009 - in /maven/plugins/trunk/maven-checkstyle-plugin: pom.xml src/main/java/org/apache/maven/plugin/checkstyle/DefaultCheckstyleExecutor.java

Author: dennisl
Date: Sun Feb 19 14:49:24 2012
New Revision: 1291009

URL: http://svn.apache.org/viewvc?rev=1291009&view=rev
Log:
[MCHECKSTYLE-173] Embedded error: Cannot set property 'charset' in module Checker to 'UTF-8,UTF-8': UTF-8,UTF-8

Modified:
    maven/plugins/trunk/maven-checkstyle-plugin/pom.xml
    maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/DefaultCheckstyleExecutor.java

Modified: maven/plugins/trunk/maven-checkstyle-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/pom.xml?rev=1291009&r1=1291008&r2=1291009&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/pom.xml Sun Feb 19 14:49:24 2012
@@ -30,7 +30,7 @@ under the License.
   </parent>
 
   <artifactId>maven-checkstyle-plugin</artifactId>
-  <version>2.10-SNAPSHOT</version>
+  <version>2.9.1-SNAPSHOT</version>
   <packaging>maven-plugin</packaging>
 
   <name>Maven Checkstyle Plugin</name>

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/DefaultCheckstyleExecutor.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/DefaultCheckstyleExecutor.java?rev=1291009&r1=1291008&r2=1291009&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/DefaultCheckstyleExecutor.java (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/DefaultCheckstyleExecutor.java Sun Feb 19 14:49:24 2012
@@ -261,7 +261,19 @@ public class DefaultCheckstyleExecutor
             {
                 if ( config instanceof DefaultConfiguration )
                 {
-                    ( (DefaultConfiguration) config ).addAttribute( "charset", effectiveEncoding );
+                    // MCHECKSTYLE-173 Only add the "charset" attribute if it has not been set
+                    try
+                    {
+                        if ( ( (DefaultConfiguration) config ).getAttribute( "charset" ) == null )
+                        {
+                            ( (DefaultConfiguration) config ).addAttribute( "charset", effectiveEncoding );
+                        }
+                    }
+                    catch ( CheckstyleException ex )
+                    {
+                        // Checkstyle 5.4+ throws an exception when trying to access an attribute that doesn't exist
+                        ( (DefaultConfiguration) config ).addAttribute( "charset", effectiveEncoding );
+                    }
                 }
                 else
                 {