You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2011/08/08 20:22:45 UTC

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

Author: olamy
Date: Mon Aug  8 18:22:45 2011
New Revision: 1155037

URL: http://svn.apache.org/viewvc?rev=1155037&view=rev
Log:
ensure we close Stream

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=1155037&r1=1155036&r2=1155037&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 Mon Aug  8 18:22:45 2011
@@ -31,6 +31,7 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Properties;
 
+import org.apache.commons.io.IOUtils;
 import org.apache.maven.artifact.DependencyResolutionRequiredException;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
@@ -304,9 +305,15 @@ public class DefaultCheckstyleExecutor
                 File propertiesFile = locator.getResourceAsFile( request.getPropertiesLocation(),
                                                                  "checkstyle-checker.properties" );
 
-                if ( propertiesFile != null )
+                FileInputStream properties = new FileInputStream( propertiesFile );
+                try
                 {
-                    p.load( new FileInputStream( propertiesFile ) );
+                    if ( propertiesFile != null )
+                    {
+                        p.load( properties );
+                    }
+                } finally {
+                    IOUtils.closeQuietly( properties );
                 }
             }