@Test(expected = IllegalArgumentException.class) public void testInvalidPrincipal() throws Exception { DeconstructedPrincipal.valueOf("/invalid", null); }
public static DeconstructedPrincipal valueOf(String principal, @Nullable String defaultRealm) { if (principal == null) { throw new IllegalArgumentException("The principal may not be null"); } Matcher matcher = PATTERN_PRINCIPAL.matcher(principal); if (matcher.matches()) { String primary = matcher.group(1); String instance = matcher.group(2); String realm = matcher.group(3); if ((realm == null) || realm.isEmpty()) { realm = defaultRealm; } return new DeconstructedPrincipal(primary, instance, realm); } else { throw new IllegalArgumentException(String.format("Invalid principal value: %s", principal)); } }
DeconstructedPrincipal { public static DeconstructedPrincipal valueOf(String principal, @Nullable String defaultRealm) { if (principal == null) { throw new IllegalArgumentException("The principal may not be null"); } Matcher matcher = PATTERN_PRINCIPAL.matcher(principal); if (matcher.matches()) { String primary = matcher.group(1); String instance = matcher.group(2); String realm = matcher.group(3); if ((realm == null) || realm.isEmpty()) { realm = defaultRealm; } return new DeconstructedPrincipal(primary, instance, realm); } else { throw new IllegalArgumentException(String.format("Invalid principal value: %s", principal)); } } }
DeconstructedPrincipal { public static DeconstructedPrincipal valueOf(String principal, @Nullable String defaultRealm) { if (principal == null) { throw new IllegalArgumentException("The principal may not be null"); } Matcher matcher = PATTERN_PRINCIPAL.matcher(principal); if (matcher.matches()) { String primary = matcher.group(1); String instance = matcher.group(2); String realm = matcher.group(3); if ((realm == null) || realm.isEmpty()) { realm = defaultRealm; } return new DeconstructedPrincipal(primary, instance, realm); } else { throw new IllegalArgumentException(String.format("Invalid principal value: %s", principal)); } } protected  DeconstructedPrincipal(String primary, String instance, String realm); }
DeconstructedPrincipal { public static DeconstructedPrincipal valueOf(String principal, @Nullable String defaultRealm) { if (principal == null) { throw new IllegalArgumentException("The principal may not be null"); } Matcher matcher = PATTERN_PRINCIPAL.matcher(principal); if (matcher.matches()) { String primary = matcher.group(1); String instance = matcher.group(2); String realm = matcher.group(3); if ((realm == null) || realm.isEmpty()) { realm = defaultRealm; } return new DeconstructedPrincipal(primary, instance, realm); } else { throw new IllegalArgumentException(String.format("Invalid principal value: %s", principal)); } } protected  DeconstructedPrincipal(String primary, String instance, String realm); static DeconstructedPrincipal valueOf(String principal, @Nullable String defaultRealm); String getPrimary(); String getInstance(); String getRealm(); String getPrincipalName(); String getNormalizedPrincipal(); }
DeconstructedPrincipal { public static DeconstructedPrincipal valueOf(String principal, @Nullable String defaultRealm) { if (principal == null) { throw new IllegalArgumentException("The principal may not be null"); } Matcher matcher = PATTERN_PRINCIPAL.matcher(principal); if (matcher.matches()) { String primary = matcher.group(1); String instance = matcher.group(2); String realm = matcher.group(3); if ((realm == null) || realm.isEmpty()) { realm = defaultRealm; } return new DeconstructedPrincipal(primary, instance, realm); } else { throw new IllegalArgumentException(String.format("Invalid principal value: %s", principal)); } } protected  DeconstructedPrincipal(String primary, String instance, String realm); static DeconstructedPrincipal valueOf(String principal, @Nullable String defaultRealm); String getPrimary(); String getInstance(); String getRealm(); String getPrincipalName(); String getNormalizedPrincipal();  }