try {
Class cls = Class.forName(type);
PrincipalCollection principals = getSubject().getPrincipals();
if (principals != null) {
principal = principals.oneByType(cls);
}
} catch (ClassNotFoundException e) {
if (log.isErrorEnabled()) {
log.error("Unable to find class for name [" + type + "]");
}