docs: public static void handleGroupPrincipalCallback(GroupPrincipalCallback callback, Subject executionSubject, Hashtable<String, Object> addedCred, String appRealm,
                                                      Invocation[] invocations)
                      throws RemoteException, WSSecurityException {
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
              Tr.entry(tc, "handleGroupPrincipalCallback", objectId(callback));
          }
          invocations[1] = Invocation.GROUPPRINCIPALCALLBACK;
  
          Subject callSubject = callback.getSubject();
          if (!executionSubject.equals(callSubject)) {
              Tr.warning(tc, "EXECUTION_CALLBACK_SUBJECT_MISMATCH_J2CA0673", new Object[] { "GroupPrincipalCallback" });
              // callSubject = executionSubject; // Change from twas - jms - TODO - Not used, may need to look at this some more.
          }
          String[] groups = callback.getGroups();
          if (groups != null && groups.length > 0) {
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                  Tr.debug(tc, "Group names in Callback: ", Arrays.asList(groups));
              }
              List<String> groupNames = (List<String>) addedCred.get(AttributeNameConstants.WSCREDENTIAL_GROUPS);
              if (groupNames == null) {
                  groupNames = new ArrayList<String>();
                  addedCred.put(AttributeNameConstants.WSCREDENTIAL_GROUPS, groupNames);
              }
              GetRegistry action = new GetRegistry(appRealm);
              UserRegistry registry = null;
              try {
                  registry = AccessController.doPrivileged(action);
              } catch (PrivilegedActionException pae) {
                  Exception ex = pae.getException();
                  if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
                      Tr.exit(tc, "handleGroupPrincipalCallback");
                  }
                  if (ex instanceof WSSecurityException) {
                      throw (WSSecurityException) ex;
                  } else { // This means an unexpected runtime exception is wrapped in the PrivilegedActionException
                      throw new WSSecurityException(ex);
                  }
              }
              for (int i = 0; i < groups.length; i++) {
                  String group = groups[i];
                  if (group == null || group.isEmpty()) {
                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                          Tr.debug(tc, "Group is null or an empty string, it has been ignored.");
                      }
                      continue;
                  }
                  if (registry.isValidGroup(group)) {
                      String groupName = registry.getUniqueGroupId(group);
                      if (!groupNames.contains(groupName)) {
                          groupNames.add(groupName);
                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                              Tr.debug(tc, "Added groupId: " + groupName);
                          }
                      } else {
                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                              Tr.debug(tc, groupName + " already exists in custom credential data, avoid duplicates.");
                          }
                      }
                  } else {
                      Tr.warning(tc, "INVALID_GROUP_ENCOUNTERED_J2CA0678", group);
                  }
              }
  
          } else {
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                  Tr.debug(tc, "Callback has no groups.");
              }
          }
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
              Tr.debug(tc, "Added Credentials", addedCred);
          }
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
              Tr.exit(tc, "handleGroupPrincipalCallback");
          }
      }