]> source.dussan.org Git - sonarqube.git/commitdiff
Fix some quality flaws
authorEvgeny Mandrikov <mandrikov@gmail.com>
Tue, 22 May 2012 20:25:19 +0000 (02:25 +0600)
committerEvgeny Mandrikov <mandrikov@gmail.com>
Tue, 22 May 2012 20:25:19 +0000 (02:25 +0600)
sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/SourceCode.java

index a94049aa94013424e5291a8291903b8fe5ca37b4..578722b6a5001a12192ef3b2b550d76a758273b3 100644 (file)
@@ -23,6 +23,8 @@
  */
 package net.sourceforge.pmd.cpd;
 
+import com.google.common.io.Closeables;
+
 import java.io.*;
 import java.lang.ref.SoftReference;
 import java.util.ArrayList;
@@ -69,13 +71,7 @@ public class SourceCode {
       } catch (Exception e) {
         throw new RuntimeException("Problem while reading " + getFileName() + ":" + e.getMessage(), e);
       } finally {
-        try {
-          if (lnr != null) {
-            lnr.close();
-          }
-        } catch (Exception e) {
-          throw new RuntimeException("Problem while reading " + getFileName() + ":" + e.getMessage(), e);
-        }
+        Closeables.closeQuietly(lnr);
       }
     }
   }