Author: sebb
Date: Tue Aug 12 01:25:38 2014
New Revision: 1617391

URL: http://svn.apache.org/r1617391
Log:
Tab police
Also removed trailing spaces in files that had tabs

Modified:
    creadur/rat/trunk/apache-rat-core/pom.xml
    
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/annotation/AbstractLicenceAppender.java
    
creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/MonolithicFileDocument.java
    
creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/ArchiveGuesser.java
    
creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/BinaryGuesser.java
    
creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/NoteGuesser.java
    
creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java
    
creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
    
creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
    
creadur/rat/trunk/apache-rat-plugin/src/test/java/org/apache/rat/mp/AbstractRatMojoTest.java
    
creadur/rat/trunk/apache-rat-plugin/src/test/java/org/apache/rat/mp/RatCheckMojoTest.java
    
creadur/rat/trunk/apache-rat-plugin/src/test/java/org/apache/rat/mp/RatTestHelpers.java

Modified: creadur/rat/trunk/apache-rat-core/pom.xml
URL: 
http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/pom.xml?rev=1617391&r1=1617390&r2=1617391&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/pom.xml (original)
+++ creadur/rat/trunk/apache-rat-core/pom.xml Tue Aug 12 01:25:38 2014
@@ -28,7 +28,7 @@
   <description>The core functionality, shared by the Ant tasks
     and the Maven plugin.</description>
 
-  <build>   
+  <build>
     <resources>
       <resource>
         <filtering>false</filtering>
@@ -89,7 +89,7 @@
       <artifactId>commons-collections</artifactId>
     </dependency>
     <dependency>
-         <groupId>commons-lang</groupId>
+      <groupId>commons-lang</groupId>
       <artifactId>commons-lang</artifactId>
     </dependency>
     <dependency>

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=1617391&r1=1617390&r2=1617391&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 Aug 12 01:25:38 2014
@@ -34,7 +34,7 @@ public class CDDL1License extends Simple
 
     public static final String LICENSE_URL =
             ".*https://oss.oracle.com/licenses/CDDL.*";;
