for (int j = 0; j < realms.length; j++) {
RealmType realm = realms[j];
PrincipalType[] principals = realm.getPrincipalArray();
HashSet set = new HashSet();
for (int k = 0; k < principals.length; k++) {
PrincipalType principal = principals[k];
java.security.Principal p = null;
try {
Class clazz = Class.forName(principal.getClass1());
Constructor constructor = clazz.getDeclaredConstructor(new Class[]{String.class});
p = (java.security.Principal) constructor.newInstance(new Object[]{principal.getName()});
set.add(new RealmPrincipal(realm.getRealmName(), p));
} catch (InstantiationException e) {
throw new GeronimoSecurityException(e);
} catch (IllegalAccessException e) {
throw new GeronimoSecurityException(e);