associations.put(realm, (String[]) bases.toArray(new String[] {}));
associations.put(realm, bases.toArray(new String[] {}));
    public final void addAssociation(final String realm, final String base, final String username, final String password) {        // Sanity checks.        if (realm == null)            throw new IllegalArgumentException("Realm cannot be NULL");        if (base == null)            throw new IllegalArgumentException("Base cannot be NULL");        if (username == null)            throw new IllegalArgumentException("Username cannot be NULL");        if (password == null)            throw new IllegalArgumentException("Password cannot be NULL");        // New association or updating an existing?        if (associations.containsKey(realm)) {            // Update existing association.            ArrayList bases = new ArrayList(Arrays.asList((String[]) associations.get(realm)));            bases.add(base);            associations.put(realm, (String[]) bases.toArray(new String[] {}));        } else {            // Create new association.            associations.put(realm, new String[] {base});        }        // Add credentials.        usernames.put(base, username);        passwords.put(base, password);    }