private static Principal resolvePrincipal(String groupName,
      String className) {
    Exception e = null;
    try {
      Class clazz = Class.forName(className);
      if (Principal.class.isAssignableFrom(clazz)) {
        Constructor c = clazz.getConstructor(STR_ARG);

        return (Principal) c
            .newInstance(new Object[] { groupName });
      }
    } catch (ClassNotFoundException ex) {
      e = ex;
    } catch (SecurityException ex) {
      e = ex;
    } catch (NoSuchMethodException ex) {
      e = ex;
    } catch (IllegalArgumentException ex) {
      e = ex;
    } catch (InstantiationException ex) {
      e = ex;
    } catch (IllegalAccessException ex) {
      e = ex;
    } catch (InvocationTargetException ex) {
      e = ex;
    }
    // Log exception
    return null;
  }