creadur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r1549114 - /creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/NoteGuesser.java
Date Sun, 08 Dec 2013 19:04:20 GMT
Author: rdonkin
Date: Sun Dec  8 19:04:20 2013
New Revision: 1549114

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

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

Modified: creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/NoteGuesser.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/NoteGuesser.java?rev=1549114&r1=1549113&r2=1549114&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/NoteGuesser.java
(original)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/NoteGuesser.java
Sun Dec  8 19:04:20 2013
@@ -66,9 +66,9 @@ public class NoteGuesser {
 	 *            the note file extensions
 	 */
 	public NoteGuesser(final String[] noteFileNames,
-			final String[] noteFileExtensions) {
+			final String... noteFileExtensions) {
 		super();
-		this.noteFileNames = noteFileNames;
+		this.noteFileNames = noteFileNames.clone();
 		this.noteFileExtensions = noteFileExtensions;
 	}
 
@@ -80,24 +80,22 @@ public class NoteGuesser {
 	 * @return true, if is note
 	 */
 	private final boolean isNote(final String name) {
-		if (name == null) {
-			return false;
-		}
-
-		final List<String> l = Arrays.asList(this.noteFileNames);
-		final String normalisedName = GuessUtils.normalise(name);
-
-		if (l.contains(name) || l.contains(normalisedName)) {
-			return true;
-		}
-
-		for (final String element : this.noteFileExtensions) {
-			if (normalisedName.endsWith("." + element)) {
-				return true;
+		boolean result = false;
+		if (name != null) {
+			final List<String> list = Arrays.asList(this.noteFileNames);
+			final String normalisedName = GuessUtils.normalise(name);
+			if (list.contains(name) || list.contains(normalisedName)) {
+				result = true;
+			} else {
+				for (String element : this.noteFileExtensions) {
+					if (normalisedName.endsWith("." + element)) {
+						result = true;
+						break;
+					}
+				}
 			}
 		}
-
-		return false;
+		return result;
 	}
 
 	/**



Mime
View raw message