for ( Iterator peer = peerReplicas.iterator(); peer.hasNext(); )
for ( Iterator<Replica> peer = peerReplicas.iterator(); peer.hasNext(); )
    public void validate() throws ReplicationConfigurationException    {        if ( replicaId == null )        {            log.error( "The replicaId is missing" );            throw new ReplicationConfigurationException( "Replica ID is not specified." );        }                if ( serverPort < 0 || serverPort > 65535 )        {            log.error( "The replica port is not between 0 and 65535" );            throw new ReplicationConfigurationException( "Server port is invalid: " + serverPort );        }                if ( responseTimeout <= 0 )        {            log.error( "The replica responsetimeout is negative" );            throw new ReplicationConfigurationException( "Invalid response timeout: " + responseTimeout );        }                if( uuidFactory == null )        {            log.error( "The UUID factory has not been declared" );            throw new ReplicationConfigurationException( "UUID factory is not specified." );        }                if( csnFactory == null )        {            log.error( "The CSN factory has not been declared" );            throw new ReplicationConfigurationException( "CSN factory is not specified." );        }                if( store == null )        {            log.error( "The store has not been declared" );            throw new ReplicationConfigurationException( "Replication store is not specified." );        }                if( peerReplicas.size() == 0 )        {            log.error( "The replicas peer list is empty" );            throw new ReplicationConfigurationException( "No peer replicas" );        }                // Check the peer replicas.        // We should check that no replica has the same Id, and that we don't        // have two replicas on the same server with the same port        Set ids = new TreeSet();        Map servers = new HashMap();                  // Initialize the set with this server replicaId        ids.add( replicaId.getId() );                // And store the local inetadress        Integer localPort = new Integer( serverPort );        servers.put( "localhost", localPort );        servers.put( "127.0.0.1", localPort );                try        {            servers.put( StringTools.lowerCase( InetAddress.getByName( "127.0.0.1" ).getHostName() ) , localPort );        }        catch ( UnknownHostException uhe )        {            // Should never occurs with 127.0.0.1            throw new ReplicationConfigurationException( "Unknown host name" );        }                for ( Iterator peer = peerReplicas.iterator(); peer.hasNext(); )        {            Replica replica = ( Replica ) peer.next();                        if ( ids.contains( replica.getId().getId() ) )             {                log.error( "Peer replica ID '{}' has already been declared.", replica.getId() );                throw new ReplicationConfigurationException( "Peer replica ID '" + replica.getId() + "' has already been declared." );            }                        // Now check that we don't already have a replica on a server with the same port             String replicaServer = StringTools.lowerCase( replica.getAddress().getHostName() );            Integer replicaPort = new Integer( replica.getAddress().getPort() );                        if ( servers.containsKey( replicaServer ) )            {                Integer peerPort = ((Integer)servers.get( replicaServer ) );                                if ( replicaPort == peerPort )                {                    log.error( "The replica in the peer list has already been declared on the server {} with the port {}", replicaServer, peerPort );                    throw new ReplicationConfigurationException( "Replication store is not specified." );                }            }                        servers.put( replicaServer, replicaPort );        }    }