newReferences.add(new IndexedReference((String[]) gatheredAssociations, (String[]) gatheredUsernames.toArray(new String[] {}), (String[]) gatheredPasswords.toArray(new String[] {}), false));
newReferences.add(new IndexedReference(gatheredAssociations, (String[]) gatheredUsernames.toArray(new String[] {}), (String[]) gatheredPasswords.toArray(new String[] {}), false));
    public final IndexedReference[] getReferences(final String id) {        // Sanity check.        if (id == null)            return null;        ArrayList newReferences = new ArrayList();        // Do we have an explicit match? That is, an exception from the        // association rule?        if (exceptions.containsKey(id))            newReferences.add(new IndexedReference(new String[] {(String) exceptions.get(id)}, new String[] {""}, new String[] {""}, true));        // Extract the realm, with sanity check.        int i = id.lastIndexOf('@');        if ((i > 0) && (associations.containsKey(id.substring(i + 1)))) {                     // Gather associations, usernames and passwords.            String[] gatheredAssociations = (String[]) associations.get(id.substring(i + 1));            ArrayList gatheredUsernames = new ArrayList(gatheredAssociations.length);            ArrayList gatheredPasswords = new ArrayList(gatheredAssociations.length);            for (int j=0; j<gatheredAssociations.length; j++) {                gatheredUsernames.add(usernames.get(gatheredAssociations[j]));                gatheredPasswords.add(passwords.get(gatheredAssociations[j]));            }            newReferences.add(new IndexedReference((String[]) gatheredAssociations, (String[]) gatheredUsernames.toArray(new String[] {}), (String[]) gatheredPasswords.toArray(new String[] {}), false));        }        // Did we find any references?        if (newReferences.size() == 0)            return null;        else            return (IndexedReference[]) newReferences.toArray(new IndexedReference[] {});    }