maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1443188 - /maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdViolationCheckMojo.java
Date Wed, 06 Feb 2013 20:29:39 GMT
Author: olamy
Date: Wed Feb  6 20:29:39 2013
New Revision: 1443188

URL: http://svn.apache.org/viewvc?rev=1443188&view=rev
Log:
restore 1.5 compat

Modified:
    maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdViolationCheckMojo.java

Modified: maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdViolationCheckMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdViolationCheckMojo.java?rev=1443188&r1=1443187&r2=1443188&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdViolationCheckMojo.java
(original)
+++ maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdViolationCheckMojo.java
Wed Feb  6 20:29:39 2013
@@ -29,10 +29,12 @@ import org.apache.maven.plugins.annotati
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
+import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileReader;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -89,15 +91,26 @@ public class PmdViolationCheckMojo
     protected void loadExcludeFromFailuresData( final String excludeFromFailureFile )
         throws MojoExecutionException
     {
+        File file = new File( excludeFromFailureFile );
+        if ( !file.exists() )
+        {
+            return;
+        }
         final Properties props = new Properties();
+        FileInputStream fileInputStream = null;
         try
         {
-            props.load( new FileReader( excludeFromFailureFile ) );
+            fileInputStream = new FileInputStream( new File( excludeFromFailureFile ) );
+            props.load( fileInputStream );
         }
         catch ( final IOException e )
         {
             throw new MojoExecutionException( "Cannot load properties file " + excludeFromFailureFile,
e );
         }
+        finally
+        {
+            IOUtil.close( fileInputStream );
+        }
         for ( final Entry<Object, Object> propEntry : props.entrySet() )
         {
             final Set<String> excludedRuleSet = new HashSet<String>();



Mime
View raw message