-    private static final Pattern LICENSE_URL_PATTERN = 
Pattern.compile(LICENSE_URL);    
+    private static final Pattern LICENSE_URL_PATTERN = 
Pattern.compile(LICENSE_URL);
 
 
     public CDDL1License() {
@@ -46,10 +46,10 @@ public class CDDL1License extends Simple
     @Override
     protected boolean matches(final String pLine) {
         if (pLine != null) {
-               return 
-                               super.matches(pLine) ||
-                               LICENSE_LINE_PATTERN.matcher(pLine).find() ||
-                               LICENSE_URL_PATTERN.matcher(pLine).find();
+            return
+                    super.matches(pLine) ||
+                    LICENSE_LINE_PATTERN.matcher(pLine).find() ||
+                    LICENSE_URL_PATTERN.matcher(pLine).find();
         }
         return false;
     }

Modified: 
creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/annotation/AbstractLicenceAppender.java
URL: 
http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/annotation/AbstractLicenceAppender.java?rev=1617391&r1=1617390&r2=1617391&view=diff
==============================================================================
--- 
creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/annotation/AbstractLicenceAppender.java
 (original)
+++ 
creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/annotation/AbstractLicenceAppender.java
 Tue Aug 12 01:25:38 2014
@@ -15,7 +15,7 @@
  * KIND, either express or implied.  See the License for the    *
  * specific language governing permissions and limitations      *
  * under the License.                                           *
- */ 
+ */
 package org.apache.rat.annotation;
 
 import java.io.BufferedReader;
@@ -36,11 +36,11 @@ import java.util.Map;
  * existence of an existing licence header, it is assumed that either a second
  * licence header is intentional or that there is no licence header present
  * already.
- * 
+ *
  */
 public abstract class AbstractLicenceAppender {
     private static final String DOT = ".";
-       private static final int TYPE_UNKNOWN = 0;
+    private static final int TYPE_UNKNOWN = 0;
     private static final int TYPE_JAVA = 1;
     private static final int TYPE_XML = 2;
     private static final int TYPE_HTML = 3;
@@ -188,7 +188,7 @@ public abstract class AbstractLicenceApp
 
     /**
      * Append the default licence header to the supplied document.
-     * 
+     *
      * @param document document to append to.
      * @throws IOException
      *           if there is a problem while reading or writing the file
@@ -341,7 +341,7 @@ public abstract class AbstractLicenceApp
 
     /**
      * Detect the type of document.
-     * 
+     *
      * @param document to retrieve type from.
      * @return not null
      * @TODO use existing mechanism to detect the type of a file and record it 
in the report output, thus we will not need this duplication here.
@@ -363,7 +363,7 @@ public abstract class AbstractLicenceApp
      * Set the force flag on this appender. If this flag is set
      * to true then files will be modified directly, otherwise
      * new files will be created alongside the existing files.
-     * 
+     *
      * @param force force flag.
      */
     public void setForce(boolean force) {
@@ -372,14 +372,14 @@ public abstract class AbstractLicenceApp
 
     /**
      * @return Get the licence header of a document.
-     * @param document document to extract from. 
+     * @param document document to extract from.
      */
     public abstract String getLicenceHeader(File document);
 
     /**
      * Get the first line of the licence header formatted
      * for the given type of file.
-     * 
+     *
      * @param type the type of file, see the TYPE_* constants
      * @return not null
      */
@@ -396,7 +396,7 @@ public abstract class AbstractLicenceApp
     /**
      * Get the last line of the licence header formatted
      * for the given type of file.
-     * 
+     *
      * @param type the type of file, see the TYPE_* constants
      * @return not null
      */
@@ -413,7 +413,7 @@ public abstract class AbstractLicenceApp
     /**
      * Get a line of the licence header formatted
      * for the given type of file.
-     * 
+     *
      * @param type the type of file, see the TYPE_* constants
      * @param content the content for this line
      * @return not null

Modified: 
creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/MonolithicFileDocument.java
URL: 
http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/MonolithicFileDocument.java?rev=1617391&r1=1617390&r2=1617391&view=diff
==============================================================================
--- 
creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/MonolithicFileDocument.java
 (original)
+++ 
creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/MonolithicFileDocument.java
 Tue Aug 12 01:25:38 2014
@@ -15,7 +15,7 @@
  * KIND, either express or implied.  See the License for the    *
  * specific language governing permissions and limitations      *
  * under the License.                                           *
- */ 
+ */
 package org.apache.rat.document.impl;
 
 import java.io.File;
@@ -32,13 +32,14 @@ import org.apache.rat.api.Document;
 
 public class MonolithicFileDocument extends AbstractMonolithicDocument {
     private static final String UTF_8 = "UTF-8";
-       private static final String FILE_URL_PREFIX = "file";
-       
-       private final File file;
+
+    private static final String FILE_URL_PREFIX = "file";
+
+    private final File file;
 
     /**
-     * @return Creates and returns a new instance. 
-     * 
+     * @return Creates and returns a new instance.
+     *
      * @param url The document is read from the given URL.
      */
     public static Document newInstance(final URL url) {

Modified: 
creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/ArchiveGuesser.java
URL: 
http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/ArchiveGuesser.java?rev=1617391&r1=1617390&r2=1617391&view=diff
==============================================================================
--- 
creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/ArchiveGuesser.java
 (original)
+++ 
creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/ArchiveGuesser.java
 Tue Aug 12 01:25:38 2014
@@ -15,7 +15,7 @@
  * KIND, either express or implied.  See the License for the    *
  * specific language governing permissions and limitations      *
  * under the License.                                           *
- */ 
+ */
 package org.apache.rat.document.impl.guesser;
 
 import java.util.Locale;
@@ -23,9 +23,10 @@ import java.util.Locale;
 import org.apache.rat.api.Document;
 
 public class ArchiveGuesser {
-    
+
     private static final String DOT = ".";
-       public static final String[] ARCHIVE_EXTENSIONS = {
+
+    public static final String[] ARCHIVE_EXTENSIONS = {
         "jar", "gz",
         "zip", "tar",
         "bz", "bz2",
@@ -38,7 +39,7 @@ public class ArchiveGuesser {
     };
 
     /**
-     * @param document the current document. 
+     * @param document the current document.
      * @return whether the given document is an archive.
      */
     public static final boolean isArchive(final Document document) {

Modified: 
creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/BinaryGuesser.java
URL: 
http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/BinaryGuesser.java?rev=1617391&r1=1617390&r2=1617391&view=diff
==============================================================================
--- 
creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/BinaryGuesser.java
 (original)
+++ 
creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/BinaryGuesser.java
 Tue Aug 12 01:25:38 2014
@@ -38,7 +38,7 @@ public class BinaryGuesser {
 
     private static final String DOT = ".";
 
-       private static boolean isBinaryDocument(Document document) {
+    private static boolean isBinaryDocument(Document document) {
         boolean result = false;
         InputStream stream = null;
         try

Modified: 
creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/NoteGuesser.java
URL: 
http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/NoteGuesser.java?rev=1617391&r1=1617390&r2=1617391&view=diff
==============================================================================
--- 
creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/NoteGuesser.java
 (original)
+++ 
creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/NoteGuesser.java
 Tue Aug 12 01:25:38 2014
@@ -15,7 +15,7 @@
  * KIND, either express or implied.  See the License for the    *
  * specific language governing permissions and limitations      *
  * under the License.                                           *
- */ 
+ */
 package org.apache.rat.document.impl.guesser;
 
 import java.util.Arrays;
@@ -26,11 +26,12 @@ import org.apache.rat.api.Document;
 public class NoteGuesser {
 
     private static final String DOT = ".";
-       public static final String[] NOTE_FILE_NAMES = {
+
+    public static final String[] NOTE_FILE_NAMES = {
         "NOTICE", "LICENSE",
         "LICENSE.TXT", "NOTICE.TXT",
         "INSTALL", "INSTALL.TXT",
-        "README", "README.TXT", 
+        "README", "README.TXT",
         "NEWS", "NEWS.TXT",
         "AUTHOR", "AUTHOR.TXT",
         "AUTHORS", "AUTHORS.txt",
@@ -50,17 +51,17 @@ public class NoteGuesser {
         "LICENSE", "LICENSE.TXT",
         "NOTICE", "NOTICE.TXT",
     };
-    
+
     /**
      * @return Is a file by that name a note file?
      * @param name file name.
      */
     public static final boolean isNote(final String name) {
         if (name == null) {return false;}
-    
+
         List<String> l = Arrays.asList(NoteGuesser.NOTE_FILE_NAMES);
         String normalisedName = GuessUtils.normalise(name);
-        
+
         if (l.contains(name) || l.contains(normalisedName)) {
             return true;
         }
@@ -70,7 +71,7 @@ public class NoteGuesser {
                 return true;
             }
         }
-        
+
         return false;
     }
 

Modified: 
creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java
URL: 
http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java?rev=1617391&r1=1617390&r2=1617391&view=diff
==============================================================================
--- 
creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java
 (original)
+++ 
creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java
 Tue Aug 12 01:25:38 2014
@@ -51,457 +51,457 @@ import org.codehaus.plexus.util.Director
  * Abstract base class for Mojos, which are running Rat.
  */
 public abstract class AbstractRatMojo extends AbstractMojo {
-       /**
-        * The Maven specific default excludes.
-        */
-       static final List<String> MAVEN_DEFAULT_EXCLUDES = Collections
-                       .unmodifiableList(Arrays.asList("target/**/*", //
-                                       "cobertura.ser", //
-                                       "release.properties", //
-                                       "pom.xml.releaseBackup"));
-
-       /**
-        * The Eclipse specific default excludes.
-        */
-       static final List<String> ECLIPSE_DEFAULT_EXCLUDES = Collections
-                       .unmodifiableList(Arrays.asList(".classpath",//
-                                       ".project", //
-                                       ".settings/**/*"));
-
-       /**
-        * The IDEA specific default excludes.
-        */
-       static final List<String> IDEA_DEFAULT_EXCLUDES = Collections
-                       .unmodifiableList(Arrays.asList(//
-                                       "*.iml", //
-                                       "*.ipr", //
-                                       "*.iws", //
-                                       ".idea/**/*"));
-
-       /**
-        * The base directory, in which to search for files.
-        *
-        */
-       @Parameter(property = "rat.basedir", defaultValue = "${basedir}", 
required = true)
-       private File basedir;
-
-       /**
-        * Specifies the licenses to accept. Deprecated, use {@link #licenses}
-        * instead.
-        *
-        * @deprecated Use {@link #licenses} instead.
-        */
-       @Deprecated
-       @Parameter
-       private HeaderMatcherSpecification[] licenseMatchers;
-
-       /**
-        * Specifies the licenses to accept. By default, these are added to the
-        * default licenses, unless you set {@link #addDefaultLicenseMatchers} 
to
-        * true.
-        *
-        * @since 0.8
-        */
-       @Parameter
-       private IHeaderMatcher[] licenses;
-
-       /**
-        * The set of approved license family names.
-        * 
-        * @deprecated Use {@link #licenseFamilies} instead.
-        */
-       @Deprecated
-       private LicenseFamilySpecification[] licenseFamilyNames;
-
-       /**
-        * Specifies the license families to accept.
-        *
-        * @since 0.8
-        */
-       @Parameter
-       private ILicenseFamily[] licenseFamilies;
-
-       /**
-        * Whether to add the default list of license matchers.
-        *
-        */
-       @Parameter(property = "rat.addDefaultLicenseMatchers", defaultValue = 
"true")
-       private boolean addDefaultLicenseMatchers;
-
-       /**
-        * Specifies files, which are included in the report. By default, all 
files
-        * are included.
-        *
-        */
-       @Parameter
-       private String[] includes;
-
-       /**
-        * Specifies files, which are excluded in the report. By default, no 
files
-        * are excluded.
-        *
-        */
-       @Parameter
-       private String[] excludes;
-
-       /**
-        * Whether to use the default excludes when scanning for files. The 
default
-        * excludes are:
-        * <ul>
-        * <li>meta data files for version control systems</li>
-        * <li>temporary files used by Maven, see <a
-        * href="#useMavenDefaultExcludes">useMavenDefaultExcludes</a></li>
-        * <li>configuration files for Eclipse, see <a
-        * href="#useEclipseDefaultExcludes">useEclipseDefaultExcludes</a></li>
-        * <li>configuration files for IDEA, see <a
-        * href="#useIdeaDefaultExcludes">useIdeaDefaultExcludes</a></li>
-        * </ul>
-        */
-       @Parameter(property = "rat.useDefaultExcludes", defaultValue = "true")
-       private boolean useDefaultExcludes;
-
-       /**
-        * Whether to use the Maven specific default excludes when scanning for
-        * files. Maven specific default excludes are given by the constant
-        * MAVEN_DEFAULT_EXCLUDES: The <code>target</code> directory, the
-        * <code>cobertura.ser</code> file, and so on.
-        */
-       @Parameter(property = "rat.useMavenDefaultExcludes", defaultValue = 
"true")
-       private boolean useMavenDefaultExcludes;
-
-       /**
-        * Whether to use the Eclipse specific default excludes when scanning 
for
-        * files. Eclipse specific default excludes are given by the constant
-        * ECLIPSE_DEFAULT_EXCLUDES: The <code>.classpath</code> and
-        * <code>.project</code> files, the <code>.settings</code> directory, 
and so
-        * on.
-        */
-       @Parameter(property = "rat.useEclipseDefaultExcludes", defaultValue = 
"true")
-       private boolean useEclipseDefaultExcludes;
-
-       /**
-        * Whether to use the IDEA specific default excludes when scanning for
-        * files. IDEA specific default excludes are given by the constant
-        * IDEA_DEFAULT_EXCLUDES: The <code>*.iml</code>, <code>*.ipr</code> and
-        * <code>*.iws</code> files and the <code>.idea</code> directory.
-        */
-       @Parameter(property = "rat.useIdeaDefaultExcludes", defaultValue = 
"true")
-       private boolean useIdeaDefaultExcludes;
-
-       /**
-        * Whether to exclude subprojects. This is recommended, if you want a
-        * separate apache-rat-plugin report for each subproject.
-        *
-        */
-       @Parameter(property = "rat.excludeSubprojects", defaultValue = "true")
-       private boolean excludeSubProjects;
+    /**
+     * The Maven specific default excludes.
+     */
+    static final List<String> MAVEN_DEFAULT_EXCLUDES = Collections
+            .unmodifiableList(Arrays.asList("target/**/*", //
+                    "cobertura.ser", //
+                    "release.properties", //
+                    "pom.xml.releaseBackup"));
+
+    /**
+     * The Eclipse specific default excludes.
+     */
+    static final List<String> ECLIPSE_DEFAULT_EXCLUDES = Collections
+            .unmodifiableList(Arrays.asList(".classpath",//
+                    ".project", //
+                    ".settings/**/*"));
+
+    /**
+     * The IDEA specific default excludes.
+     */
+    static final List<String> IDEA_DEFAULT_EXCLUDES = Collections
+            .unmodifiableList(Arrays.asList(//
+                    "*.iml", //
+                    "*.ipr", //
+                    "*.iws", //
+                    ".idea/**/*"));
+
+    /**
+     * The base directory, in which to search for files.
+     *
+     */
+    @Parameter(property = "rat.basedir", defaultValue = "${basedir}", required 
= true)
+    private File basedir;
+
+    /**
+     * Specifies the licenses to accept. Deprecated, use {@link #licenses}
+     * instead.
+     *
+     * @deprecated Use {@link #licenses} instead.
+     */
+    @Deprecated
+    @Parameter
+    private HeaderMatcherSpecification[] licenseMatchers;
+
+    /**
+     * Specifies the licenses to accept. By default, these are added to the
+     * default licenses, unless you set {@link #addDefaultLicenseMatchers} to
+     * true.
+     *
+     * @since 0.8
+     */
+    @Parameter
+    private IHeaderMatcher[] licenses;
+
+    /**
+     * The set of approved license family names.
+     *
+     * @deprecated Use {@link #licenseFamilies} instead.
+     */
+    @Deprecated
+    private LicenseFamilySpecification[] licenseFamilyNames;
+
+    /**
+     * Specifies the license families to accept.
+     *
+     * @since 0.8
+     */
+    @Parameter
+    private ILicenseFamily[] licenseFamilies;
+
+    /**
+     * Whether to add the default list of license matchers.
+     *
+     */
+    @Parameter(property = "rat.addDefaultLicenseMatchers", defaultValue = 
"true")
+    private boolean addDefaultLicenseMatchers;
+
+    /**
+     * Specifies files, which are included in the report. By default, all files
+     * are included.
+     *
+     */
+    @Parameter
+    private String[] includes;
+
+    /**
+     * Specifies files, which are excluded in the report. By default, no files
+     * are excluded.
+     *
+     */
+    @Parameter
+    private String[] excludes;
+
+    /**
+     * Whether to use the default excludes when scanning for files. The default
+     * excludes are:
+     * <ul>
+     * <li>meta data files for version control systems</li>
+     * <li>temporary files used by Maven, see <a
+     * href="#useMavenDefaultExcludes">useMavenDefaultExcludes</a></li>
+     * <li>configuration files for Eclipse, see <a
+     * href="#useEclipseDefaultExcludes">useEclipseDefaultExcludes</a></li>
+     * <li>configuration files for IDEA, see <a
+     * href="#useIdeaDefaultExcludes">useIdeaDefaultExcludes</a></li>
+     * </ul>
+     */
+    @Parameter(property = "rat.useDefaultExcludes", defaultValue = "true")
+    private boolean useDefaultExcludes;
+
+    /**
+     * Whether to use the Maven specific default excludes when scanning for
+     * files. Maven specific default excludes are given by the constant
+     * MAVEN_DEFAULT_EXCLUDES: The <code>target</code> directory, the
+     * <code>cobertura.ser</code> file, and so on.
+     */
+    @Parameter(property = "rat.useMavenDefaultExcludes", defaultValue = "true")
+    private boolean useMavenDefaultExcludes;
+
+    /**
+     * Whether to use the Eclipse specific default excludes when scanning for
+     * files. Eclipse specific default excludes are given by the constant
+     * ECLIPSE_DEFAULT_EXCLUDES: The <code>.classpath</code> and
+     * <code>.project</code> files, the <code>.settings</code> directory, and 
so
+     * on.
+     */
+    @Parameter(property = "rat.useEclipseDefaultExcludes", defaultValue = 
"true")
+    private boolean useEclipseDefaultExcludes;
+
+    /**
+     * Whether to use the IDEA specific default excludes when scanning for
+     * files. IDEA specific default excludes are given by the constant
+     * IDEA_DEFAULT_EXCLUDES: The <code>*.iml</code>, <code>*.ipr</code> and
+     * <code>*.iws</code> files and the <code>.idea</code> directory.
+     */
+    @Parameter(property = "rat.useIdeaDefaultExcludes", defaultValue = "true")
+    private boolean useIdeaDefaultExcludes;
+
+    /**
+     * Whether to exclude subprojects. This is recommended, if you want a
+     * separate apache-rat-plugin report for each subproject.
+     *
+     */
+    @Parameter(property = "rat.excludeSubprojects", defaultValue = "true")
+    private boolean excludeSubProjects;
 
-       /**
-    * Holds the maven-internal project to allow resolution of artifact 
properties during mojo runs. 
+    /**
+    * Holds the maven-internal project to allow resolution of artifact 
properties during mojo runs.
     */
-       @Parameter(property = "project", required = true, readonly = true)
-       private MavenProject project;
+    @Parameter(property = "project", required = true, readonly = true)
+    private MavenProject project;
 
-       /**
-        * @return Returns the Maven project.
-        */
-       protected MavenProject getProject() {
-               return project;
-       }
-
-       /**
-        * Returns the set of {@link IHeaderMatcher header matchers} to use.
-        *
-        * @throws MojoFailureException
-        *             An error in the plugin configuration was detected.
-        * @throws MojoExecutionException
-        *             An error occurred while calculating the result.
-        * @return Array of license matchers to use
-        */
-       protected IHeaderMatcher[] getLicenseMatchers()
-                       throws MojoFailureException, MojoExecutionException {
-               final List<IHeaderMatcher> list = new 
ArrayList<IHeaderMatcher>();
-               if (licenses != null) {
-                       list.addAll(Arrays.asList(licenses));
-               }
-
-               if (licenseMatchers != null) {
-                       for (final HeaderMatcherSpecification spec : 
licenseMatchers) {
-                               final String className = spec.getClassName();
-                               final IHeaderMatcher headerMatcher = 
newInstance(
-                                               IHeaderMatcher.class, 
className);
-                               list.add(headerMatcher);
-                       }
-               }
-
-               if (addDefaultLicenseMatchers) {
-                       list.addAll(Arrays.asList(Defaults.DEFAULT_MATCHERS));
-               }
-               return list.toArray(new IHeaderMatcher[list.size()]);
-       }
-
-       private <T> T newInstance(final Class<T> clazz, final String className)
-                       throws MojoExecutionException, MojoFailureException {
-               try {
-                       final ClassLoader cl = Thread.currentThread()
-                                       .getContextClassLoader();
-                       @SuppressWarnings("unchecked") // incorrect cast will 
be caught below
-                       final T o = (T) cl.loadClass(className).newInstance();
-
-                       if (!clazz.isAssignableFrom(o.getClass())) {
-                               throw new MojoFailureException("The class "
-                                               + o.getClass().getName() + " 
does not implement "
-                                               + clazz.getName());
-                       }
-                       return o;
-               } catch (InstantiationException e) {
-                       throw new MojoExecutionException("Failed to instantiate 
class "
-                                       + className + ": " + e.getMessage(), e);
-               } catch (ClassCastException e) {
-                       throw new MojoExecutionException("The class " + 
className
-                                       + " is not implementing " + 
clazz.getName() + ": "
-                                       + e.getMessage(), e);
-               } catch (IllegalAccessException e) {
-                       throw new MojoExecutionException("Illegal access to 
class "
-                                       + className + ": " + e.getMessage(), e);
-               } catch (ClassNotFoundException e) {
-                       throw new MojoExecutionException("Class " + className
-                                       + " not found: " + e.getMessage(), e);
-               }
-       }
-
-       /**
-        * Adds the given string array to the list.
-        *
-        * @param pList
-        *            The list to which the array elements are being added.
-        * @param pArray
-        *            The strings to add to the list.
-        */
-       private static void add(List<String> pList, String[] pArray) {
-               if (pArray != null) {
-                       Collections.addAll(pList, pArray);
-               }
-       }
-
-       /**
-        * Creates an iterator over the files to check.
-        *
-        * @return A container of files, which are being checked.
-        */
-       protected IReportable getResources() {
-               final DirectoryScanner ds = new DirectoryScanner();
-               ds.setBasedir(basedir);
-               setExcludes(ds);
-               setIncludes(ds);
-               ds.scan();
-               whenDebuggingLogExcludedFiles(ds);
-               final String[] files = ds.getIncludedFiles();
-               logAboutIncludedFiles(files);
-               try {
-                       return new FilesReportable(basedir, files);
-               } catch (IOException e) {
-                       throw new UndeclaredThrowableException(e);
-               }
-       }
-
-       private void logAboutIncludedFiles(final String[] files) {
-               if (files.length == 0) {
-                       getLog().warn("No resources included.");
-               } else {
-                       getLog().info(
-                                       files.length
-                                                       + " resources included 
(use -debug for more details)");
-                       if (getLog().isDebugEnabled()) {
-                               for (String resource : files) {
-                                       getLog().debug(" - included " + 
resource);
-                               }
-                       }
-               }
-       }
-
-       private void whenDebuggingLogExcludedFiles(final DirectoryScanner ds) {
-               if (getLog().isDebugEnabled()) {
-                       final String[] excludedFiles = ds.getExcludedFiles();
-                       if (excludedFiles.length == 0) {
-                               getLog().debug("No excluded resources.");
-                       } else {
-                               getLog().debug(
-                                               "Excluded " + 
excludedFiles.length + " resources:");
-                               for (final String resource : excludedFiles) {
-                                       getLog().debug(" - excluded " + 
resource);
-                               }
-                       }
-               }
-       }
-
-       private void setIncludes(DirectoryScanner ds) {
-               if (includes != null) {
-                       ds.setIncludes(includes);
-               }
-       }
-
-       private void setExcludes(DirectoryScanner ds) {
-               final List<String> excludeList = buildDefaultExclusions();
-               if (excludes == null || excludes.length == 0) {
-                       getLog().info("No excludes explicitly specified.");
-               } else {
-                       for (String exclude : excludes) {
-                               getLog().info("Exclude: " + exclude);
-                       }
-               }
-               add(excludeList, excludes);
-               if (!excludeList.isEmpty()) {
-                       String[] allExcludes = excludeList.toArray(new 
String[excludeList
-                                       .size()]);
-                       ds.setExcludes(allExcludes);
-               }
-       }
-
-       private List<String> buildDefaultExclusions() {
-               final List<String> results = new ArrayList<String>();
-
-               addPlexusDefaults(results);
-
-               addMavenDefaults(results);
-
-               addEclipseDefaults(results);
-
-               addIdeaDefaults(results);
-
-               if (excludeSubProjects && project != null
-                               && project.getModules() != null) {
-                       for (Object o : project.getModules()) {
-                               String moduleSubPath = (String) o;
-                               results.add(moduleSubPath + "/**/*");
-                       }
-               }
-
-               getLog().debug("Finished creating list of implicit excludes.");
-               if (results.isEmpty()) {
-                       getLog().info("No excludes implicitly specified.");
-               } else {
-                       getLog().info(
-                                       results.size()
-                                                       + " implicit excludes 
(use -debug for more details).");
-                       for (final String exclude : results) {
-                               getLog().debug("Implicit exclude: " + exclude);
-                       }
-               }
-
-               return results;
-       }
-
-       private void addPlexusDefaults(final List<String> excludeList1) {
-               if (useDefaultExcludes) {
-                       getLog().debug("Adding plexus default exclusions...");
-                       Collections.addAll(excludeList1, 
DirectoryScanner.DEFAULTEXCLUDES);
-               } else {
-                       getLog().debug(
-                                       "rat.useDefaultExcludes set to false. "
-                                                       + "Plexus default 
exclusions will not be added");
-               }
-       }
-
-       private void addMavenDefaults(final List<String> excludeList1) {
-               if (useMavenDefaultExcludes) {
-                       getLog().debug(
-                                       "Adding exclusions often needed by 
Maven projects...");
-                       excludeList1.addAll(MAVEN_DEFAULT_EXCLUDES);
-               } else {
-                       getLog().debug(
-                                       "rat.useMavenDefaultExcludes set to 
false. "
-                                                       + "Exclusions often 
needed by Maven projects will not be added.");
-               }
-       }
-
-       private void addEclipseDefaults(final List<String> excludeList1) {
-               if (useEclipseDefaultExcludes) {
-                       getLog().debug(
-                                       "Adding exclusions often needed by 
projects "
-                                                       + "developed in 
Eclipse...");
-                       excludeList1.addAll(ECLIPSE_DEFAULT_EXCLUDES);
-               } else {
-                       getLog().debug(
-                                       "rat.useEclipseDefaultExcludes set to 
false. "
-                                                       + "Exclusions often 
needed by projects developed in "
-                                                       + "Eclipse will not be 
added.");
-               }
-       }
-
-       private void addIdeaDefaults(final List<String> excludeList1) {
-               if (useIdeaDefaultExcludes) {
-                       getLog().debug(
-                                       "Adding exclusions often needed by 
projects "
-                                                       + "developed in 
IDEA...");
-                       excludeList1.addAll(IDEA_DEFAULT_EXCLUDES);
-               } else {
-                       getLog().debug(
-                                       "rat.useIdeaDefaultExcludes set to 
false. "
-                                                       + "Exclusions often 
needed by projects developed in "
-                                                       + "IDEA will not be 
added.");
-               }
-       }
-
-       /**
-        * Writes the report to the given stream.
-        *
-        * @param out
-        *            The target writer, to which the report is being written.
-        * @param style
-        *            The stylesheet to use, or <code>null</code> for raw XML
-        * 
-        * @return the current statistic.
-        * 
-        * @throws MojoFailureException
-        *             An error in the plugin configuration was detected.
-        * @throws MojoExecutionException
-        *             Another error occurred while creating the report.
-        */
-       protected ClaimStatistic createReport(Writer out, InputStream style)
-                       throws MojoExecutionException, MojoFailureException {
-               final ReportConfiguration configuration = getConfiguration();
-               try {
-                       if (style != null) {
-                               return Report.report(out, getResources(), 
style, configuration);
-                       } else {
-                               return Report.report(getResources(), out, 
configuration);
-                       }
-               } catch (TransformerConfigurationException e) {
-                       throw new MojoExecutionException(e.getMessage(), e);
-               } catch (IOException e) {
-                       throw new MojoExecutionException(e.getMessage(), e);
-               } catch (InterruptedException e) {
-                       throw new MojoExecutionException(e.getMessage(), e);
-               } catch (RatException e) {
-                       throw new MojoExecutionException(e.getMessage(), e);
-               }
-       }
-
-       protected ReportConfiguration getConfiguration()
-                       throws MojoFailureException, MojoExecutionException {
-               final ReportConfiguration configuration = new 
ReportConfiguration();
-               configuration.setHeaderMatcher(new HeaderMatcherMultiplexer(
-                               getLicenseMatchers()));
-               
configuration.setApprovedLicenseNames(getApprovedLicenseNames());
-               return configuration;
-       }
-
-       private ILicenseFamily[] getApprovedLicenseNames()
-                       throws MojoExecutionException, MojoFailureException {
-               final List<ILicenseFamily> list = new 
ArrayList<ILicenseFamily>();
-               if (licenseFamilies != null) {
-                       list.addAll(Arrays.asList(licenseFamilies));
-               }
-               if (licenseFamilyNames != null) {
-                       for (LicenseFamilySpecification spec : 
licenseFamilyNames) {
-                               list.add(newInstance(ILicenseFamily.class, 
spec.getClassName()));
-                       }
-               }
-
-               if (list.isEmpty()) {
-                       return null;
-               }
-               return list.toArray(new ILicenseFamily[list.size()]);
-       }
+    /**
+     * @return Returns the Maven project.
+     */
+    protected MavenProject getProject() {
+        return project;
+    }
+
+    /**
+     * Returns the set of {@link IHeaderMatcher header matchers} to use.
+     *
+     * @throws MojoFailureException
+     *             An error in the plugin configuration was detected.
+     * @throws MojoExecutionException
+     *             An error occurred while calculating the result.
+     * @return Array of license matchers to use
+     */
+    protected IHeaderMatcher[] getLicenseMatchers()
+            throws MojoFailureException, MojoExecutionException {
+        final List<IHeaderMatcher> list = new ArrayList<IHeaderMatcher>();
+        if (licenses != null) {
+            list.addAll(Arrays.asList(licenses));
+        }
+
+        if (licenseMatchers != null) {
+            for (final HeaderMatcherSpecification spec : licenseMatchers) {
+                final String className = spec.getClassName();
+                final IHeaderMatcher headerMatcher = newInstance(
+                        IHeaderMatcher.class, className);
+                list.add(headerMatcher);
+            }
+        }
+
+        if (addDefaultLicenseMatchers) {
+            list.addAll(Arrays.asList(Defaults.DEFAULT_MATCHERS));
+        }
+        return list.toArray(new IHeaderMatcher[list.size()]);
+    }
+
+    private <T> T newInstance(final Class<T> clazz, final String className)
+            throws MojoExecutionException, MojoFailureException {
+        try {
+            final ClassLoader cl = Thread.currentThread()
+                    .getContextClassLoader();
+            @SuppressWarnings("unchecked") // incorrect cast will be caught 
below
+            final T o = (T) cl.loadClass(className).newInstance();
+
+            if (!clazz.isAssignableFrom(o.getClass())) {
+                throw new MojoFailureException("The class "
+                        + o.getClass().getName() + " does not implement "
+                        + clazz.getName());
+            }
+            return o;
+        } catch (InstantiationException e) {
+            throw new MojoExecutionException("Failed to instantiate class "
+                    + className + ": " + e.getMessage(), e);
+        } catch (ClassCastException e) {
+            throw new MojoExecutionException("The class " + className
+                    + " is not implementing " + clazz.getName() + ": "
+                    + e.getMessage(), e);
+        } catch (IllegalAccessException e) {
+            throw new MojoExecutionException("Illegal access to class "
+                    + className + ": " + e.getMessage(), e);
+        } catch (ClassNotFoundException e) {
+            throw new MojoExecutionException("Class " + className
+                    + " not found: " + e.getMessage(), e);
+        }
+    }
+
+    /**
+     * Adds the given string array to the list.
+     *
+     * @param pList
+     *            The list to which the array elements are being added.
+     * @param pArray
+     *            The strings to add to the list.
+     */
+    private static void add(List<String> pList, String[] pArray) {
+        if (pArray != null) {
+            Collections.addAll(pList, pArray);
+        }
+    }
+
+    /**
+     * Creates an iterator over the files to check.
+     *
+     * @return A container of files, which are being checked.
+     */
+    protected IReportable getResources() {
+        final DirectoryScanner ds = new DirectoryScanner();
+        ds.setBasedir(basedir);
+        setExcludes(ds);
+        setIncludes(ds);
+        ds.scan();
+        whenDebuggingLogExcludedFiles(ds);
+        final String[] files = ds.getIncludedFiles();
+        logAboutIncludedFiles(files);
+        try {
+            return new FilesReportable(basedir, files);
+        } catch (IOException e) {
+            throw new UndeclaredThrowableException(e);
+        }
+    }
+
+    private void logAboutIncludedFiles(final String[] files) {
+        if (files.length == 0) {
+            getLog().warn("No resources included.");
+        } else {
+            getLog().info(
+                    files.length
+                            + " resources included (use -debug for more 
details)");
+            if (getLog().isDebugEnabled()) {
+                for (String resource : files) {
+                    getLog().debug(" - included " + resource);
+                }
+            }
+        }
+    }
+
+    private void whenDebuggingLogExcludedFiles(final DirectoryScanner ds) {
+        if (getLog().isDebugEnabled()) {
+            final String[] excludedFiles = ds.getExcludedFiles();
+            if (excludedFiles.length == 0) {
+                getLog().debug("No excluded resources.");
+            } else {
+                getLog().debug(
+                        "Excluded " + excludedFiles.length + " resources:");
+                for (final String resource : excludedFiles) {
+                    getLog().debug(" - excluded " + resource);
+                }
+            }
+        }
+    }
+
+    private void setIncludes(DirectoryScanner ds) {
+        if (includes != null) {
+            ds.setIncludes(includes);
+        }
+    }
+
+    private void setExcludes(DirectoryScanner ds) {
+        final List<String> excludeList = buildDefaultExclusions();
+        if (excludes == null || excludes.length == 0) {
+            getLog().info("No excludes explicitly specified.");
+        } else {
+            for (String exclude : excludes) {
+                getLog().info("Exclude: " + exclude);
+            }
+        }
+        add(excludeList, excludes);
+        if (!excludeList.isEmpty()) {
+            String[] allExcludes = excludeList.toArray(new String[excludeList
+                    .size()]);
+            ds.setExcludes(allExcludes);
+        }
+    }
+
+    private List<String> buildDefaultExclusions() {
+        final List<String> results = new ArrayList<String>();
+
+        addPlexusDefaults(results);
+
+        addMavenDefaults(results);
+
+        addEclipseDefaults(results);
+
+        addIdeaDefaults(results);
+
+        if (excludeSubProjects && project != null
+                && project.getModules() != null) {
+            for (Object o : project.getModules()) {
+                String moduleSubPath = (String) o;
+                results.add(moduleSubPath + "/**/*");
+            }
+        }
+
+        getLog().debug("Finished creating list of implicit excludes.");
+        if (results.isEmpty()) {
+            getLog().info("No excludes implicitly specified.");
+        } else {
+            getLog().info(
+                    results.size()
+                            + " implicit excludes (use -debug for more 
details).");
+            for (final String exclude : results) {
+                getLog().debug("Implicit exclude: " + exclude);
+            }
+        }
+
+        return results;
+    }
+
+    private void addPlexusDefaults(final List<String> excludeList1) {
+        if (useDefaultExcludes) {
+            getLog().debug("Adding plexus default exclusions...");
+            Collections.addAll(excludeList1, DirectoryScanner.DEFAULTEXCLUDES);
+        } else {
+            getLog().debug(
+                    "rat.useDefaultExcludes set to false. "
+                            + "Plexus default exclusions will not be added");
+        }
+    }
+
+    private void addMavenDefaults(final List<String> excludeList1) {
+        if (useMavenDefaultExcludes) {
+            getLog().debug(
+                    "Adding exclusions often needed by Maven projects...");
+            excludeList1.addAll(MAVEN_DEFAULT_EXCLUDES);
+        } else {
+            getLog().debug(
+                    "rat.useMavenDefaultExcludes set to false. "
+                            + "Exclusions often needed by Maven projects will 
not be added.");
+        }
+    }
+
+    private void addEclipseDefaults(final List<String> excludeList1) {
+        if (useEclipseDefaultExcludes) {
+            getLog().debug(
+                    "Adding exclusions often needed by projects "
+                            + "developed in Eclipse...");
+            excludeList1.addAll(ECLIPSE_DEFAULT_EXCLUDES);
+        } else {
+            getLog().debug(
+                    "rat.useEclipseDefaultExcludes set to false. "
+                            + "Exclusions often needed by projects developed 
in "
+                            + "Eclipse will not be added.");
+        }
+    }
+
+    private void addIdeaDefaults(final List<String> excludeList1) {
+        if (useIdeaDefaultExcludes) {
+            getLog().debug(
+                    "Adding exclusions often needed by projects "
+                            + "developed in IDEA...");
+            excludeList1.addAll(IDEA_DEFAULT_EXCLUDES);
+        } else {
+            getLog().debug(
+                    "rat.useIdeaDefaultExcludes set to false. "
+                            + "Exclusions often needed by projects developed 
in "
+                            + "IDEA will not be added.");
+        }
+    }
+
+    /**
+     * Writes the report to the given stream.
+     *
+     * @param out
+     *            The target writer, to which the report is being written.
+     * @param style
+     *            The stylesheet to use, or <code>null</code> for raw XML
+     *
+     * @return the current statistic.
+     *
+     * @throws MojoFailureException
+     *             An error in the plugin configuration was detected.
+     * @throws MojoExecutionException
+     *             Another error occurred while creating the report.
+     */
+    protected ClaimStatistic createReport(Writer out, InputStream style)
+            throws MojoExecutionException, MojoFailureException {
+        final ReportConfiguration configuration = getConfiguration();
+        try {
+            if (style != null) {
+                return Report.report(out, getResources(), style, 
configuration);
+            } else {
+                return Report.report(getResources(), out, configuration);
+            }
+        } catch (TransformerConfigurationException e) {
+            throw new MojoExecutionException(e.getMessage(), e);
+        } catch (IOException e) {
+            throw new MojoExecutionException(e.getMessage(), e);
+        } catch (InterruptedException e) {
+            throw new MojoExecutionException(e.getMessage(), e);
+        } catch (RatException e) {
+            throw new MojoExecutionException(e.getMessage(), e);
+        }
+    }
+
+    protected ReportConfiguration getConfiguration()
+            throws MojoFailureException, MojoExecutionException {
+        final ReportConfiguration configuration = new ReportConfiguration();
+        configuration.setHeaderMatcher(new HeaderMatcherMultiplexer(
+                getLicenseMatchers()));
+        configuration.setApprovedLicenseNames(getApprovedLicenseNames());
+        return configuration;
+    }
+
+    private ILicenseFamily[] getApprovedLicenseNames()
+            throws MojoExecutionException, MojoFailureException {
+        final List<ILicenseFamily> list = new ArrayList<ILicenseFamily>();
+        if (licenseFamilies != null) {
+            list.addAll(Arrays.asList(licenseFamilies));
+        }
+        if (licenseFamilyNames != null) {
+            for (LicenseFamilySpecification spec : licenseFamilyNames) {
+                list.add(newInstance(ILicenseFamily.class, 
spec.getClassName()));
+            }
+        }
+
+        if (list.isEmpty()) {
+            return null;
+        }
+        return list.toArray(new ILicenseFamily[list.size()]);
+    }
 }

Modified: 
creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
URL: 
http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java?rev=1617391&r1=1617390&r2=1617391&view=diff
==============================================================================
--- 
creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
 (original)
+++ 
creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
 Tue Aug 12 01:25:38 2014
@@ -168,11 +168,11 @@ public class RatCheckMojo extends Abstra
      */
     public void execute() throws MojoExecutionException, MojoFailureException
     {
-       if(skip) {
-               getLog().info("RAT will not execute since it is configured to 
be skipped via system property 'rat.skip'.");
-               return;
-       }
-       
+        if(skip) {
+            getLog().info("RAT will not execute since it is configured to be 
skipped via system property 'rat.skip'.");
+            return;
+        }
+
         final File parent = reportFile.getParentFile();
         if(!parent.mkdirs() && !parent.isDirectory()) {
             throw new MojoExecutionException("Could not create report parent 
directory " + parent);

Modified: 
creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
URL: 
http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java?rev=1617391&r1=1617390&r2=1617391&view=diff
==============================================================================
--- 
creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
 (original)
+++ 
creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
 Tue Aug 12 01:25:38 2014
@@ -74,8 +74,8 @@ public class RatReportMojo extends Abstr
 
     @Component
     private ArtifactResolver resolver;
-       
-       /**
+
+    /**
      * Specifies the directory where the report will be generated
      */
     @Parameter(defaultValue = "${project.reporting.outputDirectory}", required 
= true)
@@ -86,7 +86,7 @@ public class RatReportMojo extends Abstr
 
     /**
      * Returns the skins artifact file.
-     * 
+     *
      * @throws MojoFailureException
      *             An error in the plugin configuration was detected.
      * @throws MojoExecutionException
@@ -110,7 +110,7 @@ public class RatReportMojo extends Abstr
                 factory.createDependencyArtifact( skin.getGroupId(), 
skin.getArtifactId(), versionSpec, "jar", null,
                                                   null );
 
-                       resolver.resolve( artifact, 
getProject().getRemoteArtifactRepositories(), localRepository );
+            resolver.resolve( artifact, 
getProject().getRemoteArtifactRepositories(), localRepository );
         }
         catch ( InvalidVersionSpecificationException e )
         {
@@ -130,7 +130,7 @@ public class RatReportMojo extends Abstr
 
     /**
      * Creates the report as a string. Currently, this string will be embedded 
verbatimly into the report document.
-     * 
+     *
      * @throws MojoFailureException
      *             An error in the plugin configuration was detected.
      * @throws MojoExecutionException
@@ -185,7 +185,7 @@ public class RatReportMojo extends Abstr
 
     /**
      * Called from Maven to invoke the plugin.
-     * 
+     *
      * @throws MojoFailureException
      *             An error in the plugin configuration was detected.
      * @throws MojoExecutionException
@@ -236,7 +236,7 @@ public class RatReportMojo extends Abstr
 
     /**
      * Returns, whether the report may be generated.
-     * 
+     *
      * @return Always true.
      */
     public boolean canGenerateReport()
@@ -246,7 +246,7 @@ public class RatReportMojo extends Abstr
 
     /**
      * Searches for a Rat artifact in the dependency list and returns its 
version.
-     * 
+     *
      * @return Version number, if found, or null.
      */
     private String getRatVersion()
@@ -265,8 +265,8 @@ public class RatReportMojo extends Abstr
 
     /**
      * Writes the report to the Doxia sink.
-     * 
-     * 
+     *
+     *
      * @param sink
      *            The doxia sink, kind of a SAX handler.
      * @param locale
@@ -326,7 +326,7 @@ public class RatReportMojo extends Abstr
 
     /**
      * Returns the reports category name.
-     * 
+     *
      * @return {@link MavenReport#CATEGORY_PROJECT_REPORTS}
      */
     public String getCategoryName()
@@ -336,7 +336,7 @@ public class RatReportMojo extends Abstr
 
     /**
      * Returns the reports bundle
-     * 
+     *
      * @param locale
      *            Requested locale of the bundle
      * @return The bundle, which is used to read localized strings.
@@ -348,7 +348,7 @@ public class RatReportMojo extends Abstr
 
     /**
      * Returns the reports description.
-     * 
+     *
      * @param locale
      *            Requested locale of the bundle
      * @return Report description, as given by the key 
"report.rat.description" in the bundle.
@@ -360,7 +360,7 @@ public class RatReportMojo extends Abstr
 
     /**
      * Returns the reports name.
-     * 
+     *
      * @param locale
      *            Requested locale of the bundle
      * @return Report name, as given by the key "report.rat.name" in the 
bundle.
@@ -372,7 +372,7 @@ public class RatReportMojo extends Abstr
 
     /**
      * Returns the reports file name.
-     * 
+     *
      * @return "rat-report"
      */
     public String getOutputName()
@@ -382,7 +382,7 @@ public class RatReportMojo extends Abstr
 
     /**
      * Returns the reports output directory.
-     * 
+     *
      * @return Value of the "outputDirectory" parameter.
      */
     public File getReportOutputDirectory()
@@ -392,7 +392,7 @@ public class RatReportMojo extends Abstr
 
     /**
      * Returns, whether this is an external report.
-     * 
+     *
      * @return Always false.
      */
     public boolean isExternalReport()
@@ -402,7 +402,7 @@ public class RatReportMojo extends Abstr
 
     /**
      * Sets the reports output directory.
-     * 
+     *
      * @param pOutputDirectory
      *            Reports target directory.
      */

Modified: 
creadur/rat/trunk/apache-rat-plugin/src/test/java/org/apache/rat/mp/AbstractRatMojoTest.java
URL: 
http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-plugin/src/test/java/org/apache/rat/mp/AbstractRatMojoTest.java?rev=1617391&r1=1617390&r2=1617391&view=diff
==============================================================================
--- 
creadur/rat/trunk/apache-rat-plugin/src/test/java/org/apache/rat/mp/AbstractRatMojoTest.java
 (original)
+++ 
creadur/rat/trunk/apache-rat-plugin/src/test/java/org/apache/rat/mp/AbstractRatMojoTest.java
 Tue Aug 12 01:25:38 2014
@@ -23,11 +23,11 @@ import org.junit.Test;
 
 public class AbstractRatMojoTest {
 
-       @Test
-       public void testAmountOfExclusions() {
-               assertEquals("Did you change the amount of eclipse excludes?", 
3, AbstractRatMojo.ECLIPSE_DEFAULT_EXCLUDES.size());
-               assertEquals("Did you change the amount of idea excludes?", 4, 
AbstractRatMojo.IDEA_DEFAULT_EXCLUDES.size());
-               assertEquals("Did you change the amount of mvn excludes?", 4, 
AbstractRatMojo.MAVEN_DEFAULT_EXCLUDES.size());
-       }
+    @Test
+    public void testAmountOfExclusions() {
+        assertEquals("Did you change the amount of eclipse excludes?", 3, 
AbstractRatMojo.ECLIPSE_DEFAULT_EXCLUDES.size());
+        assertEquals("Did you change the amount of idea excludes?", 4, 
AbstractRatMojo.IDEA_DEFAULT_EXCLUDES.size());
+        assertEquals("Did you change the amount of mvn excludes?", 4, 
AbstractRatMojo.MAVEN_DEFAULT_EXCLUDES.size());
+    }
 
 }

Modified: 
creadur/rat/trunk/apache-rat-plugin/src/test/java/org/apache/rat/mp/RatCheckMojoTest.java
URL: 
http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-plugin/src/test/java/org/apache/rat/mp/RatCheckMojoTest.java?rev=1617391&r1=1617390&r2=1617391&view=diff
==============================================================================
--- 
creadur/rat/trunk/apache-rat-plugin/src/test/java/org/apache/rat/mp/RatCheckMojoTest.java
 (original)
+++ 
creadur/rat/trunk/apache-rat-plugin/src/test/java/org/apache/rat/mp/RatCheckMojoTest.java
 Tue Aug 12 01:25:38 2014
@@ -39,165 +39,165 @@ import org.apache.maven.plugin.testing.s
  */
 public class RatCheckMojoTest extends AbstractMojoTestCase {
 
-       /**
-        * Creates a new instance of {@link RatCheckMojo}.
-        * 
-        * @param pDir
-        *            The directory, where to look for a pom.xml file.
-        * @return The configured Mojo.
-        * @throws Exception
-        *             An error occurred while creating the Mojo.
-        */
-       private RatCheckMojo newRatCheckMojo(String pDir) throws Exception {
-               return (RatCheckMojo) newRatMojo(pDir, "check", false);
-       }
-
-       /**
-        * Creates a new instance of {@link AbstractRatMojo}.
-        * 
-        * @param pDir
-        *            The directory, where to look for a pom.xml file.
-        * @param pGoal
-        *            The goal, which the Mojo must implement.
-        * @return The configured Mojo.
-        * @throws Exception
-        *             An error occurred while creating the Mojo.
-        */
-       private AbstractRatMojo newRatMojo(String pDir, String pGoal,
-                       boolean pCreateCopy) throws Exception {
-               final File baseDir = new File(getBasedir());
-               final File testBaseDir = getSourceDirectory(getBasedir(), pDir,
-                               pCreateCopy, baseDir);
-               File testPom = new File(testBaseDir, "pom.xml");
-               AbstractRatMojo mojo = (AbstractRatMojo) lookupMojo(pGoal, 
testPom);
-               assertNotNull(mojo);
-               final File buildDirectory = new File(new File(baseDir, 
"target/test"),
-                               pDir);
-               setVariableValueToObject(mojo, "basedir", testBaseDir);
-               setVariableValueToObject(mojo, "addDefaultLicenseMatchers",
-                               Boolean.TRUE);
-               setVariableValueToObject(mojo, "useDefaultExcludes", 
Boolean.TRUE);
-               setVariableValueToObject(mojo, "useMavenDefaultExcludes", 
Boolean.TRUE);
-               setVariableValueToObject(mojo, "useEclipseDefaultExcludes",
-                               Boolean.TRUE);
-               setVariableValueToObject(mojo, "addLicenseHeaders", "false");
-               final Build build = new Build();
-               build.setDirectory(buildDirectory.getPath());
-               final MavenProjectStub project = new MavenProjectStub() {
-                       @Override
-                       public Build getBuild() {
-                               return build;
-                       }
-               };
-               setVariableValueToObject(mojo, "project", project);
-               assertNotNull(
-                               "Problem in test setup - you are missing a 
project in your mojo.",
-                               project);
-               assertNotNull(
-                               "The mojo is missing its MavenProject, which 
will result in an NPE during rat runs.",
-                               mojo.getProject());
-               assertNotNull(
-                               "No artifactRepos found, which will result in 
an NPE during rat runs.",
-                               project.getRemoteArtifactRepositories());
-               
-               if (mojo instanceof RatReportMojo) {
-                       setVariableValueToObject(mojo, "localRepository",
-                                       newArtifactRepository(container));
-                       setVariableValueToObject(mojo, "resolver", 
newArtifactResolver());
-                       setVariableValueToObject(mojo, "factory", 
newArtifactFactory());
-                       setVariableValueToObject(mojo, "siteRenderer",
-                                       newSiteRenderer(container));
-               } else if (mojo instanceof RatCheckMojo) {
-                       final File ratTxtFile = new File(buildDirectory, 
"rat.txt");
-                       setVariableValueToObject(mojo, "reportFile", 
ratTxtFile);
-               }
-               return mojo;
-       }
-       
-       /**
-        * Reads the location of the rat text file from the Mojo.
-        * 
-        * @param pMojo
-        *            The configured Mojo.
-        * @return Value of the "reportFile" property.
-        * @throws Exception
-        *             An error occurred while reading the property.
-        */
-       private File getRatTxtFile(RatCheckMojo pMojo) throws Exception {
-               return (File) getVariableValueFromObject(pMojo, "reportFile");
-       }
-
-       /**
-        * Runs a check, which should expose no problems.
-        * 
-        * @throws Exception
-        *             The test failed.
-        */
-       public void testIt1() throws Exception {
-               final RatCheckMojo mojo = newRatCheckMojo("it1");
-               final File ratTxtFile = getRatTxtFile(mojo);
-               mojo.execute();
-               ensureRatReportIsCorrect(ratTxtFile, 1, 0);
-       }
-
-       /**
-        * Runs a check, which should detect a problem.
-        * 
-        * @throws Exception
-        *             The test failed.
-        */
-       public void testIt2() throws Exception {
-               final RatCheckMojo mojo = newRatCheckMojo("it2");
-               final File ratTxtFile = getRatTxtFile(mojo);
-               try {
-                       mojo.execute();
-                       fail("Expected RatCheckException");
-               } catch (RatCheckException e) {
-                       final String msg = e.getMessage();
-                       // default value is "${project.build.directory}/rat.txt"
-                       final String REPORTFILE = "rat.txt";
-                       
-                       assertTrue("report filename was not contained in '" + 
msg + "'",
-                                       msg.contains(REPORTFILE));
-                       assertFalse("no null allowed in '" + msg + "'", 
(msg.toUpperCase()
-                                       .indexOf("NULL") > -1));
-               }
-               ensureRatReportIsCorrect(ratTxtFile, 1, 1);
-       }
-
-       private String getFirstLine(File pFile) throws IOException {
-               final FileInputStream fis = new FileInputStream(pFile);
-               final InputStreamReader reader = new InputStreamReader(fis, 
"UTF8");
-               final BufferedReader breader = new BufferedReader(reader);
-               final String result = breader.readLine();
-               breader.close();
-               return result;
-       }
-
-       /**
-        * Tests adding license headers.
-        */
-       public void testIt3() throws Exception {
-               final RatCheckMojo mojo = (RatCheckMojo) newRatMojo("it3", 
"check",
-                               true);
-               setVariableValueToObject(mojo, "addLicenseHeaders", "true");
-               setVariableValueToObject(mojo, "numUnapprovedLicenses",
-                               Integer.valueOf(1));
-               mojo.execute();
-               final File ratTxtFile = getRatTxtFile(mojo);
-               ensureRatReportIsCorrect(ratTxtFile, 1, 1);
-
-               final File baseDir = new File(getBasedir());
-               final File sourcesDir = new File(new File(baseDir, 
"target/it-source"),
-                               "it3");
-               final String firstLineOrig = getFirstLine(new File(sourcesDir,
-                               "src.apt"));
-               assertTrue(firstLineOrig.indexOf("--") != -1);
-               assertTrue(firstLineOrig.indexOf("~~") == -1);
-               final String firstLineModified = getFirstLine(new 
File(sourcesDir,
-                               "src.apt.new"));
-               assertTrue(firstLineModified.indexOf("--") == -1);
-               assertTrue(firstLineModified.indexOf("~~") != -1);
-       }
+    /**
+     * Creates a new instance of {@link RatCheckMojo}.
+     *
+     * @param pDir
+     *            The directory, where to look for a pom.xml file.
+     * @return The configured Mojo.
+     * @throws Exception
+     *             An error occurred while creating the Mojo.
+     */
+    private RatCheckMojo newRatCheckMojo(String pDir) throws Exception {
+        return (RatCheckMojo) newRatMojo(pDir, "check", false);
+    }
+
+    /**
+     * Creates a new instance of {@link AbstractRatMojo}.
+     *
+     * @param pDir
+     *            The directory, where to look for a pom.xml file.
+     * @param pGoal
+     *            The goal, which the Mojo must implement.
+     * @return The configured Mojo.
+     * @throws Exception
+     *             An error occurred while creating the Mojo.
+     */
+    private AbstractRatMojo newRatMojo(String pDir, String pGoal,
+            boolean pCreateCopy) throws Exception {
+        final File baseDir = new File(getBasedir());
+        final File testBaseDir = getSourceDirectory(getBasedir(), pDir,
+                pCreateCopy, baseDir);
+        File testPom = new File(testBaseDir, "pom.xml");
+        AbstractRatMojo mojo = (AbstractRatMojo) lookupMojo(pGoal, testPom);
+        assertNotNull(mojo);
+        final File buildDirectory = new File(new File(baseDir, "target/test"),
+                pDir);
+        setVariableValueToObject(mojo, "basedir", testBaseDir);
+        setVariableValueToObject(mojo, "addDefaultLicenseMatchers",
+                Boolean.TRUE);
+        setVariableValueToObject(mojo, "useDefaultExcludes", Boolean.TRUE);
+        setVariableValueToObject(mojo, "useMavenDefaultExcludes", 
Boolean.TRUE);
+        setVariableValueToObject(mojo, "useEclipseDefaultExcludes",
+                Boolean.TRUE);
+        setVariableValueToObject(mojo, "addLicenseHeaders", "false");
+        final Build build = new Build();
+        build.setDirectory(buildDirectory.getPath());
+        final MavenProjectStub project = new MavenProjectStub() {
+            @Override
+            public Build getBuild() {
+                return build;
+            }
+        };
+        setVariableValueToObject(mojo, "project", project);
+        assertNotNull(
+                "Problem in test setup - you are missing a project in your 
mojo.",
+                project);
+        assertNotNull(
+                "The mojo is missing its MavenProject, which will result in an 
NPE during rat runs.",
+                mojo.getProject());
+        assertNotNull(
+                "No artifactRepos found, which will result in an NPE during 
rat runs.",
+                project.getRemoteArtifactRepositories());
+
+        if (mojo instanceof RatReportMojo) {
+            setVariableValueToObject(mojo, "localRepository",
+                    newArtifactRepository(container));
+            setVariableValueToObject(mojo, "resolver", newArtifactResolver());
+            setVariableValueToObject(mojo, "factory", newArtifactFactory());
+            setVariableValueToObject(mojo, "siteRenderer",
+                    newSiteRenderer(container));
+        } else if (mojo instanceof RatCheckMojo) {
+            final File ratTxtFile = new File(buildDirectory, "rat.txt");
+            setVariableValueToObject(mojo, "reportFile", ratTxtFile);
+        }
+        return mojo;
+    }
+
+    /**
+     * Reads the location of the rat text file from the Mojo.
+     *
+     * @param pMojo
+     *            The configured Mojo.
+     * @return Value of the "reportFile" property.
+     * @throws Exception
+     *             An error occurred while reading the property.
+     */
+    private File getRatTxtFile(RatCheckMojo pMojo) throws Exception {
+        return (File) getVariableValueFromObject(pMojo, "reportFile");
+    }
+
+    /**
+     * Runs a check, which should expose no problems.
+     *
+     * @throws Exception
+     *             The test failed.
+     */
+    public void testIt1() throws Exception {
+        final RatCheckMojo mojo = newRatCheckMojo("it1");
+        final File ratTxtFile = getRatTxtFile(mojo);
+        mojo.execute();
+        ensureRatReportIsCorrect(ratTxtFile, 1, 0);
+    }
+
+    /**
+     * Runs a check, which should detect a problem.
+     *
+     * @throws Exception
+     *             The test failed.
+     */
+    public void testIt2() throws Exception {
+        final RatCheckMojo mojo = newRatCheckMojo("it2");
+        final File ratTxtFile = getRatTxtFile(mojo);
+        try {
+            mojo.execute();
+            fail("Expected RatCheckException");
+        } catch (RatCheckException e) {
+            final String msg = e.getMessage();
+            // default value is "${project.build.directory}/rat.txt"
+            final String REPORTFILE = "rat.txt";
+
+            assertTrue("report filename was not contained in '" + msg + "'",
+                    msg.contains(REPORTFILE));
+            assertFalse("no null allowed in '" + msg + "'", (msg.toUpperCase()
+                    .indexOf("NULL") > -1));
+        }
+        ensureRatReportIsCorrect(ratTxtFile, 1, 1);
+    }
+
+    private String getFirstLine(File pFile) throws IOException {
+        final FileInputStream fis = new FileInputStream(pFile);
+        final InputStreamReader reader = new InputStreamReader(fis, "UTF8");
+        final BufferedReader breader = new BufferedReader(reader);
+        final String result = breader.readLine();
+        breader.close();
+        return result;
+    }
+
+    /**
+     * Tests adding license headers.
+     */
+    public void testIt3() throws Exception {
+        final RatCheckMojo mojo = (RatCheckMojo) newRatMojo("it3", "check",
+                true);
+        setVariableValueToObject(mojo, "addLicenseHeaders", "true");
+        setVariableValueToObject(mojo, "numUnapprovedLicenses",
+                Integer.valueOf(1));
+        mojo.execute();
+        final File ratTxtFile = getRatTxtFile(mojo);
+        ensureRatReportIsCorrect(ratTxtFile, 1, 1);
+
+        final File baseDir = new File(getBasedir());
+        final File sourcesDir = new File(new File(baseDir, "target/it-source"),
+                "it3");
+        final String firstLineOrig = getFirstLine(new File(sourcesDir,
+                "src.apt"));
+        assertTrue(firstLineOrig.indexOf("--") != -1);
+        assertTrue(firstLineOrig.indexOf("~~") == -1);
+        final String firstLineModified = getFirstLine(new File(sourcesDir,
+                "src.apt.new"));
+        assertTrue(firstLineModified.indexOf("--") == -1);
+        assertTrue(firstLineModified.indexOf("~~") != -1);
+    }
 
 }

Modified: 
creadur/rat/trunk/apache-rat-plugin/src/test/java/org/apache/rat/mp/RatTestHelpers.java
URL: 
http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-plugin/src/test/java/org/apache/rat/mp/RatTestHelpers.java?rev=1617391&r1=1617390&r2=1617391&view=diff
==============================================================================
--- 
creadur/rat/trunk/apache-rat-plugin/src/test/java/org/apache/rat/mp/RatTestHelpers.java
 (original)
+++ 
creadur/rat/trunk/apache-rat-plugin/src/test/java/org/apache/rat/mp/RatTestHelpers.java
 Tue Aug 12 01:25:38 2014
@@ -45,238 +45,238 @@ import org.codehaus.plexus.util.Director
  */
 public final class RatTestHelpers {
 
-       /**
-        * @param pDir
-        *            Removes the given directory recursively.
-        * @throws IOException
-        *             in case of errors.
-        */
-       public static void remove(File pDir) throws IOException {
-               if (pDir.isFile()) {
-                       if (!pDir.delete()) {
-                               throw new IOException("Unable to delete file: " 
+ pDir);
-                       }
-               } else if (pDir.isDirectory()) {
-                       final File[] files = pDir.listFiles();
-                       for (File file : files) {
-                               remove(file);
-                       }
-                       if (!pDir.delete()) {
-                               throw new IOException("Unable to delete 
directory: " + pDir);
-                       }
-               } else if (pDir.exists()) {
-                       throw new IOException("Unable to delete unknown object 
" + pDir);
-               }
-       }
-
-       /**
-        * Copies the given files recursively in order to get all integration 
test
-        * files into a target director.
-        * 
-        * @param pSource
-        *            source files.
-        * @param pTarget
-        *            target directory
-        * @throws IOException
-        *             in case of errors.
-        */
-       public static void copy(File pSource, File pTarget) throws IOException {
-               if (pSource.isDirectory()) {
-                       if (!pTarget.isDirectory() && !pTarget.mkdirs()) {
-                               throw new IOException("Unable to create 
directory: " + pTarget);
-                       }
-                       final DirectoryScanner scanner = new DirectoryScanner();
-                       scanner.setBasedir(pSource);
-                       scanner.addDefaultExcludes();
-                       scanner.setIncludes(new String[] { "*" });
-                       scanner.scan();
-                       final String[] dirs = scanner.getIncludedDirectories();
-
-                       for (final String dir : dirs) {
-                               if (!"".equals(dir)) {
-                                       copy(new File(pSource, dir), new 
File(pTarget, dir));
-                               }
-                       }
-                       final String[] files = scanner.getIncludedFiles();
-                       for (String file : files) {
-                               copy(new File(pSource, file), new File(pTarget, 
file));
-                       }
-               } else if (pSource.isFile()) {
-                       final FileInputStream fis = new 
FileInputStream(pSource);
-                       final FileOutputStream fos = new 
FileOutputStream(pTarget);
-                       final byte[] buffer = new byte[8192];
-                       for (;;) {
-                               int res = fis.read(buffer);
-                               if (res == -1) {
-                                       break;
-                               }
-                               if (res > 0) {
-                                       fos.write(buffer, 0, res);
-                               }
-                       }
-                       fos.close();
-                       fis.close();
-               } else {
-                       throw new IOException("Unable to copy unknown object " 
+ pSource);
-               }
-       }
-
-       /**
-        * Creates a new instance of {@link Renderer}.
-        * 
-        * @param container
-        *            current plexus container.
-        * @return A configured instance of {@link DefaultRenderer}.
-        * @throws Exception
-        *             Creating the object failed.
-        */
-       public static Renderer newSiteRenderer(PlexusContainer container)
-                       throws Exception {
-               return (Renderer) container.lookup(Renderer.ROLE, "default");
-       }
-
-       /**
-        * Creates a new instance of {@link ArtifactFactory}.
-        * 
-        * @return A configured instance of {@link DefaultArtifactFactory}.
-        * @throws Exception
-        *             Creating the object failed.
-        */
-       public static ArtifactFactory newArtifactFactory() throws Exception {
-               final InvocationHandler handler = new InvocationHandler() {
-                       public Object invoke(Object pProxy, Method pMethod, 
Object[] pArgs)
-                                       throws Throwable {
-                               System.out.println("Invoking method " + 
pMethod);
-                               throw new IllegalStateException("Not 
implemented");
-                       }
-               };
-               return (ArtifactFactory) 
Proxy.newProxyInstance(Thread.currentThread()
-                               .getContextClassLoader(),
-                               new Class[] { ArtifactFactory.class }, handler);
-       }
-
-       /**
-        * Creates a new instance of {@link ArtifactResolver}.
-        * 
-        * @return A configured instance of {@link DefaultArtifactResolver}.
-        * @throws Exception
-        *             Creating the object failed.
-        */
-       public static ArtifactResolver newArtifactResolver() throws Exception {
-               final InvocationHandler handler = new InvocationHandler() {
-                       public Object invoke(Object pProxy, Method pMethod, 
Object[] pArgs)
-                                       throws Throwable {
-                               System.out.println("Invoking method " + 
pMethod);
-                               throw new IllegalStateException("Not 
implemented");
-                       }
-               };
-               return (ArtifactResolver) 
Proxy.newProxyInstance(Thread.currentThread()
-                               .getContextClassLoader(),
-                               new Class[] { ArtifactResolver.class }, 
handler);
-       }
-
-       /**
-        * Creates an instance of {@link ArtifactRepository}.
-        * 
-        * @param container
-        *            current plexus container.
-        * @return A configured instance of {@link DefaultArtifactRepository}.
-        * @throws Exception
-        *             Creating the object failed.
-        */
-       public static ArtifactRepository newArtifactRepository(
-                       PlexusContainer container) throws Exception {
-               File m2Dir = new File(System.getProperty("user.home"), ".m2");
-               File settingsFile = new File(m2Dir, "settings.xml");
-               String localRepo = null;
-               if (settingsFile.exists()) {
-                       Settings settings = new SettingsXpp3Reader().read(new 
FileReader(
-                                       settingsFile));
-                       localRepo = settings.getLocalRepository();
-               }
-               if (localRepo == null) {
-                       localRepo = System.getProperty("user.home") + 
"/.m2/repository";
-               }
-               ArtifactRepositoryLayout repositoryLayout = 
(ArtifactRepositoryLayout) container
-                               .lookup(ArtifactRepositoryLayout.ROLE, 
"default");
-               return new DefaultArtifactRepository("local", "file://" + 
localRepo,
-                               repositoryLayout);
-       }
-
-       public static File makeSourceDirectory(String mvnBaseDir, File pFile,
-                       String pDir, boolean pCreateCopy) throws IOException {
-               if (!pCreateCopy) {
-                       return pFile;
-               }
-
-               final File targetDir = new File(new File(new File(mvnBaseDir),
-                               "target/it-source"), pDir);
-               remove(targetDir);
-               copy(pFile, targetDir);
-               return targetDir;
-       }
-
-       public static File getSourceDirectory(String mvnBaseDir, String pDir,
-                       boolean pCreateCopy, final File baseDir) throws 
IOException {
-               return makeSourceDirectory(mvnBaseDir, new File(new 
File(baseDir,
-                               "src/test"), pDir), pDir, pCreateCopy);
-       }
-
-       /**
-        * Reads the created report file and verifies, whether the detected 
numbers
-        * are matching.
-        * 
-        * @param pRatTxtFile
-        *            The file to read.
-        * @param pNumALFiles
-        *            The number of files with AL.
-        * @param pNumNoLicenseFiles
-        *            The number of files without license.
-        * @throws IOException
-        *             An error occurred while reading the file or the file 
does not
-        *             exist at all.
-        * @throws IllegalArgumentException
-        *             In case of mismatches in file numbers passed in as 
parameter.
-        */
-       public static void ensureRatReportIsCorrect(File pRatTxtFile,
-                       int pNumALFiles, int pNumNoLicenseFiles) throws 
IOException {
-               if (!pRatTxtFile.exists()) {
-                       throw new FileNotFoundException("Could not find " + 
pRatTxtFile);
-               }
-
-               BufferedReader reader = new BufferedReader(new 
FileReader(pRatTxtFile));
-               Integer numALFiles = null;
-               Integer numNoLicenseFiles = null;
-               for (;;) {
-                       String line = reader.readLine();
-                       if (line == null) {
-                               break;
-                       }
-                       int offset = line.indexOf("Apache Licensed: ");
-                       if (offset >= 0) {
-                               numALFiles = new Integer(line.substring(
-                                               offset + "Apache Licensed: 
".length()).trim());
-                       }
-                       offset = line.indexOf("Unknown Licenses");
-                       if (offset >= 0) {
-                               numNoLicenseFiles = new 
Integer(line.substring(0, offset)
-                                               .trim());
-                       }
-               }
-               reader.close();
-
-               if (!new Integer(pNumALFiles).equals(numALFiles)) {
-                       throw new IllegalArgumentException(
-                                       "Amount of licensed files does not 
match. Expected "
-                                                       + pNumALFiles + ", got 
" + numALFiles);
-               }
-
-               if (!new Integer(pNumNoLicenseFiles).equals(numNoLicenseFiles)) 
{
-                       throw new IllegalArgumentException(
-                                       "Amount of licensed files does not 
match. Expected "
-                                                       + pNumALFiles + ", got 
" + numALFiles);
-               }
+    /**
+     * @param pDir
+     *            Removes the given directory recursively.
+     * @throws IOException
+     *             in case of errors.
+     */
+    public static void remove(File pDir) throws IOException {
+        if (pDir.isFile()) {
+            if (!pDir.delete()) {
+                throw new IOException("Unable to delete file: " + pDir);
+            }
+        } else if (pDir.isDirectory()) {
+            final File[] files = pDir.listFiles();
+            for (File file : files) {
+                remove(file);
+            }
+            if (!pDir.delete()) {
+                throw new IOException("Unable to delete directory: " + pDir);
+            }
+        } else if (pDir.exists()) {
+            throw new IOException("Unable to delete unknown object " + pDir);
+        }
+    }
+
+    /**
+     * Copies the given files recursively in order to get all integration test
+     * files into a target director.
+     *
+     * @param pSource
+     *            source files.
+     * @param pTarget
+     *            target directory
+     * @throws IOException
+     *             in case of errors.
+     */
+    public static void copy(File pSource, File pTarget) throws IOException {
+        if (pSource.isDirectory()) {
+            if (!pTarget.isDirectory() && !pTarget.mkdirs()) {
+                throw new IOException("Unable to create directory: " + 
pTarget);
+            }
+            final DirectoryScanner scanner = new DirectoryScanner();
+            scanner.setBasedir(pSource);
+            scanner.addDefaultExcludes();
+            scanner.setIncludes(new String[] { "*" });
+            scanner.scan();
+            final String[] dirs = scanner.getIncludedDirectories();
+
+            for (final String dir : dirs) {
+                if (!"".equals(dir)) {
+                    copy(new File(pSource, dir), new File(pTarget, dir));
+                }
+            }
+            final String[] files = scanner.getIncludedFiles();
+            for (String file : files) {
+                copy(new File(pSource, file), new File(pTarget, file));
+            }
+        } else if (pSource.isFile()) {
+            final FileInputStream fis = new FileInputStream(pSource);
+            final FileOutputStream fos = new FileOutputStream(pTarget);
+            final byte[] buffer = new byte[8192];
+            for (;;) {
+                int res = fis.read(buffer);
+                if (res == -1) {
+                    break;
+                }
+                if (res > 0) {
+                    fos.write(buffer, 0, res);
+                }
+            }
+            fos.close();
+            fis.close();
+        } else {
+            throw new IOException("Unable to copy unknown object " + pSource);
+        }
+    }
+
+    /**
+     * Creates a new instance of {@link Renderer}.
+     *
+     * @param container
+     *            current plexus container.
+     * @return A configured instance of {@link DefaultRenderer}.
+     * @throws Exception
+     *             Creating the object failed.
+     */
+    public static Renderer newSiteRenderer(PlexusContainer container)
+            throws Exception {
+        return (Renderer) container.lookup(Renderer.ROLE, "default");
+    }
+
+    /**
+     * Creates a new instance of {@link ArtifactFactory}.
+     *
+     * @return A configured instance of {@link DefaultArtifactFactory}.
+     * @throws Exception
+     *             Creating the object failed.
+     */
+    public static ArtifactFactory newArtifactFactory() throws Exception {
+        final InvocationHandler handler = new InvocationHandler() {
+            public Object invoke(Object pProxy, Method pMethod, Object[] pArgs)
+                    throws Throwable {
+                System.out.println("Invoking method " + pMethod);
+                throw new IllegalStateException("Not implemented");
+            }
+        };
+        return (ArtifactFactory) Proxy.newProxyInstance(Thread.currentThread()
+                .getContextClassLoader(),
+                new Class[] { ArtifactFactory.class }, handler);
+    }
+
+    /**
+     * Creates a new instance of {@link ArtifactResolver}.
+     *
+     * @return A configured instance of {@link DefaultArtifactResolver}.
+     * @throws Exception
+     *             Creating the object failed.
+     */
+    public static ArtifactResolver newArtifactResolver() throws Exception {
+        final InvocationHandler handler = new InvocationHandler() {
+            public Object invoke(Object pProxy, Method pMethod, Object[] pArgs)
+                    throws Throwable {
+                System.out.println("Invoking method " + pMethod);
+                throw new IllegalStateException("Not implemented");
+            }
+        };
+        return (ArtifactResolver) Proxy.newProxyInstance(Thread.currentThread()
+                .getContextClassLoader(),
+                new Class[] { ArtifactResolver.class }, handler);
+    }
+
+    /**
+     * Creates an instance of {@link ArtifactRepository}.
+     *
+     * @param container
+     *            current plexus container.
+     * @return A configured instance of {@link DefaultArtifactRepository}.
+     * @throws Exception
+     *             Creating the object failed.
+     */
+    public static ArtifactRepository newArtifactRepository(
+            PlexusContainer container) throws Exception {
+        File m2Dir = new File(System.getProperty("user.home"), ".m2");
+        File settingsFile = new File(m2Dir, "settings.xml");
+        String localRepo = null;
+        if (settingsFile.exists()) {
+            Settings settings = new SettingsXpp3Reader().read(new FileReader(
+                    settingsFile));
+            localRepo = settings.getLocalRepository();
+        }
+        if (localRepo == null) {
+            localRepo = System.getProperty("user.home") + "/.m2/repository";
+        }
+        ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) 
container
+                .lookup(ArtifactRepositoryLayout.ROLE, "default");
+        return new DefaultArtifactRepository("local", "file://" + localRepo,
+                repositoryLayout);
+    }
+
+    public static File makeSourceDirectory(String mvnBaseDir, File pFile,
+            String pDir, boolean pCreateCopy) throws IOException {
+        if (!pCreateCopy) {
+            return pFile;
+        }
+
+        final File targetDir = new File(new File(new File(mvnBaseDir),
+                "target/it-source"), pDir);
+        remove(targetDir);
+        copy(pFile, targetDir);
+        return targetDir;
+    }
+
+    public static File getSourceDirectory(String mvnBaseDir, String pDir,
+            boolean pCreateCopy, final File baseDir) throws IOException {
+        return makeSourceDirectory(mvnBaseDir, new File(new File(baseDir,
+                "src/test"), pDir), pDir, pCreateCopy);
+    }
+
+    /**
+     * Reads the created report file and verifies, whether the detected numbers
+     * are matching.
+     *
+     * @param pRatTxtFile
+     *            The file to read.
+     * @param pNumALFiles
+     *            The number of files with AL.
+     * @param pNumNoLicenseFiles
+     *            The number of files without license.
+     * @throws IOException
+     *             An error occurred while reading the file or the file does 
not
+     *             exist at all.
+     * @throws IllegalArgumentException
+     *             In case of mismatches in file numbers passed in as 
parameter.
+     */
+    public static void ensureRatReportIsCorrect(File pRatTxtFile,
+            int pNumALFiles, int pNumNoLicenseFiles) throws IOException {
+        if (!pRatTxtFile.exists()) {
+            throw new FileNotFoundException("Could not find " + pRatTxtFile);
+        }
+
+        BufferedReader reader = new BufferedReader(new 
FileReader(pRatTxtFile));
+        Integer numALFiles = null;
+        Integer numNoLicenseFiles = null;
+        for (;;) {
+            String line = reader.readLine();
+            if (line == null) {
+                break;
+            }
+            int offset = line.indexOf("Apache Licensed: ");
+            if (offset >= 0) {
+                numALFiles = new Integer(line.substring(
+                        offset + "Apache Licensed: ".length()).trim());
+            }
+            offset = line.indexOf("Unknown Licenses");
+            if (offset >= 0) {
+                numNoLicenseFiles = new Integer(line.substring(0, offset)
+                        .trim());
+            }
+        }
+        reader.close();
+
+        if (!new Integer(pNumALFiles).equals(numALFiles)) {
+            throw new IllegalArgumentException(
+                    "Amount of licensed files does not match. Expected "
+                            + pNumALFiles + ", got " + numALFiles);
+        }
+
+        if (!new Integer(pNumNoLicenseFiles).equals(numNoLicenseFiles)) {
+            throw new IllegalArgumentException(
+                    "Amount of licensed files does not match. Expected "
+                            + pNumALFiles + ", got " + numALFiles);
+        }
 
-       }
+    }
 
 }


Reply via email to