This is an automated email from the ASF dual-hosted git repository.

adangel pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-pmd-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 2051d09  [MPMD-248] cpd-check goal leaks file handle
2051d09 is described below

commit 2051d099a4f7555524fc17a02f6cac8c3bd92184
Author: Andreas Dangel <adan...@apache.org>
AuthorDate: Sun Dec 17 14:51:47 2017 +0100

    [MPMD-248] cpd-check goal leaks file handle
---
 .../java/org/apache/maven/plugins/pmd/CpdViolationCheckMojo.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git 
a/src/main/java/org/apache/maven/plugins/pmd/CpdViolationCheckMojo.java 
b/src/main/java/org/apache/maven/plugins/pmd/CpdViolationCheckMojo.java
index 64ffbb4..1175dfb 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/CpdViolationCheckMojo.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/CpdViolationCheckMojo.java
@@ -114,9 +114,12 @@ public class CpdViolationCheckMojo
     protected List<Duplication> getErrorDetails( File cpdFile )
         throws XmlPullParserException, IOException
     {
-        CpdXpp3Reader reader = new CpdXpp3Reader();
-        CpdErrorDetail details = reader.read( new FileReader( cpdFile ), false 
);
-        return details.getDuplications();
+        try ( FileReader fileReader = new FileReader( cpdFile ) )
+        {
+            CpdXpp3Reader reader = new CpdXpp3Reader();
+            CpdErrorDetail details = reader.read( fileReader, false );
+            return details.getDuplications();
+        }
     }
 
     @Override

-- 
To stop receiving notification emails like this one, please contact
['"commits@maven.apache.org" <commits@maven.apache.org>'].

Reply via email to