Return-Path: X-Original-To: apmail-creadur-commits-archive@www.apache.org Delivered-To: apmail-creadur-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 75B64107BD for ; Fri, 6 Dec 2013 08:39:26 +0000 (UTC) Received: (qmail 90540 invoked by uid 500); 6 Dec 2013 08:39:03 -0000 Delivered-To: apmail-creadur-commits-archive@creadur.apache.org Received: (qmail 90508 invoked by uid 500); 6 Dec 2013 08:39:01 -0000 Mailing-List: contact commits-help@creadur.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@creadur.apache.org Delivered-To: mailing list commits@creadur.apache.org Received: (qmail 90477 invoked by uid 99); 6 Dec 2013 08:38:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Dec 2013 08:38:58 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Dec 2013 08:38:56 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B983423889E3; Fri, 6 Dec 2013 08:38:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1548426 - /creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java Date: Fri, 06 Dec 2013 08:38:34 -0000 To: commits@creadur.apache.org From: rdonkin@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131206083834.B983423889E3@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rdonkin Date: Fri Dec 6 08:38:34 2013 New Revision: 1548426 URL: http://svn.apache.org/r1548426 Log: Apply PMD Rules. Modified: creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java Modified: creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java?rev=1548426&r1=1548425&r2=1548426&view=diff ============================================================================== --- creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java (original) +++ creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java Fri Dec 6 08:38:34 2013 @@ -34,7 +34,7 @@ import org.apache.rat.document.impl.Docu /** * Utility class, which provides static methods for creating test cases. */ -public class Resources { +public final class Resources { /** * Private constructor, to prevent accidental instantiation. */ @@ -49,14 +49,14 @@ public class Resources { * @return * @throws FileNotFoundException */ - public static File getResourceFile(String pResource) + public static File getResourceFile(final String pResource) throws FileNotFoundException { - final File f = new File("src/test/resources", pResource); - if (!f.isFile()) { + final File file = new File("src/test/resources", pResource); + if (!file.isFile()) { throw new FileNotFoundException("Unable to locate resource file: " + pResource); } - return f; + return file; } /** @@ -66,15 +66,15 @@ public class Resources { * @return * @throws FileNotFoundException */ - public static File[] getResourceFiles(String pResource) + public static File[] getResourceFiles(final String pResource) throws FileNotFoundException { - final File f = new File("src/test/resources", pResource); - if (!f.isDirectory()) { + final File file = new File("src/test/resources", pResource); + if (!file.isDirectory()) { throw new FileNotFoundException( - "Unable to locate resource directory: " + f); + "Unable to locate resource directory: " + file); } - return f.listFiles(new FileFilter() { - public boolean accept(File pathname) { + return file.listFiles(new FileFilter() { + public boolean accept(final File pathname) { return pathname.isFile(); } }); @@ -88,7 +88,7 @@ public class Resources { * @return * @throws IOException */ - public static InputStream getResourceStream(String pResource) + public static InputStream getResourceStream(final String pResource) throws IOException { return new FileInputStream(getResourceFile(pResource)); } @@ -101,7 +101,7 @@ public class Resources { * @throws UnsupportedEncodingException * @throws IOException */ - public static Reader getResourceReader(String pResource) + public static Reader getResourceReader(final String pResource) throws UnsupportedEncodingException, IOException { return new InputStreamReader(getResourceStream(pResource), "UTF-8"); } @@ -114,7 +114,7 @@ public class Resources { * @return * @throws IOException */ - public static BufferedReader getBufferedResourceReader(String pResource) + public static BufferedReader getBufferedResourceReader(final String pResource) throws IOException { return new BufferedReader(getResourceReader(pResource)); } @@ -128,7 +128,7 @@ public class Resources { * @throws UnsupportedEncodingException * @throws FileNotFoundException */ - public static BufferedReader getBufferedReader(File file) + public static BufferedReader getBufferedReader(final File file) throws UnsupportedEncodingException, FileNotFoundException { return new BufferedReader(new InputStreamReader(new FileInputStream( file), "UTF-8")); @@ -141,7 +141,7 @@ public class Resources { * @return * @throws FileNotFoundException */ - public static String getResourceDirectory(String pResource) + public static String getResourceDirectory(final String pResource) throws FileNotFoundException { final File resource = getResourceFile(pResource); final File dir = resource.getParentFile();