creadur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r1548430 - /creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/document/impl/DocumentImplUtils.java
Date Fri, 06 Dec 2013 08:41:16 GMT
Author: rdonkin
Date: Fri Dec  6 08:41:16 2013
New Revision: 1548430

URL: http://svn.apache.org/r1548430
Log:
Apply PMD Rules.

Modified:
    creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/document/impl/DocumentImplUtils.java

Modified: creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/document/impl/DocumentImplUtils.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/document/impl/DocumentImplUtils.java?rev=1548430&r1=1548429&r2=1548430&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/document/impl/DocumentImplUtils.java
(original)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/document/impl/DocumentImplUtils.java
Fri Dec  6 08:41:16 2013
@@ -26,20 +26,27 @@ import java.util.zip.ZipException;
 import java.util.zip.ZipInputStream;
 
 import org.apache.commons.io.IOUtils;
+
 /**
  *
  */
-public class DocumentImplUtils {
+public final class DocumentImplUtils {
+
+	/**
+	 * 
+	 */
+	private DocumentImplUtils() {
+		super();
+	}
 
 	/**
 	 * 
 	 * @param file
 	 * @return
 	 */
-	public final static String toName(File file) {
+	public final static String toName(final File file) {
 		String path = file.getPath();
-		String normalisedPath = path.replace('\\', '/');
-		return normalisedPath;
+		return path.replace('\\', '/');
 	}
 
 	/**
@@ -47,18 +54,19 @@ public class DocumentImplUtils {
 	 * @param stream
 	 * @return
 	 */
-	public static final boolean isZipStream(InputStream stream) {
+	public static final boolean isZipStream(final InputStream stream) {
 		ZipInputStream zip = new ZipInputStream(stream);
+		boolean result = true;
 		try {
 			zip.getNextEntry();
-			return true;
 		} catch (ZipException e) {
-			return false;
+			result = false;
 		} catch (IOException e) {
-			return false;
+			result = false;
 		} finally {
 			IOUtils.closeQuietly(zip);
 		}
+		return result;
 	}
 
 	/**
@@ -66,12 +74,14 @@ public class DocumentImplUtils {
 	 * @param file
 	 * @return
 	 */
-	public static final boolean isZip(File file) {
+	public static final boolean isZip(final File file) {
+		boolean result;
 		try {
-			return isZipStream(new FileInputStream(file));
+			result = isZipStream(new FileInputStream(file));
 		} catch (IOException e) {
-			return false;
+			result = false;
 		}
+		return result;
 	}
 
 }



Mime
View raw message