{
if ( info.alias().empty() )
ZYPP_THROW( RepoNoAliasException() );
+ // bnc #473834. Maybe we can match the alias against a regex to define
+ // and check for valid aliases
+ if ( info.alias()[0] == '.')
+ ZYPP_THROW(RepoInvalidAliasException(
+ info, _("Repository alias cannot start with dot.")));
}
inline void assert_alias( const ServiceInfo & info )
{
if ( info.alias().empty() )
ZYPP_THROW( ServiceNoAliasException() );
+ // bnc #473834. Maybe we can match the alias against a regex to define
+ // and check for valid aliases
+ if ( info.alias()[0] == '.')
+ ZYPP_THROW(ServiceInvalidAliasException(
+ info, _("Service alias cannot start with dot.")));
}
////////////////////////////////////////////////////////////////////////////
DEF_CTORS( RepoNotCachedException, "Repository is not cached" );
DEF_CTORS( RepoNoUrlException, "Repository has no or invalid url defined." );
DEF_CTORS( RepoNoAliasException, "Repository has no alias defined." );
+ DEF_CTORS( RepoInvalidAliasException, "Repository has an invalid alias." );
DEF_CTORS( RepoNotFoundException, "Repository not found." );
DEF_CTORS( RepoAlreadyExistsException, "Repository already exists." );
DEF_CTORS( RepoUnknownTypeException, "Repository type can't be determined." );
CLASS::CLASS( const ServiceInfo & service_r, const std::string & msg_r ) : ServiceException( service_r, msg_r ) {}
DEF_CTORS( ServiceNoAliasException, "Service has no alias defined." );
+ DEF_CTORS( ServiceInvalidAliasException, "Service has an invalid alias." );
DEF_CTORS( ServiceAlreadyExistsException, "Service already exists." );
DEF_CTORS( ServiceNoUrlException, "Service has no or invalid url defined." );
};
/**
+ * Thrown when the repo alias is found to be invalid.
+ */
+ class RepoInvalidAliasException : public RepoException
+ {
+ public:
+ RepoInvalidAliasException();
+ RepoInvalidAliasException( const std::string & msg_r );
+ RepoInvalidAliasException( const RepoInfo & info );
+ RepoInvalidAliasException( const RepoInfo & info, const std::string & msg_r );
+ };
+
+ /**
* thrown when it was impossible to
* match a repository
*/
ServiceNoAliasException( const ServiceInfo & service_r, const std::string & msg_r );
};
+ /**
+ * Thrown when the repo alias is found to be invalid.
+ */
+ class ServiceInvalidAliasException : public ServiceException
+ {
+ public:
+ ServiceInvalidAliasException();
+ ServiceInvalidAliasException( const std::string & msg_r );
+ ServiceInvalidAliasException( const ServiceInfo & info );
+ ServiceInvalidAliasException( const ServiceInfo & info, const std::string & msg_r );
+ };
+
/** Service already exists and some unique attribute can't be duplicated.
*/
class ServiceAlreadyExistsException : public ServiceException