You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by dk...@apache.org on 2011/08/19 21:49:52 UTC

svn commit: r1159759 - /maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/DefaultCheckstyleExecutor.java

Author: dkulp
Date: Fri Aug 19 19:49:52 2011
New Revision: 1159759

URL: http://svn.apache.org/viewvc?rev=1159759&view=rev
Log:
[MCHECKSTYLE-159] Fix problem of checkstyle configs without cacheFile properties not working

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

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=1159759&r1=1159758&r2=1159759&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 Fri Aug 19 19:49:52 2011
@@ -266,8 +266,16 @@ public class DefaultCheckstyleExecutor
                     if ( module instanceof DefaultConfiguration )
                     {
                         //MCHECKSTYLE-132 DefaultConfiguration addAttribute has changed in checkstyle 5.3
-                        if ( ( (DefaultConfiguration) module ).getAttribute( "cacheFile" ) == null )
+                        try 
                         {
+                            if ( ( (DefaultConfiguration) module ).getAttribute( "cacheFile" ) == null )
+                            {
+                                ( (DefaultConfiguration) module ).addAttribute( "cacheFile", request.getCacheFile() );
+                            }
+                        }
+                        catch ( CheckstyleException ex ) 
+                        {
+                            //MCHECKSTYLE-159 - checkstyle 5.4 throws an exception instead of return null if "cacheFile" doesn't exist
                             ( (DefaultConfiguration) module ).addAttribute( "cacheFile", request.getCacheFile() );
                         }
                     }