You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@creadur.apache.org by po...@apache.org on 2015/05/22 21:35:29 UTC
svn commit: r1681213 - in /creadur/rat/trunk: ./
apache-rat-core/src/main/resources/org/apache/rat/
apache-rat-core/src/test/java/org/apache/rat/
apache-rat-core/src/test/java/org/apache/rat/analysis/
apache-rat-core/src/test/java/org/apache/rat/test/u...
Author: pottlinger
Date: Fri May 22 19:35:29 2015
New Revision: 1681213
URL: http://svn.apache.org/r1681213
Log:
RAT-202: Adapt report layout to report results
* Hide paragraphs about number of unapproved files and file contents
if run was successful.
* In order to make tests run in IntellJ we need to augent the path while
loading resource (the base path seems to differ between Eclipse and IntelliJ).
* Reformated code, fixed Javadoc.
Modified:
creadur/rat/trunk/RELEASE_NOTES.txt
creadur/rat/trunk/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl
creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java
creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/AnalyserFactoryTest.java
creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java
creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
Modified: creadur/rat/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/RELEASE_NOTES.txt?rev=1681213&r1=1681212&r2=1681213&view=diff
==============================================================================
--- creadur/rat/trunk/RELEASE_NOTES.txt (original)
+++ creadur/rat/trunk/RELEASE_NOTES.txt Fri May 22 19:35:29 2015
@@ -51,6 +51,7 @@ Rat 0.12 (SNAPSHOT)
* [RAT-200] - Update to latest ASF parent pom v17.
* [RAT-201] - BinaryGuesser should treat *.swf as binary.
Furthermore BinaryGuesser falls back to UTF-8 encoding in case the encoding given via system property (-Dfile.encoding) was not found.
+ * [RAT-202] - Report layout differs between successful RAT checks and existence of unapproved files.
Rat 0.11
========
Modified: creadur/rat/trunk/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl?rev=1681213&r1=1681212&r2=1681213&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl (original)
+++ creadur/rat/trunk/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl Fri May 22 19:35:29 2015
@@ -38,8 +38,8 @@ JavaDocs are generated, thus a license h
Generated files do not require license headers.
<xsl:value-of select='count(descendant::header-type[attribute::name="?????"])'/> Unknown Licenses
-
-*******************************
+<xsl:if test="descendant::resource[license-approval/@name='false']">
+*****************************************************
Files with unapproved licenses:
@@ -49,14 +49,16 @@ Files with unapproved licenses:
<xsl:text>
</xsl:text>
</xsl:for-each>
-*******************************
-
+*****************************************************
+</xsl:if>
+<xsl:if test="descendant::resource[type/@name='archive']">
Archives:
<xsl:for-each select='descendant::resource[type/@name="archive"]'>
+ <xsl:value-of select='@name'/>
<xsl:text>
</xsl:text>
</xsl:for-each>
+</xsl:if>
*****************************************************
Files with Apache License headers will be marked AL
Binary files (which do not require any license headers) will be marked B
@@ -80,12 +82,14 @@ Archives:
</xsl:text>
</xsl:for-each>
*****************************************************
+<xsl:if test="descendant::resource[header-type/@name='?????']">
Printing headers for text files without a valid license header...
<xsl:for-each select='descendant::resource[header-type/@name="?????"]'>
-=======================================================================
+=====================================================
== File: <xsl:value-of select='@name'/>
-=======================================================================
+=====================================================
<xsl:value-of select='header-sample'/>
</xsl:for-each>
+</xsl:if>
</xsl:template>
-</xsl:stylesheet>
+</xsl:stylesheet>
\ No newline at end of file
Modified: creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java?rev=1681213&r1=1681212&r2=1681213&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java (original)
+++ creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java Fri May 22 19:35:29 2015
@@ -31,10 +31,12 @@ import static org.junit.Assert.assertTru
public class ReportTest {
private static final String NL = System.getProperty("line.separator");
+ private static final String PARAGRAPH = "*****************************************************";
+ private static final String FILE_PARAGRAPH = "=====================================================";
private static final String HEADER =
NL +
- "*****************************************************" + NL +//
+ PARAGRAPH + NL +//
"Summary" + NL +//
"-------" + NL +//
"Generated at: ";
@@ -54,20 +56,20 @@ public class ReportTest {
"" + NL +//
"2 Unknown Licenses" + NL +//
"" + NL +//
- "*******************************" + NL +//
+ PARAGRAPH + NL +//
"" + NL +//
"Files with unapproved licenses:" + NL +//
"" + NL +//
" " + pElementsPath + "/Source.java" + NL +//
" " + pElementsPath + "/sub/Empty.txt" + NL +//
"" + NL +//
- "*******************************" + NL +//
+ PARAGRAPH + NL +//
"" + NL +//
"Archives:" + NL +//
"" + NL +//
" + " + pElementsPath + "/dummy.jar" + NL +//
" " + NL +//
- "*****************************************************" + NL +//
+ PARAGRAPH + NL +//
" Files with Apache License headers will be marked AL" + NL +//
" Binary files (which do not require any license headers) will be marked B" + NL +//
" Compressed archives will be marked A" + NL +//
@@ -83,12 +85,13 @@ public class ReportTest {
" A " + pElementsPath + "/dummy.jar" + NL +//
" !????? " + pElementsPath + "/sub/Empty.txt" + NL +//
" " + NL +//
- "*****************************************************" + NL +//
+ PARAGRAPH + NL +//
+ NL +//
" Printing headers for text files without a valid license header..." + NL +//
" " + NL +//
- "=======================================================================" + NL +//
+ FILE_PARAGRAPH + NL +//
"== File: " + pElementsPath + "/Source.java" + NL +//
- "=======================================================================" + NL + //
+ FILE_PARAGRAPH + NL + //
"package elements;" + NL +//
"" + NL +//
"/*" + NL +//
@@ -99,14 +102,14 @@ public class ReportTest {
"" + NL +//
"}" + NL +//
"" + NL +//
- "=======================================================================" + NL +//
+ FILE_PARAGRAPH + NL +//
"== File: " + pElementsPath + "/sub/Empty.txt" + NL +//
- "=======================================================================" + NL +//
+ FILE_PARAGRAPH + NL +//
NL;
}
@Test
- public void plainReport() throws Exception {
+ public void plainReportWithArchivesAndUnapprovedLicenses() throws Exception {
StringWriter out = new StringWriter();
HeaderMatcherMultiplexer matcherMultiplexer = new HeaderMatcherMultiplexer(Defaults.DEFAULT_MATCHERS);
final String elementsPath = Resources.getResourceDirectory("elements/Source.java");
Modified: creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/AnalyserFactoryTest.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/AnalyserFactoryTest.java?rev=1681213&r1=1681212&r2=1681213&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/AnalyserFactoryTest.java (original)
+++ creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/AnalyserFactoryTest.java Fri May 22 19:35:29 2015
@@ -106,4 +106,9 @@ public class AnalyserFactoryTest {
reporter.report(document);
assertEquals("Open archive element", "<resource name='src/test/resources/elements/dummy.jar'><type name='archive'/>", out.toString());
}
+
+ // TODO make tests run from within IntelliJ
+ private static void equalsWithPathInfixOrNot(String messagePrefix, String expectedWithMarker, String actual) {
+ // TODO use Resources.INTELLIJ_PROJECT_PREFIXES and provide an either with/without equals to match test results
+ }
}
Modified: creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java?rev=1681213&r1=1681212&r2=1681213&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java (original)
+++ creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java Fri May 22 19:35:29 2015
@@ -29,6 +29,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
+import java.util.Arrays;
+import java.util.List;
/**
@@ -43,11 +45,13 @@ public class Resources {
// Does nothing
}
- // DevHint: needs to be prefix with apache-rat-core to work properly from within IntelliJ
+ // If started in IntelliJ the working directory is different, thus tests are not running through
+ public static final List<String> INTELLIJ_PROJECT_PREFIXES = Arrays.asList("", "apache-rat-core/" /*,"apache-rat-plugin/"*/);
+
public static final String SRC_TEST_RESOURCES = "src/test/resources";
public static final String SRC_MAIN_RESOURCES = "src/main/resources";
private static File TEST_RESOURCE_BASE_PATH = new File(SRC_TEST_RESOURCES);
- private static File RESOURCE_BASE_PATH = new File(SRC_MAIN_RESOURCES);
+ private static File RESOURCE_BASE_PATH = new File(SRC_MAIN_RESOURCES);
/**
* Locates a test resource file in the class path.
@@ -63,22 +67,46 @@ public class Resources {
return getResourceFromBase(RESOURCE_BASE_PATH, pResource);
}
+ /**
+ * Try to to load the given file from baseDir, in case of errors try to add module names to fix behaviour from within IntelliJ.
+ */
private static File getResourceFromBase(File baseDir, String pResource) throws IOException {
- final File f = new File(baseDir, pResource);
+ File f = new File(baseDir, pResource);
if (!f.isFile()) {
- throw new FileNotFoundException("Unable to locate resource file: " + pResource);
+ // try IntelliJ workaround before giving up
+ for (String prefix : INTELLIJ_PROJECT_PREFIXES) {
+ f = new File(new File(prefix + baseDir.getPath()), pResource);
+ System.out.println("Trying: " + f.getAbsolutePath());
+ if (!f.isFile()) continue;
+ }
+
+ if (!f.isFile()) {
+ throw new FileNotFoundException("Unable to locate resource file: " + pResource);
+ }
+
}
return f;
}
/**
* Locates a set of resource files in the class path.
+ * In case of errors try to add module names to fix behaviour from within IntelliJ.
*/
public static File[] getResourceFiles(String pResource) throws IOException {
- final File f = new File(TEST_RESOURCE_BASE_PATH, pResource);
+ File f = new File(TEST_RESOURCE_BASE_PATH, pResource);
if (!f.isDirectory()) {
- throw new FileNotFoundException("Unable to locate resource directory: " + f);
+ // try IntelliJ workaround before giving up
+ for (String prefix : INTELLIJ_PROJECT_PREFIXES) {
+ f = new File(new File(prefix + TEST_RESOURCE_BASE_PATH.getPath()), pResource);
+ System.out.println("Trying: " + f.getAbsolutePath());
+ if (!f.isDirectory()) continue;
+ }
+
+ if (!f.isDirectory()) {
+ throw new FileNotFoundException("Unable to locate resource directory: " + pResource);
+ }
}
+
return f.listFiles(new FileFilter() {
public boolean accept(File pathname) {
return pathname.isFile();
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=1681213&r1=1681212&r2=1681213&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 Fri May 22 19:35:29 2015
@@ -19,16 +19,6 @@ package org.apache.rat.mp;
* under the License.
*/
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Writer;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map;
-import java.util.ResourceBundle;
-
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -56,14 +46,24 @@ import org.apache.maven.reporting.MavenR
import org.apache.rat.Defaults;
import org.codehaus.doxia.sink.Sink;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
/**
* Generates a report with Rat's output.
*/
@SuppressWarnings("deprecation") // MavenReport invokes the deprecated Sink implementation
@Mojo(name = "rat", requiresDependencyResolution = ResolutionScope.TEST)
-public class RatReportMojo extends AbstractRatMojo implements MavenReport
-{
+public class RatReportMojo extends AbstractRatMojo implements MavenReport {
+ public static final String DOT_HTML = ".html";
@Component
private Renderer siteRenderer;
@@ -85,42 +85,31 @@ public class RatReportMojo extends Abstr
/**
* Returns the skins artifact file.
*
- * @throws MojoFailureException
- * An error in the plugin configuration was detected.
- * @throws MojoExecutionException
- * An error occurred while searching for the artifact file.
* @return Artifact file
+ * @throws MojoFailureException An error in the plugin configuration was detected.
+ * @throws MojoExecutionException An error occurred while searching for the artifact file.
*/
- private File getSkinArtifactFile() throws MojoFailureException, MojoExecutionException
- {
- Skin skin = Skin.getDefaultSkin();
+ private File getSkinArtifactFile() throws MojoFailureException, MojoExecutionException {
+ final Skin skin = Skin.getDefaultSkin();
String version = skin.getVersion();
- Artifact artifact;
- try
- {
- if ( version == null )
- {
+ final Artifact artifact;
+ try {
+ if (version == null) {
version = Artifact.RELEASE_VERSION;
}
- VersionRange versionSpec = VersionRange.createFromVersionSpec( version );
+ VersionRange versionSpec = VersionRange.createFromVersionSpec(version);
artifact =
- factory.createDependencyArtifact( skin.getGroupId(), skin.getArtifactId(), versionSpec, "jar", null,
- null );
+ factory.createDependencyArtifact(skin.getGroupId(), skin.getArtifactId(), versionSpec, "jar", null,
+ null);
- resolver.resolve( artifact, getProject().getRemoteArtifactRepositories(), localRepository );
- }
- catch ( InvalidVersionSpecificationException e )
- {
- throw new MojoFailureException( "The skin version '" + version + "' is not valid: " + e.getMessage() );
- }
- catch ( ArtifactResolutionException e )
- {
- throw new MojoExecutionException( "Unable to find skin", e );
- }
- catch ( ArtifactNotFoundException e )
- {
- throw new MojoFailureException( "The skin does not exist: " + e.getMessage() );
+ resolver.resolve(artifact, getProject().getRemoteArtifactRepositories(), localRepository);
+ } catch (InvalidVersionSpecificationException e) {
+ throw new MojoFailureException("The skin version '" + version + "' is not valid: " + e.getMessage());
+ } catch (ArtifactResolutionException e) {
+ throw new MojoExecutionException("Unable to find skin", e);
+ } catch (ArtifactNotFoundException e) {
+ throw new MojoFailureException("The skin does not exist: " + e.getMessage());
}
return artifact.getFile();
@@ -129,56 +118,46 @@ public class RatReportMojo extends Abstr
/**
* Called from Maven to invoke the plugin.
*
- * @throws MojoFailureException
- * An error in the plugin configuration was detected.
- * @throws MojoExecutionException
- * An error occurred while creating the report.
- */
- public void execute() throws MojoExecutionException, MojoFailureException
- {
- if(skip) {
+ * @throws MojoFailureException An error in the plugin configuration was detected.
+ * @throws MojoExecutionException An error occurred while creating the report.
+ */
+ 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;
}
- DecorationModel model = new DecorationModel();
- model.setBody( new Body() );
- Map<String, String> attributes = new HashMap<String, String>();
- attributes.put( "outputEncoding", "UTF-8" );
- Locale locale = Locale.getDefault();
- try
- {
- SiteRenderingContext siteContext =
- siteRenderer.createContextForSkin( getSkinArtifactFile(), attributes, model, getName( locale ),
- locale );
- RenderingContext context = new RenderingContext( outputDirectory, getOutputName() + ".html" );
+ final DecorationModel model = new DecorationModel();
+ model.setBody(new Body());
+ final Map<String, String> attributes = new HashMap<String, String>();
+ attributes.put("outputEncoding", "UTF-8");
+ final Locale locale = Locale.getDefault();
+ try {
+ final SiteRenderingContext siteContext =
+ siteRenderer.createContextForSkin(getSkinArtifactFile(), attributes, model, getName(locale),
+ locale);
+ final RenderingContext context = new RenderingContext(outputDirectory, getOutputName() + DOT_HTML);
- SiteRendererSink sink = new SiteRendererSink( context );
- generate( sink, locale );
+ final SiteRendererSink sink = new SiteRendererSink(context);
+ generate(sink, locale);
- if( !outputDirectory.mkdirs() && !outputDirectory.isDirectory() ) {
- throw new IOException("Could not created output directory " + outputDirectory);
+ if (!outputDirectory.mkdirs() && !outputDirectory.isDirectory()) {
+ throw new IOException("Could not create output directory " + outputDirectory);
}
- Writer writer = new FileWriter( new File( outputDirectory, getOutputName() + ".html" ) );
+ final Writer writer = new FileWriter(new File(outputDirectory, getOutputName() + DOT_HTML));
- siteRenderer.generateDocument( writer, sink, siteContext );
+ siteRenderer.generateDocument(writer, sink, siteContext);
- siteRenderer.copyResources( siteContext, new File( getProject().getBasedir(), "src/site/resources" ),
- outputDirectory );
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( e.getMessage(), e );
- }
- catch ( MavenReportException e )
- {
- throw new MojoExecutionException( e.getMessage(), e );
- }
- catch ( RendererException e )
- {
- throw new MojoExecutionException( e.getMessage(), e );
+ siteRenderer.copyResources(siteContext, new File(getProject().getBasedir(), "src/site/resources"),
+ outputDirectory);
+ } catch (IOException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ } catch (MavenReportException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ } catch (RendererException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
}
}
@@ -187,8 +166,7 @@ public class RatReportMojo extends Abstr
*
* @return Always true.
*/
- public boolean canGenerateReport()
- {
+ public boolean canGenerateReport() {
return true;
}
@@ -197,14 +175,11 @@ public class RatReportMojo extends Abstr
*
* @return Version number, if found, or null.
*/
- private String getRatVersion()
- {
- for ( @SuppressWarnings("unchecked") // library is not yet generified
- Iterator<Artifact> iter = getProject().getDependencyArtifacts().iterator(); iter.hasNext(); )
- {
+ private String getRatVersion() {
+ for (@SuppressWarnings("unchecked") // library is not yet generified
+ Iterator<Artifact> iter = getProject().getDependencyArtifacts().iterator(); iter.hasNext(); ) {
Artifact a = iter.next();
- if ( "rat-lib".equals( a.getArtifactId() ) )
- {
+ if ("rat-lib".equals(a.getArtifactId())) {
return a.getVersion();
}
}
@@ -214,21 +189,16 @@ public class RatReportMojo extends Abstr
/**
* Writes the report to the Doxia sink.
*
- *
- * @param sink
- * The doxia sink, kind of a SAX handler.
- * @param locale
- * The locale to use for writing the report.
- * @throws MavenReportException
- * Writing the report failed.
- */
- public void generate(Sink sink, Locale locale ) throws MavenReportException
- {
- ResourceBundle bundle = getBundle( locale );
- final String title = bundle.getString( "report.rat.title" );
+ * @param sink The doxia sink, kind of a SAX handler.
+ * @param locale The locale to use for writing the report.
+ * @throws MavenReportException Writing the report failed.
+ */
+ public void generate(Sink sink, Locale locale) throws MavenReportException {
+ ResourceBundle bundle = getBundle(locale);
+ final String title = bundle.getString("report.rat.title");
sink.head();
sink.title();
- sink.text( title );
+ sink.text(title);
sink.title_();
sink.head_();
@@ -236,35 +206,29 @@ public class RatReportMojo extends Abstr
sink.section1();
sink.sectionTitle1();
- sink.text( title );
+ sink.text(title);
sink.sectionTitle1_();
sink.paragraph();
- sink.text( bundle.getString( "report.rat.link" ) + " " );
- sink.link( bundle.getString( "report.rat.url" ) );
- sink.text( bundle.getString( "report.rat.fullName" ) );
+ sink.text(bundle.getString("report.rat.link") + " ");
+ sink.link(bundle.getString("report.rat.url"));
+ sink.text(bundle.getString("report.rat.fullName"));
sink.link_();
final String ratVersion = getRatVersion();
- if ( ratVersion != null )
- {
- sink.text( " " + ratVersion );
+ if (ratVersion != null) {
+ sink.text(" " + ratVersion);
}
- sink.text( "." );
+ sink.text(".");
sink.paragraph_();
sink.paragraph();
- sink.verbatim( true );
- try
- {
- sink.text( createReport( Defaults.getDefaultStyleSheet() ) );
- }
- catch ( MojoExecutionException e )
- {
- throw new MavenReportException( e.getMessage(), e );
- }
- catch ( MojoFailureException e )
- {
- throw new MavenReportException( e.getMessage(), e );
+ sink.verbatim(true);
+ try {
+ sink.text(createReport(Defaults.getDefaultStyleSheet()));
+ } catch (MojoExecutionException e) {
+ throw new MavenReportException(e.getMessage(), e);
+ } catch (MojoFailureException e) {
+ throw new MavenReportException(e.getMessage(), e);
}
sink.verbatim_();
sink.paragraph_();
@@ -277,45 +241,38 @@ public class RatReportMojo extends Abstr
*
* @return {@link MavenReport#CATEGORY_PROJECT_REPORTS}
*/
- public String getCategoryName()
- {
+ public String getCategoryName() {
return MavenReport.CATEGORY_PROJECT_REPORTS;
}
/**
* Returns the reports bundle
*
- * @param locale
- * Requested locale of the bundle
+ * @param locale Requested locale of the bundle
* @return The bundle, which is used to read localized strings.
*/
- private ResourceBundle getBundle( Locale locale )
- {
- return ResourceBundle.getBundle( "org/apache/rat/mp/rat-report", locale, getClass().getClassLoader() );
+ private ResourceBundle getBundle(Locale locale) {
+ return ResourceBundle.getBundle("org/apache/rat/mp/rat-report", locale, getClass().getClassLoader());
}
/**
* Returns the reports description.
*
- * @param locale
- * Requested locale of the bundle
+ * @param locale Requested locale of the bundle
* @return Report description, as given by the key "report.rat.description" in the bundle.
*/
- public String getDescription( Locale locale )
- {
- return getBundle( locale ).getString( "report.rat.description" );
+ public String getDescription(Locale locale) {
+ return getBundle(locale).getString("report.rat.description");
}
/**
* Returns the reports name.
*
- * @param locale
- * Requested locale of the bundle
+ * @param locale Requested locale of the bundle
* @return Report name, as given by the key "report.rat.name" in the bundle.
*/
- public String getName( Locale locale )
- {
- return getBundle( locale ).getString( "report.rat.name" );
+ public String getName(Locale locale) {
+ return getBundle(locale).getString("report.rat.name");
}
/**
@@ -323,8 +280,7 @@ public class RatReportMojo extends Abstr
*
* @return "rat-report"
*/
- public String getOutputName()
- {
+ public String getOutputName() {
return "rat-report";
}
@@ -333,8 +289,7 @@ public class RatReportMojo extends Abstr
*
* @return Value of the "outputDirectory" parameter.
*/
- public File getReportOutputDirectory()
- {
+ public File getReportOutputDirectory() {
return outputDirectory;
}
@@ -343,19 +298,16 @@ public class RatReportMojo extends Abstr
*
* @return Always false.
*/
- public boolean isExternalReport()
- {
+ public boolean isExternalReport() {
return false;
}
/**
* Sets the reports output directory.
*
- * @param pOutputDirectory
- * Reports target directory.
+ * @param pOutputDirectory Reports target directory.
*/
- public void setReportOutputDirectory( File pOutputDirectory )
- {
+ public void setReportOutputDirectory(File pOutputDirectory) {
outputDirectory = pOutputDirectory;
}
}