Skip to content
Browse files

RAT-127 applied https://issues.apache.org/jira/browse/RAT-127. Many t…

…hanks to Bernd Eckenfels for his contribution.

git-svn-id: https://svn.apache.org/repos/asf/creadur/rat/trunk@1450389 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 990e0b9 commit f387adb2a02f3d13178ac86b0d4982a160a6cabe @itstechupnorth itstechupnorth committed Feb 26, 2013
View
9 apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
@@ -174,20 +174,19 @@ public void execute() throws MojoExecutionException, MojoFailureException
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()
View
19 apache-rat-plugin/src/test/java/org/apache/rat/mp/RatCheckMojoTest.java
@@ -391,4 +391,23 @@ public void testIt3() throws Exception {
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));
+ }
+ }
}

0 comments on commit f387adb

Please sign in to comment.
Something went wrong with that request. Please try again.