throws EnforcerRuleException
{
if ( !allowNulls && files.length == 0 )
{
throw new EnforcerRuleException( "The file list is empty and Null files are disabled." );
}
List<File> failures = new ArrayList<File>();
for ( File file : files )
{
if ( !allowNulls && file == null )
{
failures.add( file );
}
else if ( !checkFile( file ) )
{
failures.add( file );
}
}
// if anything was found, log it with the optional message.
if ( !failures.isEmpty() )
{
StringBuilder buf = new StringBuilder();
if ( message != null )
{
buf.append( message + "\n" );
}
buf.append( getErrorMsg() );
for ( File file : failures )
{
if ( file != null )
{
buf.append( file.getAbsolutePath() + "\n" );
}
else
{
buf.append( "(an empty filename was given and allowNulls is false)\n" );
}
}
throw new EnforcerRuleException( buf.toString() );
}
}