code: private static Identity applyRules(final Identity identity) {
          if (!identity.equals(Identity.ANONYMOUS)) {
              final String urn = identity.urn();
              if (urn.isEmpty()) {
                  throw new DecodingException("urn is empty");
              }
              if (!CcStrict.PTN.matcher(urn).matches()) {
                  throw new DecodingException(
                      String.format("urn isn't valid: \"%s\"", urn)
                  );
              }
          }
          return identity;
      }
docs: Apply validation rules to identity.
  @param identity Identity
  @return Identity