in src/main/java/org/apache/maven/plugins/changes/ChangesCheckMojo.java [140:191]
protected static boolean isValidDate( String string, String pattern, String locale )
{
if ( StringUtils.isEmpty( string ) )
{
return false;
}
if ( StringUtils.isEmpty( pattern ) )
{
return false;
}
try
{
Locale usedLocale = null;
if ( StringUtils.isEmpty( locale ) )
{
// No locale specified, use the default locale as default value
// The same behavior as before the locale parameter was added
usedLocale = Locale.getDefault();
}
else
{
// Try to find the specified locale on this system
Locale[] locales = Locale.getAvailableLocales();
for ( Locale value : locales )
{
if ( value.toString().equals( locale ) )
{
usedLocale = value;
break;
}
}
if ( usedLocale == null )
{
// The use specified locale was not found on this system,
// use the default locale as default value
usedLocale = Locale.getDefault();
}
}
SimpleDateFormat df = new SimpleDateFormat( pattern, usedLocale );
df.parse( string );
return true;
}
catch ( ParseException e )
{
return false;
}
}