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 2014/03/02 20:52:50 UTC
svn commit: r1573348 -
/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/DefaultCheckstyleExecutor.java
Author: dennisl
Date: Sun Mar 2 19:52:50 2014
New Revision: 1573348
URL: http://svn.apache.org/r1573348
Log:
[MCHECKSTYLE-207] file handle leak - leading to failed builds
Submitted by: James Nord
Reviewed by: Dennis Lundberg
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=1573348&r1=1573347&r2=1573348&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 Mar 2 19:52:50 2014
@@ -20,6 +20,7 @@ package org.apache.maven.plugin.checksty
*/
import java.io.ByteArrayInputStream;
+import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -214,6 +215,19 @@ public class DefaultCheckstyleExecutor
checker.destroy();
+ if ( projectClassLoader instanceof Closeable )
+ {
+ try
+ {
+ ( ( Closeable ) projectClassLoader ).close();
+ }
+ catch ( IOException ex )
+ {
+ // Nothing we can do - and not detrimental to the build (save running out of file handles).
+ getLogger().info( "Failed to close custom Classloader - this indicated a bug in the code.", ex );
+ }
+ }
+
if ( request.getStringOutputStream() != null )
{
request.getLog().info( request.getStringOutputStream().toString() );