code: private ParsedPrincipal parsePrincipal() throws Exception {
          lookahead = st.nextToken();
          switch (lookahead) {
              case '*':
                  lookahead = st.nextToken();
                  if (lookahead == '*') {
                      return new ParsedPrincipal(null, null);
                  } else {
                      throw new Exception("ER018: There have to be name wildcard after type wildcard.");
                  }
              case '\"':
                  return new ParsedPrincipal(st.sval);
              case StreamTokenizer.TT_WORD:
                  String principalClass = st.sval;
                  lookahead = st.nextToken();
                  switch (lookahead) {
                      case '*':
                          return new ParsedPrincipal(principalClass, null);
                      case '\"':
                          return new ParsedPrincipal(principalClass, st.sval);
                      default:
                          throw new Exception("ER019: Principal name or * expected.");
                  }
              default:
                  throw new Exception("ER020: Principal type, *, or keystore alias expected.");
          }
      }
docs: Private method for parsing principal part of policy entry.
  
  @return parsed principal part of policy entry
  @throws throws Exception when any problem occurred during parsing principal