StringBuffer s = new StringBuffer();
for (Map.Entry<String, List<Principal>> entry : permissionPrincipals.entrySet()) {
String action = entry.getKey();
List<Principal> principals = entry.getValue();
Collections.sort(principals, new PrincipalComparator());
s.append("[{ALLOW ");
s.append(action);
s.append(" ");
for (int i = 0; i < principals.size(); i++) {
Principal principal = principals.get(i);