archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/DefaultRepositoryCommonValidator.java
/**
     * validate cronExpression and location format
     *
     * @param managedRepository
     * @since 1.4-M2
     */
validate cronExpression and location format
@param managedRepository
@since 1.4-M2
validate cronExpression and location format @param managedRepository @since 1 . 4 - M2
@Override
    public void validateManagedRepository( ManagedRepository managedRepository )
        throws RepositoryAdminException
    {
        String cronExpression = managedRepository.getCronExpression( );
        if ( StringUtils.isNotBlank( cronExpression ) )
        {
            CronExpressionValidator validator = new CronExpressionValidator( );
            if ( !validator.validate( cronExpression ) )
            {
                throw new RepositoryAdminException( "Invalid cron expression.", "cronExpression" );
            }
        }
        else
        {
            throw new RepositoryAdminException( "Cron expression cannot be empty." );
        }
        String repoLocation = removeExpressions( managedRepository.getLocation( ) );
        if ( !REPOSITORY_LOCATION_VALID_EXPRESSION_PATTERN.matcher( repoLocation ).matches() )
        {
            throw new RepositoryAdminException(
                "Invalid repository location. Directory must only contain alphanumeric characters, equals(=), question-marks(?), "
                    + "exclamation-points(!), ampersands(&amp;), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-).",
                "location" );
        }
    }
@ Override public void validateManagedRepository ( ManagedRepository managedRepository ) throws RepositoryAdminException { String cronExpression = managedRepository . getCronExpression ( ) ; if ( StringUtils . isNotBlank ( cronExpression ) ) { CronExpressionValidator validator = new CronExpressionValidator ( ) ; if ( ! validator . validate ( cronExpression ) ) { throw new RepositoryAdminException ( "Invalid cron expression." , "cronExpression" ) ; } } else { throw new RepositoryAdminException ( "Cron expression cannot be empty." ) ; } String repoLocation = removeExpressions ( managedRepository . getLocation ( ) ) ; if ( ! REPOSITORY_LOCATION_VALID_EXPRESSION_PATTERN . matcher ( repoLocation ) . matches ( ) ) { throw new RepositoryAdminException ( "Invalid repository location. Directory must only contain alphanumeric characters, equals(=), question-marks(?), " + "exclamation-points(!), ampersands(&amp;), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-)." , "location" ) ; } }
validate cronExpression and location format
 @param managedRepository
 @since 1.4-M2
validate cronExpression and location format @param managedRepository @since 1 . 4 - M2
// FIXME : olamy can be empty to avoid scheduled scan ?