alright, will back out.
Fabrizio Giustina wrote:
Hi John,
this is not needed, the issue has already been fixed some time ago.
Take a look at the comments in
http://jira.codehaus.org/browse/MNG-1216 for the solution, the fix has
been committed in rev 326881
http://svn.apache.org/viewcvs.cgi?rev=326881&view=rev
fabrizio
On 11/29/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Author: jdcasey
Date: Mon Nov 28 21:13:22 2005
New Revision: 349651
URL: http://svn.apache.org/viewcvs?rev=349651&view=rev
Log:
PR: MNG-1579
Submitted By: John Casey
Added try/catch to a new wrapper method for getBundle(..) that will report
failure to retrieve the ResourceBundle for a given locale, and default over to
usage of Locale.ENGLISH where necessary. Changed all references to
getBundle(..) to this new method.
Modified:
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
Modified:
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java?rev=349651&r1=349650&r2=349651&view=diff
==============================================================================
---
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
(original)
+++
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
Mon Nov 28 21:13:22 2005
@@ -28,6 +28,7 @@
import com.puppycrawl.tools.checkstyle.api.Configuration;
import com.puppycrawl.tools.checkstyle.api.FilterSet;
import com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader;
+
import org.apache.maven.project.MavenProject;
import org.apache.maven.reporting.AbstractMavenReport;
import org.apache.maven.reporting.MavenReportException;
@@ -46,6 +47,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.MissingResourceException;
import java.util.Properties;
import java.util.ResourceBundle;
@@ -198,7 +200,7 @@
*/
public String getName( Locale locale )
{
- return getBundle( locale ).getString( "report.checkstyle.name" );
+ return getBundleWithDefaultLocale( locale ).getString(
"report.checkstyle.name" );
}
/**
@@ -206,7 +208,7 @@
*/
public String getDescription( Locale locale )
{
- return getBundle( locale ).getString( "report.checkstyle.description"
);
+ return getBundleWithDefaultLocale( locale ).getString(
"report.checkstyle.description" );
}
/**
@@ -247,9 +249,29 @@
Map files = executeCheckstyle();
- CheckstyleReportGenerator generator = new CheckstyleReportGenerator(
getSink(), getBundle( locale ) );
+ CheckstyleReportGenerator generator = new CheckstyleReportGenerator(
getSink(), getBundleWithDefaultLocale( locale ) );
generator.generateReport( files );
+ }
+
+ private ResourceBundle getBundleWithDefaultLocale( Locale locale )
+ {
+ ResourceBundle bundle;
+ try
+ {
+ bundle = getBundle( locale );
+ }
+ catch ( MissingResourceException e )
+ {
+ Locale defaultLocale = Locale.ENGLISH;
+
+ getLog().warn( "Cannot find checkstyle message bundle for locale: " +
locale.getDisplayName() + ". Using default: " + defaultLocale.getDisplayName() + "
instead." );
+ getLog().debug( "Error locating message bundle.", e );
+
+ bundle = getBundle( defaultLocale );
+ }
+
+ return bundle;
}
private Map executeCheckstyle()
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]