You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@creadur.apache.org by po...@apache.org on 2015/05/19 23:09:33 UTC

svn commit: r1680390 - in /creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat: analysis/license/CDDL1License.java policy/DefaultPolicy.java walker/DirectoryWalker.java

Author: pottlinger
Date: Tue May 19 21:09:32 2015
New Revision: 1680390

URL: http://svn.apache.org/r1680390
Log:
Fix PMD warnings.


Modified:
    creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license/CDDL1License.java
    creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/policy/DefaultPolicy.java
    creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/walker/DirectoryWalker.java

Modified: creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license/CDDL1License.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license/CDDL1License.java?rev=1680390&r1=1680389&r2=1680390&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license/CDDL1License.java (original)
+++ creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license/CDDL1License.java Tue May 19 21:09:32 2015
@@ -29,14 +29,14 @@ import org.apache.rat.api.MetaData;
 public class CDDL1License extends BaseLicense implements IHeaderMatcher {
 
     public static final String CDDL1_LICENSE_DEFN
-        = "The contents of this file are subject to the terms of the Common Development\n"
-        + "and Distribution License(\"CDDL\") (the \"License\"). You may not use this file\n"
-        + "except in compliance with the License.\n\n";
+            = "The contents of this file are subject to the terms of the Common Development\n"
+            + "and Distribution License(\"CDDL\") (the \"License\"). You may not use this file\n"
+            + "except in compliance with the License.\n\n";
 
     public static final String CDDL1_LICENSE_DEFN_ILLUMOS_STYLE
-        = "The contents of this file are subject to the terms of the\n"
-        + "Common Development and Distribution License (the \"License\")\n"
-        + "You may not use this file except in compliance with the License.\n";
+            = "The contents of this file are subject to the terms of the\n"
+            + "Common Development and Distribution License (the \"License\")\n"
+            + "You may not use this file except in compliance with the License.\n";
 
     private final FullTextMatchingLicense textMatcherBase;
     private final FullTextMatchingLicense textMatcherIllumosStyle;
@@ -44,19 +44,19 @@ public class CDDL1License extends BaseLi
 
     public CDDL1License() {
         super(MetaData.RAT_LICENSE_FAMILY_CATEGORY_DATUM_CDLL1,
-              MetaData.RAT_LICENSE_FAMILY_NAME_DATUM_CDDL1,
-              "");
+                MetaData.RAT_LICENSE_FAMILY_NAME_DATUM_CDDL1,
+                "");
         textMatcherBase = new FullTextMatchingLicense(MetaData.RAT_LICENSE_FAMILY_CATEGORY_DATUM_CDLL1,
-                                                      MetaData.RAT_LICENSE_FAMILY_NAME_DATUM_CDDL1,
-                                                      "", CDDL1_LICENSE_DEFN);
+                MetaData.RAT_LICENSE_FAMILY_NAME_DATUM_CDDL1,
+                "", CDDL1_LICENSE_DEFN);
         textMatcherIllumosStyle = new FullTextMatchingLicense(MetaData.RAT_LICENSE_FAMILY_CATEGORY_DATUM_CDLL1,
-                                                              MetaData.RAT_LICENSE_FAMILY_NAME_DATUM_CDDL1,
-                                                              "", CDDL1_LICENSE_DEFN_ILLUMOS_STYLE);
+                MetaData.RAT_LICENSE_FAMILY_NAME_DATUM_CDDL1,
+                "", CDDL1_LICENSE_DEFN_ILLUMOS_STYLE);
     }
 
     public boolean match(Document subject, String s) throws RatHeaderAnalysisException {
-        return (textMatcherBase.match(subject, s) ||
-                textMatcherIllumosStyle.match(subject, s));
+        return textMatcherBase.match(subject, s) ||
+                textMatcherIllumosStyle.match(subject, s);
     }
 
     public void reset() {

Modified: creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/policy/DefaultPolicy.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/policy/DefaultPolicy.java?rev=1680390&r1=1680389&r2=1680390&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/policy/DefaultPolicy.java (original)
+++ creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/policy/DefaultPolicy.java Tue May 19 21:09:32 2015
@@ -70,7 +70,7 @@ public class DefaultPolicy implements ID
         if (subject != null) {
             final String name = subject.getMetaData().value(MetaData.RAT_URL_LICENSE_FAMILY_NAME);
             if (name != null) {
-                final boolean isApproved = (Collections.binarySearch(approvedLicenseNames, name) >= 0);
+                final boolean isApproved = Collections.binarySearch(approvedLicenseNames, name) >= 0;
                 reportLicenseApprovalClaim(subject, isApproved);
             }
         }

Modified: creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/walker/DirectoryWalker.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/walker/DirectoryWalker.java?rev=1680390&r1=1680389&r2=1680390&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/walker/DirectoryWalker.java (original)
+++ creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/walker/DirectoryWalker.java Tue May 19 21:09:32 2015
@@ -43,14 +43,15 @@ public class DirectoryWalker extends Wal
 
     /**
      * Constructs a walker.
-     * @param file not null
-     * @param filter filters input files (optional), 
-     * or null when no filtering should be performed
+     *
+     * @param file   not null
+     * @param filter filters input files (optional),
+     *               or null when no filtering should be performed
      */
     public DirectoryWalker(File file, final FilenameFilter filter) {
         super(file.getPath(), file, filter);
     }
-    
+
     public DirectoryWalker(File file, final Pattern ignoreNameRegex) {
         super(file.getPath(), file, regexFilter(ignoreNameRegex));
     }
@@ -58,26 +59,25 @@ public class DirectoryWalker extends Wal
     public boolean isRestricted() {
         return false;
     }
-   
+
     /**
      * Process a directory, restricted directories will be ignored.
      *
      * @param report The report to process the directory with
-     * @param file the directory to process
+     * @param file   the directory to process
      * @throws RatException
      */
-    private void processDirectory(RatReport  report, final File file) throws RatException {
+    private void processDirectory(RatReport report, final File file) throws RatException {
         if (!isRestricted(file)) {
             process(report, file);
         }
     }
-    
+
     /**
      * Run a report over all files and directories in this DirectoryWalker,
      * ignoring any files/directories set to be ignored.
-     * 
+     *
      * @param report the defined RatReport to run on this Directory walker.
-     * 
      */
     public void run(final RatReport report) throws RatException {
         process(report, file);
@@ -85,9 +85,9 @@ public class DirectoryWalker extends Wal
 
     /**
      * Process a directory, ignoring any files/directories set to be ignored.
-     * 
+     *
      * @param report the report to use in processing
-     * @param file the run the report against
+     * @param file   the run the report against
      * @throws RatException
      */
     private void process(final RatReport report, final File file) throws RatException {
@@ -102,43 +102,40 @@ public class DirectoryWalker extends Wal
 
     /**
      * Process all directories in a set of file objects, ignoring any directories set to be ignored.
-     * 
+     *
      * @param report the report to use in processing
-     * @param files the files to process (only directories will be processed)
+     * @param files  the files to process (only directories will be processed)
      * @throws RatException
      */
     private void processDirectories(final RatReport report, final File[] files) throws RatException {
         for (final File file : files) {
-            if (!ignored(file)) {
-                if (file.isDirectory()) {
-                    processDirectory(report, file);
-                }
+            if (!ignored(file) && file.isDirectory()) {
+                processDirectory(report, file);
             }
         }
     }
-    
+
     /**
      * Process all files in a set of file objects, ignoring any files set to be ignored.
-     * 
+     *
      * @param report the report to use in processing
-     * @param files the files to process (only files will be processed)
+     * @param files  the files to process (only files will be processed)
      * @throws RatException
      */
     private void processNonDirectories(final RatReport report, final File[] files) throws RatException {
         for (final File file : files) {
-            if (!ignored(file)) {
-                if (!file.isDirectory()) {
-                    report(report, file);
-                }
+            if (!ignored(file) && !file.isDirectory()) {
+                report(report, file);
             }
         }
+
     }
 
     /**
      * Report on the given file.
-     * 
+     *
      * @param report the report to process the file with
-     * @param file the file to be reported on
+     * @param file   the file to be reported on
      * @throws RatException
      */
     private void report(final RatReport report, File file) throws RatException {