From: Evgeny Mandrikov Date: Tue, 22 May 2012 20:25:19 +0000 (+0600) Subject: Fix some quality flaws X-Git-Tag: 3.1~126 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=46605e701878daa426e851a1bd26f5fe2e73649c;p=sonarqube.git Fix some quality flaws --- diff --git a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/SourceCode.java b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/SourceCode.java index a94049aa940..578722b6a50 100644 --- a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/SourceCode.java +++ b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/SourceCode.java @@ -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); } } }