creadur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r1450389 - in /creadur/rat/trunk/apache-rat-plugin/src: main/java/org/apache/rat/mp/RatCheckMojo.java test/java/org/apache/rat/mp/RatCheckMojoTest.java
Date Tue, 26 Feb 2013 20:16:12 GMT
Author: rdonkin
Date: Tue Feb 26 20:16:11 2013
New Revision: 1450389

URL: http://svn.apache.org/r1450389
Log:
RAT-127 applied https://issues.apache.org/jira/browse/RAT-127. Many thanks to Bernd Eckenfels
for his contribution.

Modified:
    creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
    creadur/rat/trunk/apache-rat-plugin/src/test/java/org/apache/rat/mp/RatCheckMojoTest.java

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=1450389&r1=1450388&r2=1450389&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 Feb 26 20:16:11 2013
@@ -174,20 +174,19 @@ public class RatCheckMojo extends Abstra
     protected void check( ClaimStatistic statistics )
         throws MojoFailureException
     {
+        getLog().info("Rat check: Summary of files. Unapproved: " + statistics.getNumUnApproved()
+ " unknown: " + statistics.getNumUnknown() + " generated: " + statistics.getNumGenerated()
+ " approved: " + statistics.getNumApproved() + " licence.");
         if ( numUnapprovedLicenses < statistics.getNumUnApproved() )
         {
+            final String seeReport = " See RAT report in: " + reportFile;
             if ( !ignoreErrors )
             {
-                throw new RatCheckException( "Too many unapproved licenses: " + statistics.getNumUnApproved()
);
+                throw new RatCheckException( "Too many files with unapproved license: " +
statistics.getNumUnApproved() + seeReport);
             }
             else
             {
-                getLog().warn( "Rat check:" + statistics.getNumUnApproved() + " errors on
non approved has been ignored." );
+                getLog().warn( "Rat check: " + statistics.getNumUnApproved() + " files with
unaproved licenses." + seeReport);
             }
-
         }
-
-
     }
 
     protected ReportConfiguration getConfiguration()

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=1450389&r1=1450388&r2=1450389&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 Feb 26 20:16:11 2013
@@ -391,4 +391,23 @@ public class RatCheckMojoTest extends Ab
         assertTrue(firstLineModified.indexOf("--") == -1);
         assertTrue(firstLineModified.indexOf("~~") != -1);
     }
+
+    /**
+     * Verify it2 exception message contains report file name (RAT-127).
+     */
+    public void testIt4() throws Exception {
+        final RatCheckMojo mojo = newRatCheckMojo( "it2" );
+        try
+        {
+            mojo.execute();
+            fail( "Expected RatCheckException" );
+        }
+        catch ( RatCheckException e )
+        {
+            final String msg = e.getMessage();
+            final String REPORTFILE = "rat.txt"; // Default: defaultValue = "${project.build.directory}/rat.txt"
+            assertTrue("report filename was not contained in '" + msg +"'", (msg.indexOf(REPORTFILE)
> -1));
+            assertFalse("no null allowed in '" + msg +"'", (msg.toUpperCase().indexOf("NULL")
> -1));
+        }
+    }
 }



Mime
View raw message