Skip to content

Commit

Permalink
CLEANUP: Fixes typos, object construction using reflection, Collectio…
Browse files Browse the repository at this point in the history
…n use, missing annotations, etc (#1152)

* code cleanup

* more typos
  • Loading branch information
mmoayyed authored and leleuj committed Jun 27, 2018
1 parent efe30e4 commit a206f33
Show file tree
Hide file tree
Showing 33 changed files with 57 additions and 45 deletions.
@@ -1,8 +1,6 @@
package org.pac4j.cas.profile; package org.pac4j.cas.profile;


import org.jasig.cas.client.authentication.AttributePrincipal; import org.jasig.cas.client.authentication.AttributePrincipal;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/** /**
* <p>This class is the user profile for sites using CAS protocol with proxy capabilities.</p> * <p>This class is the user profile for sites using CAS protocol with proxy capabilities.</p>
Expand All @@ -19,8 +17,6 @@ public class CasProxyProfile extends CasProfile {


private static final long serialVersionUID = 4956675835922254493L; private static final long serialVersionUID = 4956675835922254493L;


protected final Logger logger = LoggerFactory.getLogger(getClass());

protected AttributePrincipal attributePrincipal = null; protected AttributePrincipal attributePrincipal = null;


/** /**
Expand Down
Expand Up @@ -161,7 +161,7 @@ public void testBackLogout() {
.addRequestParameter(CasConfiguration.LOGOUT_REQUEST_PARAMETER, LOGOUT_MESSAGE) .addRequestParameter(CasConfiguration.LOGOUT_REQUEST_PARAMETER, LOGOUT_MESSAGE)
.setRequestMethod(HTTP_METHOD.POST.name()); .setRequestMethod(HTTP_METHOD.POST.name());
TestsHelper.expectException(() -> casClient.getCredentials(context), HttpAction.class, TestsHelper.expectException(() -> casClient.getCredentials(context), HttpAction.class,
"Perfoming a 204 HTTP action"); "Performing a 204 HTTP action");
assertEquals(204, context.getResponseStatus()); assertEquals(204, context.getResponseStatus());
} }


Expand Down
Expand Up @@ -51,7 +51,7 @@ public void testMissingPgtiou() {
final MockWebContext context = MockWebContext.create(); final MockWebContext context = MockWebContext.create();
TestsHelper.expectException(() -> client.getCredentials(context TestsHelper.expectException(() -> client.getCredentials(context
.addRequestParameter(CasProxyReceptor.PARAM_PROXY_GRANTING_TICKET_IOU, VALUE)), HttpAction.class, .addRequestParameter(CasProxyReceptor.PARAM_PROXY_GRANTING_TICKET_IOU, VALUE)), HttpAction.class,
"Perfoming a 200 HTTP action"); "Performing a 200 HTTP action");
assertEquals(200, context.getResponseStatus()); assertEquals(200, context.getResponseStatus());
assertEquals("", context.getResponseContent()); assertEquals("", context.getResponseContent());
} }
Expand All @@ -64,8 +64,8 @@ public void testOk() {
.addRequestParameter(CasProxyReceptor.PARAM_PROXY_GRANTING_TICKET, VALUE) .addRequestParameter(CasProxyReceptor.PARAM_PROXY_GRANTING_TICKET, VALUE)
.addRequestParameter(CasProxyReceptor.PARAM_PROXY_GRANTING_TICKET_IOU, VALUE); .addRequestParameter(CasProxyReceptor.PARAM_PROXY_GRANTING_TICKET_IOU, VALUE);
TestsHelper.expectException(() -> client.getCredentials(context), HttpAction.class, TestsHelper.expectException(() -> client.getCredentials(context), HttpAction.class,
"Perfoming a 200 HTTP action"); "Performing a 200 HTTP action");
assertEquals(200, context.getResponseStatus()); assertEquals(200, context.getResponseStatus());
assertTrue(context.getResponseContent().length() > 0); assertFalse(context.getResponseContent().isEmpty());
} }
} }
Expand Up @@ -33,6 +33,7 @@ public PropertiesConfigFactory(final String callbackUrl, final Map<String, Strin
this.callbackUrl = callbackUrl; this.callbackUrl = callbackUrl;
} }


@Override
public Config build(final Object... parameters) { public Config build(final Object... parameters) {


final List<Client> clients = new ArrayList<>(); final List<Client> clients = new ArrayList<>();
Expand Down
Expand Up @@ -264,7 +264,7 @@ public static DefaultConnectionFactory newConnectionFactory(final AbstractLdapPr
if (l.getProviderClass() != null) { if (l.getProviderClass() != null) {
try { try {
final Class clazz = ClassUtils.getClass(l.getProviderClass()); final Class clazz = ClassUtils.getClass(l.getProviderClass());
bindCf.setProvider(Provider.class.cast(clazz.newInstance())); bindCf.setProvider(Provider.class.cast(clazz.getDeclaredConstructor().newInstance()));
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.error(e.getMessage(), e); LOGGER.error(e.getMessage(), e);
} }
Expand Down
Expand Up @@ -24,6 +24,7 @@ public class DefaultCallbackClientFinder implements ClientFinder {


public DefaultCallbackClientFinder() {} public DefaultCallbackClientFinder() {}


@Override
public List<Client> find(final Clients clients, final WebContext context, final String clientNames) { public List<Client> find(final Clients clients, final WebContext context, final String clientNames) {


final List<Client> result = new ArrayList<>(); final List<Client> result = new ArrayList<>();
Expand Down
Expand Up @@ -26,6 +26,7 @@ public class DefaultSecurityClientFinder implements ClientFinder {


private String clientNameParameter = Pac4jConstants.DEFAULT_CLIENT_NAME_PARAMETER; private String clientNameParameter = Pac4jConstants.DEFAULT_CLIENT_NAME_PARAMETER;


@Override
public List<Client> find(final Clients clients, final WebContext context, final String clientNames) { public List<Client> find(final Clients clients, final WebContext context, final String clientNames) {
final List<Client> result = new ArrayList<>(); final List<Client> result = new ArrayList<>();


Expand Down
Expand Up @@ -26,7 +26,7 @@ public synchronized static Config build(final String factoryName, final Object..
} else { } else {
clazz = (Class<ConfigFactory>) Class.forName(factoryName, true, tccl); clazz = (Class<ConfigFactory>) Class.forName(factoryName, true, tccl);
} }
final ConfigFactory factory = clazz.newInstance(); final ConfigFactory factory = clazz.getDeclaredConstructor().newInstance();
return factory.build(parameters); return factory.build(parameters);
} catch (final Exception e) { } catch (final Exception e) {
throw new TechnicalException("Cannot build configuration", e); throw new TechnicalException("Cannot build configuration", e);
Expand Down
Expand Up @@ -24,7 +24,9 @@ public void setUserProfile(CommonProfile userProfile) {
this.userProfile = userProfile; this.userProfile = userProfile;
} }


@Override
public abstract boolean equals(Object o); public abstract boolean equals(Object o);


@Override
public abstract int hashCode(); public abstract int hashCode();
} }
Expand Up @@ -17,7 +17,7 @@ public class HttpAction extends TechnicalException {
protected int code; protected int code;


private HttpAction(final int code) { private HttpAction(final int code) {
super("Perfoming a " + code + " HTTP action"); super("Performing a " + code + " HTTP action");
this.code = code; this.code = code;
} }


Expand Down
Expand Up @@ -32,7 +32,7 @@ public RedirectAction buildAjaxResponse(final String url,final WebContext contex
throw HttpAction.unauthorized(context); throw HttpAction.unauthorized(context);
} }


final StringBuffer buffer = new StringBuffer(); final StringBuilder buffer = new StringBuilder();
buffer.append("<?xml version='1.0' encoding='UTF-8'?>"); buffer.append("<?xml version='1.0' encoding='UTF-8'?>");
buffer.append("<partial-response>"); buffer.append("<partial-response>");
buffer.append("<redirect url=\"" + url.replaceAll("&", "&amp;") + "\"></redirect>"); buffer.append("<redirect url=\"" + url.replaceAll("&", "&amp;") + "\"></redirect>");
Expand Down
Expand Up @@ -49,7 +49,7 @@ public static RedirectAction success(final String content) {
public static RedirectAction post(final String location, final Map<String, String> data) { public static RedirectAction post(final String location, final Map<String, String> data) {
RedirectAction action = new RedirectAction(); RedirectAction action = new RedirectAction();
action.type = RedirectType.SUCCESS; action.type = RedirectType.SUCCESS;
final StringBuffer buffer = new StringBuffer(); final StringBuilder buffer = new StringBuilder();
buffer.append("<html>\n"); buffer.append("<html>\n");
buffer.append("<body>\n"); buffer.append("<body>\n");
buffer.append("<form action=\"" + escapeHtml(location) + "\" name=\"f\" method=\"post\">\n"); buffer.append("<form action=\"" + escapeHtml(location) + "\" name=\"f\" method=\"post\">\n");
Expand Down
Expand Up @@ -68,6 +68,6 @@ public void testCommonProfileRedirectionUrl() {
profiles.add(new CommonProfile()); profiles.add(new CommonProfile());
authorizer.setRedirectionUrl(PAC4J_URL); authorizer.setRedirectionUrl(PAC4J_URL);
TestsHelper.expectException(() -> authorizer.isAuthorized(MockWebContext.create(), profiles), HttpAction.class, TestsHelper.expectException(() -> authorizer.isAuthorized(MockWebContext.create(), profiles), HttpAction.class,
"Perfoming a 302 HTTP action"); "Performing a 302 HTTP action");
} }
} }
Expand Up @@ -74,6 +74,6 @@ public void testAnonymousProfileRedirectionUrl() {
profiles.add(new AnonymousProfile()); profiles.add(new AnonymousProfile());
((IsAuthenticatedAuthorizer) authorizer).setRedirectionUrl(PAC4J_URL); ((IsAuthenticatedAuthorizer) authorizer).setRedirectionUrl(PAC4J_URL);
TestsHelper.expectException(() -> authorizer.isAuthorized(MockWebContext.create(), profiles), HttpAction.class, TestsHelper.expectException(() -> authorizer.isAuthorized(MockWebContext.create(), profiles), HttpAction.class,
"Perfoming a 302 HTTP action"); "Performing a 302 HTTP action");
} }
} }
Expand Up @@ -16,6 +16,7 @@
*/ */
public final class IsFullyAuthenticatedAuthorizerTests extends IsAuthenticatedAuthorizerTests { public final class IsFullyAuthenticatedAuthorizerTests extends IsAuthenticatedAuthorizerTests {


@Override
protected Authorizer newAuthorizer() { protected Authorizer newAuthorizer() {
return new IsFullyAuthenticatedAuthorizer(); return new IsFullyAuthenticatedAuthorizer();
} }
Expand All @@ -26,7 +27,7 @@ public void testAnonymousProfileRedirectionUrl() {
profiles.add(new AnonymousProfile()); profiles.add(new AnonymousProfile());
((IsFullyAuthenticatedAuthorizer) authorizer).setRedirectionUrl(PAC4J_URL); ((IsFullyAuthenticatedAuthorizer) authorizer).setRedirectionUrl(PAC4J_URL);
TestsHelper.expectException(() -> authorizer.isAuthorized(MockWebContext.create(), profiles), HttpAction.class, TestsHelper.expectException(() -> authorizer.isAuthorized(MockWebContext.create(), profiles), HttpAction.class,
"Perfoming a 302 HTTP action"); "Performing a 302 HTTP action");
} }


@Test @Test
Expand Down
Expand Up @@ -16,6 +16,7 @@
*/ */
public final class IsRememberedAuthorizerTests extends IsAuthenticatedAuthorizerTests { public final class IsRememberedAuthorizerTests extends IsAuthenticatedAuthorizerTests {


@Override
protected Authorizer newAuthorizer() { protected Authorizer newAuthorizer() {
return new IsRememberedAuthorizer<>(); return new IsRememberedAuthorizer<>();
} }
Expand All @@ -31,7 +32,7 @@ public void testAnonymousProfileRedirectionUrl() {
profiles.add(new AnonymousProfile()); profiles.add(new AnonymousProfile());
((IsRememberedAuthorizer) authorizer).setRedirectionUrl(PAC4J_URL); ((IsRememberedAuthorizer) authorizer).setRedirectionUrl(PAC4J_URL);
TestsHelper.expectException(() -> authorizer.isAuthorized(MockWebContext.create(), profiles), HttpAction.class, TestsHelper.expectException(() -> authorizer.isAuthorized(MockWebContext.create(), profiles), HttpAction.class,
"Perfoming a 302 HTTP action"); "Performing a 302 HTTP action");
} }


@Test @Test
Expand Down
Expand Up @@ -40,6 +40,7 @@ public void setUp() {
} }


private static class IdAuthorizer implements Authorizer<CommonProfile> { private static class IdAuthorizer implements Authorizer<CommonProfile> {
@Override
public boolean isAuthorized(final WebContext context, final List<CommonProfile> profiles) { public boolean isAuthorized(final WebContext context, final List<CommonProfile> profiles) {
return VALUE.equals(profiles.get(0).getId()); return VALUE.equals(profiles.get(0).getId());
} }
Expand Down
Expand Up @@ -14,6 +14,7 @@
*/ */
public final class GuavaStoreTests extends AbstractStoreTests<GuavaStore> { public final class GuavaStoreTests extends AbstractStoreTests<GuavaStore> {


@Override
protected GuavaStore buildStore() { protected GuavaStore buildStore() {
return new GuavaStore(10, 1000, TimeUnit.MILLISECONDS); return new GuavaStore(10, 1000, TimeUnit.MILLISECONDS);
} }
Expand Down
Expand Up @@ -31,6 +31,7 @@ public IpExtractor(String... alternateIpHeaders) {
this.alternateIpHeaders = Arrays.asList(alternateIpHeaders); this.alternateIpHeaders = Arrays.asList(alternateIpHeaders);
} }


@Override
public TokenCredentials extract(WebContext context) { public TokenCredentials extract(WebContext context) {
final String ip; final String ip;
if (alternateIpHeaders.isEmpty()) { if (alternateIpHeaders.isEmpty()) {
Expand Down
Expand Up @@ -75,7 +75,7 @@ public void testGetCredentialsMissingUsername() {
final MockWebContext context = MockWebContext.create(); final MockWebContext context = MockWebContext.create();
TestsHelper.expectException(() -> TestsHelper.expectException(() ->
formClient.getCredentials(context.addRequestParameter(formClient.getUsernameParameter(), USERNAME)), formClient.getCredentials(context.addRequestParameter(formClient.getUsernameParameter(), USERNAME)),
HttpAction.class, "Perfoming a 302 HTTP action"); HttpAction.class, "Performing a 302 HTTP action");
assertEquals(302, context.getResponseStatus()); assertEquals(302, context.getResponseStatus());
assertEquals(LOGIN_URL + "?" + formClient.getUsernameParameter() + "=" + USERNAME + "&" assertEquals(LOGIN_URL + "?" + formClient.getUsernameParameter() + "=" + USERNAME + "&"
+ FormClient.ERROR_PARAMETER + "=" + FormClient.MISSING_FIELD_ERROR, context.getResponseHeaders() + FormClient.ERROR_PARAMETER + "=" + FormClient.MISSING_FIELD_ERROR, context.getResponseHeaders()
Expand All @@ -88,7 +88,7 @@ public void testGetCredentialsMissingPassword() {
final MockWebContext context = MockWebContext.create(); final MockWebContext context = MockWebContext.create();
TestsHelper.expectException(() -> TestsHelper.expectException(() ->
formClient.getCredentials(context.addRequestParameter(formClient.getPasswordParameter(), PASSWORD)), formClient.getCredentials(context.addRequestParameter(formClient.getPasswordParameter(), PASSWORD)),
HttpAction.class, "Perfoming a 302 HTTP action"); HttpAction.class, "Performing a 302 HTTP action");
assertEquals(302, context.getResponseStatus()); assertEquals(302, context.getResponseStatus());
assertEquals(LOGIN_URL + "?" + formClient.getUsernameParameter() + "=&" + FormClient.ERROR_PARAMETER + "=" assertEquals(LOGIN_URL + "?" + formClient.getUsernameParameter() + "=&" + FormClient.ERROR_PARAMETER + "="
+ FormClient.MISSING_FIELD_ERROR, context.getResponseHeaders().get(HttpConstants.LOCATION_HEADER)); + FormClient.MISSING_FIELD_ERROR, context.getResponseHeaders().get(HttpConstants.LOCATION_HEADER));
Expand All @@ -100,7 +100,7 @@ public void testGetCredentials() {
final MockWebContext context = MockWebContext.create(); final MockWebContext context = MockWebContext.create();
TestsHelper.expectException(() -> formClient.getCredentials(context.addRequestParameter(formClient.getUsernameParameter(), USERNAME) TestsHelper.expectException(() -> formClient.getCredentials(context.addRequestParameter(formClient.getUsernameParameter(), USERNAME)
.addRequestParameter(formClient.getPasswordParameter(), PASSWORD)), .addRequestParameter(formClient.getPasswordParameter(), PASSWORD)),
HttpAction.class, "Perfoming a 302 HTTP action"); HttpAction.class, "Performing a 302 HTTP action");
assertEquals(302, context.getResponseStatus()); assertEquals(302, context.getResponseStatus());
assertEquals(LOGIN_URL + "?" + formClient.getUsernameParameter() + "=" + USERNAME + "&" assertEquals(LOGIN_URL + "?" + formClient.getUsernameParameter() + "=" + USERNAME + "&"
+ FormClient.ERROR_PARAMETER + "=" + CredentialsException.class.getSimpleName(), context + FormClient.ERROR_PARAMETER + "=" + CredentialsException.class.getSimpleName(), context
Expand Down
Expand Up @@ -61,7 +61,7 @@ public void testRetrieveIpFromHeaderUsingConstructor() {
@Test(expected = TechnicalException.class) @Test(expected = TechnicalException.class)
public void testSetNullIpHeaderChain() { public void testSetNullIpHeaderChain() {
final IpExtractor ipExtractor = new IpExtractor(); final IpExtractor ipExtractor = new IpExtractor();
ipExtractor.setAlternateIpHeaders(null); ipExtractor.setAlternateIpHeaders((String[]) null);
} }


@Test @Test
Expand Down
Expand Up @@ -27,6 +27,7 @@ public WebServer defineResponse(final String key, final ServerResponse response)
return this; return this;
} }


@Override
public void start() { public void start() {
try { try {
start(NanoHTTPD.SOCKET_READ_TIMEOUT, false); start(NanoHTTPD.SOCKET_READ_TIMEOUT, false);
Expand Down
Expand Up @@ -107,15 +107,15 @@ public void testDirectIncorrectAuth() {
@Test @Test
public void testIndirectNoAuth() { public void testIndirectNoAuth() {
// a request without "Authentication: (Negotiate|Kerberos) SomeToken" header // a request without "Authentication: (Negotiate|Kerberos) SomeToken" header
assertGetCredentialsFailsWithAuthRequired(setupIndirectKerberosClient(), MockWebContext.create(),"Perfoming a 401 HTTP action"); assertGetCredentialsFailsWithAuthRequired(setupIndirectKerberosClient(), MockWebContext.create(),"Performing a 401 HTTP action");
} }


@Test @Test
public void testIndirectIncorrectAuth() { public void testIndirectIncorrectAuth() {
// a request with an incorrect Kerberos token, yields NULL credentials also // a request with an incorrect Kerberos token, yields NULL credentials also
final MockWebContext context = MockWebContext.create() final MockWebContext context = MockWebContext.create()
.addRequestHeader(HttpConstants.AUTHORIZATION_HEADER, "Negotiate " + "AAAbbAA123"); .addRequestHeader(HttpConstants.AUTHORIZATION_HEADER, "Negotiate " + "AAAbbAA123");
assertGetCredentialsFailsWithAuthRequired(setupIndirectKerberosClient(), context, "Perfoming a 401 HTTP action"); assertGetCredentialsFailsWithAuthRequired(setupIndirectKerberosClient(), context, "Performing a 401 HTTP action");
} }


@Test @Test
Expand Down
Expand Up @@ -39,6 +39,7 @@ public KerberosClientExceptionAction(Principal clientPrincipal, String serviceNa
this.serviceName = serviceName; this.serviceName = serviceName;
} }


@Override
public byte[] run() throws GSSException { public byte[] run() throws GSSException {
GSSManager gssManager = GSSManager.getInstance(); GSSManager gssManager = GSSManager.getInstance();


Expand Down
Expand Up @@ -28,7 +28,7 @@ public LdapClient() {


final ConnectionConfig connectionConfig = new ConnectionConfig(); final ConnectionConfig connectionConfig = new ConnectionConfig();
connectionConfig.setConnectTimeout(Duration.ofMillis(500)); connectionConfig.setConnectTimeout(Duration.ofMillis(500));
connectionConfig.setResponseTimeout(Duration.ofMillis(1000)); connectionConfig.setResponseTimeout(Duration.ofSeconds(1));
connectionConfig.setLdapUrl("ldap://localhost:" + LdapServer.PORT); connectionConfig.setLdapUrl("ldap://localhost:" + LdapServer.PORT);


connectionFactory = new DefaultConnectionFactory(); connectionFactory = new DefaultConnectionFactory();
Expand All @@ -47,7 +47,7 @@ public LdapClient() {


final BlockingConnectionPool connectionPool = new BlockingConnectionPool(); final BlockingConnectionPool connectionPool = new BlockingConnectionPool();
connectionPool.setPoolConfig(poolConfig); connectionPool.setPoolConfig(poolConfig);
connectionPool.setBlockWaitTime(Duration.ofMillis(1000)); connectionPool.setBlockWaitTime(Duration.ofSeconds(1));
connectionPool.setValidator(searchValidator); connectionPool.setValidator(searchValidator);
connectionPool.setPruneStrategy(pruneStrategy); connectionPool.setPruneStrategy(pruneStrategy);
connectionPool.setConnectionFactory((DefaultConnectionFactory) connectionFactory); connectionPool.setConnectionFactory((DefaultConnectionFactory) connectionFactory);
Expand Down
Expand Up @@ -100,7 +100,7 @@ private AbstractAttributeConverter getConverter(final String typeName) {
Stream<Class> acceptableConverters = Arrays.stream(getConverters()) Stream<Class> acceptableConverters = Arrays.stream(getConverters())
.filter(x -> { .filter(x -> {
try { try {
AbstractAttributeConverter<?> converter = (AbstractAttributeConverter<?>) x.newInstance(); AbstractAttributeConverter<?> converter = (AbstractAttributeConverter<?>) x.getDeclaredConstructor().newInstance();
Method accept = AbstractAttributeConverter.class.getDeclaredMethod("accept", String.class); Method accept = AbstractAttributeConverter.class.getDeclaredMethod("accept", String.class);
return (Boolean) accept.invoke(converter, typeName); return (Boolean) accept.invoke(converter, typeName);
} catch (Exception e) { } catch (Exception e) {
Expand Down
Expand Up @@ -12,7 +12,9 @@ public abstract class OAuthCredentials extends Credentials {


private static final long serialVersionUID = -7705033802712382951L; private static final long serialVersionUID = -7705033802712382951L;


@Override
public abstract boolean equals(Object o); public abstract boolean equals(Object o);


@Override
public abstract int hashCode(); public abstract int hashCode();
} }
Expand Up @@ -10,7 +10,8 @@
* @since 1.0.0 * @since 1.0.0
*/ */
public final class FacebookRelationshipStatusConverter implements AttributeConverter<FacebookRelationshipStatus> { public final class FacebookRelationshipStatusConverter implements AttributeConverter<FacebookRelationshipStatus> {


@Override
public FacebookRelationshipStatus convert(final Object attribute) { public FacebookRelationshipStatus convert(final Object attribute) {
if (attribute != null) { if (attribute != null) {
if (attribute instanceof String) { if (attribute instanceof String) {
Expand Down
Expand Up @@ -70,7 +70,7 @@ public void testStateRandom() throws MalformedURLException {
public static Map<String, String> splitQuery(URL url) { public static Map<String, String> splitQuery(URL url) {
Map<String, String> query_pairs = new LinkedHashMap<>(); Map<String, String> query_pairs = new LinkedHashMap<>();
String query = url.getQuery(); String query = url.getQuery();
String[] pairs = query.split("&"); String[] pairs = query.split("&", -1);
for (String pair : pairs) { for (String pair : pairs) {
int idx = pair.indexOf("="); int idx = pair.indexOf("=");
query_pairs.put(CommonHelper.urlEncode(pair.substring(0, idx)), CommonHelper.urlEncode(pair.substring(idx + 1))); query_pairs.put(CommonHelper.urlEncode(pair.substring(0, idx)), CommonHelper.urlEncode(pair.substring(idx + 1)));
Expand Down
Expand Up @@ -28,8 +28,8 @@
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.w3c.dom.Element; import org.w3c.dom.Element;


import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.LinkedList;


/** /**
* Generates metadata object with standard values and overriden user defined values. * Generates metadata object with standard values and overriden user defined values.
Expand Down Expand Up @@ -221,7 +221,7 @@ protected final Collection<NameIDFormat> buildNameIDFormat() {


final SAMLObjectBuilder<NameIDFormat> builder = (SAMLObjectBuilder<NameIDFormat>) this.builderFactory final SAMLObjectBuilder<NameIDFormat> builder = (SAMLObjectBuilder<NameIDFormat>) this.builderFactory
.getBuilder(NameIDFormat.DEFAULT_ELEMENT_NAME); .getBuilder(NameIDFormat.DEFAULT_ELEMENT_NAME);
final Collection<NameIDFormat> formats = new LinkedList<NameIDFormat>(); final Collection<NameIDFormat> formats = new ArrayList<>();


if (this.nameIdPolicyFormat != null) { if (this.nameIdPolicyFormat != null) {
final NameIDFormat nameID = builder.buildObject(); final NameIDFormat nameID = builder.buildObject();
Expand Down

0 comments on commit a206f33

Please sign in to comment.