From 46605e701878daa426e851a1bd26f5fe2e73649c Mon Sep 17 00:00:00 2001 From: Evgeny Mandrikov Date: Wed, 23 May 2012 02:25:19 +0600 Subject: [PATCH] Fix some quality flaws --- .../main/java/net/sourceforge/pmd/cpd/SourceCode.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) 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); } } } -- 2.39.5