Raise an error if a server in the priority list is undefined

This commit is contained in:
Tux 2016-03-06 00:05:25 -05:00 committed by md_5
parent 8b327708ee
commit 52d66897e4

View File

@ -115,8 +115,11 @@ public class Configuration implements ProxyConfig
for ( ListenerInfo listener : listeners ) for ( ListenerInfo listener : listeners )
{ {
Preconditions.checkArgument( servers.containsKey( listener.getDefaultServer() ), "Default server %s is not defined", listener.getDefaultServer() ); for ( int i = 0; i < listener.getServerPriority().size(); i++ )
Preconditions.checkArgument( servers.containsKey( listener.getFallbackServer() ), "Fallback server %s is not defined", listener.getFallbackServer() ); {
String server = listener.getServerPriority().get( i );
Preconditions.checkArgument( servers.containsKey( server ), "Server %s (priority %s) is not defined", server, i );
}
for ( String server : listener.getForcedHosts().values() ) for ( String server : listener.getForcedHosts().values() )
{ {
if ( !servers.containsKey( server ) ) if ( !servers.containsKey( server ) )