From ca46c7f7189eb108262ea687a580b3cee0059c56 Mon Sep 17 00:00:00 2001 From: Andrei Arlou Date: Fri, 22 Nov 2019 21:21:35 +0300 Subject: [PATCH] KEYCLOAK-12201 Use diamond operator for collections in module "saml-core" --- .../processing/core/parsers/saml/SAMLParser.java | 2 +- .../v2/constants/X500SAMLProfileConstants.java | 2 +- .../core/saml/v2/util/AssertionUtil.java | 4 ++-- .../core/saml/v2/util/StatementUtil.java | 4 ++-- .../core/saml/v2/writers/BaseWriter.java | 2 +- .../core/util/IDFedLSInputResolver.java | 2 +- .../processing/core/util/NamespaceContext.java | 2 +- .../processing/core/util/SchemaManagerUtil.java | 16 ++++++++-------- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/saml-core/src/main/java/org/keycloak/saml/processing/core/parsers/saml/SAMLParser.java b/saml-core/src/main/java/org/keycloak/saml/processing/core/parsers/saml/SAMLParser.java index 52599a1e67..c3f192ad31 100755 --- a/saml-core/src/main/java/org/keycloak/saml/processing/core/parsers/saml/SAMLParser.java +++ b/saml-core/src/main/java/org/keycloak/saml/processing/core/parsers/saml/SAMLParser.java @@ -66,7 +66,7 @@ public class SAMLParser extends AbstractParser { private interface ParserFactory { public StaxParser create(); } - private static final Map PARSERS = new HashMap(); + private static final Map PARSERS = new HashMap<>(); static { PARSERS.put(SAML_11_ASSERTION, new ParserFactory() { @Override public StaxParser create() { return new SAML11AssertionParser(); }}); diff --git a/saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/constants/X500SAMLProfileConstants.java b/saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/constants/X500SAMLProfileConstants.java index f1b0d11dc7..73971d976c 100755 --- a/saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/constants/X500SAMLProfileConstants.java +++ b/saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/constants/X500SAMLProfileConstants.java @@ -127,7 +127,7 @@ public enum X500SAMLProfileConstants { private String friendlyName = null; private String uri = null; - private static final Map lookup = new HashMap(); + private static final Map lookup = new HashMap<>(); static { for (X500SAMLProfileConstants s : EnumSet.allOf(X500SAMLProfileConstants.class)) diff --git a/saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/util/AssertionUtil.java b/saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/util/AssertionUtil.java index 640509f81c..71a5270866 100755 --- a/saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/util/AssertionUtil.java +++ b/saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/util/AssertionUtil.java @@ -480,7 +480,7 @@ public class AssertionUtil { * @return */ public static List getRoles(AssertionType assertion, List roleKeys) { - List roles = new ArrayList(); + List roles = new ArrayList<>(); Set statements = assertion.getStatements(); for (StatementAbstractType statement : statements) { if (statement instanceof AttributeStatementType) { @@ -519,7 +519,7 @@ public class AssertionUtil { * @return */ public static List getRoles(SAML11AssertionType assertion, List roleKeys) { - List roles = new ArrayList(); + List roles = new ArrayList<>(); List statements = assertion.getStatements(); for (SAML11StatementAbstractType statement : statements) { if (statement instanceof SAML11AttributeStatementType) { diff --git a/saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/util/StatementUtil.java b/saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/util/StatementUtil.java index b01b55b928..b67d29423d 100755 --- a/saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/util/StatementUtil.java +++ b/saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/util/StatementUtil.java @@ -192,10 +192,10 @@ public class StatementUtil { } public static Map asMap(Set attributeStatementTypes) { - Map attrMap = new HashMap(); + Map attrMap = new HashMap<>(); if (attributeStatementTypes != null && !attributeStatementTypes.isEmpty()) { - attrMap = new HashMap(); + attrMap = new HashMap<>(); for (StatementAbstractType statement : attributeStatementTypes) { if (statement instanceof AttributeStatementType) { diff --git a/saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/writers/BaseWriter.java b/saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/writers/BaseWriter.java index f9986f153d..8dea0646e6 100755 --- a/saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/writers/BaseWriter.java +++ b/saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/writers/BaseWriter.java @@ -155,7 +155,7 @@ public class BaseWriter { // Take care of other attributes such as x500:encoding Map otherAttribs = attributeType.getOtherAttributes(); if (otherAttribs != null) { - List nameSpacesDealt = new ArrayList(); + List nameSpacesDealt = new ArrayList<>(); Iterator keySet = otherAttribs.keySet().iterator(); while (keySet != null && keySet.hasNext()) { diff --git a/saml-core/src/main/java/org/keycloak/saml/processing/core/util/IDFedLSInputResolver.java b/saml-core/src/main/java/org/keycloak/saml/processing/core/util/IDFedLSInputResolver.java index fdfa4488a1..5108657597 100755 --- a/saml-core/src/main/java/org/keycloak/saml/processing/core/util/IDFedLSInputResolver.java +++ b/saml-core/src/main/java/org/keycloak/saml/processing/core/util/IDFedLSInputResolver.java @@ -109,7 +109,7 @@ public class IDFedLSInputResolver implements LSResourceResolver { } public static Collection schemas() { - Collection schemaValues = new HashSet(schemaLocationMap.values()); + Collection schemaValues = new HashSet<>(schemaLocationMap.values()); schemaValues.remove("schema/w3c/xmlschema/datatypes.dtd"); schemaValues.remove("schema/w3c/xmlschema/XMLSchema.dtd"); logger.info("Considered the schemas:" + schemaValues); diff --git a/saml-core/src/main/java/org/keycloak/saml/processing/core/util/NamespaceContext.java b/saml-core/src/main/java/org/keycloak/saml/processing/core/util/NamespaceContext.java index 705702dd3c..a5842866a6 100755 --- a/saml-core/src/main/java/org/keycloak/saml/processing/core/util/NamespaceContext.java +++ b/saml-core/src/main/java/org/keycloak/saml/processing/core/util/NamespaceContext.java @@ -36,7 +36,7 @@ import java.util.Map; public class NamespaceContext implements javax.xml.namespace.NamespaceContext { - private Map nsMap = new HashMap(); + private Map nsMap = new HashMap<>(); public NamespaceContext() { } diff --git a/saml-core/src/main/java/org/keycloak/saml/processing/core/util/SchemaManagerUtil.java b/saml-core/src/main/java/org/keycloak/saml/processing/core/util/SchemaManagerUtil.java index d73c85c4ba..d2e1455d6c 100755 --- a/saml-core/src/main/java/org/keycloak/saml/processing/core/util/SchemaManagerUtil.java +++ b/saml-core/src/main/java/org/keycloak/saml/processing/core/util/SchemaManagerUtil.java @@ -28,28 +28,28 @@ import java.util.List; public class SchemaManagerUtil { public static List getXMLSchemas() { - List list = new ArrayList(); + List list = new ArrayList<>(); list.add("schema/w3c/xmlschema/xml.xsd"); return list; } public static List getXMLDSig() { - List list = new ArrayList(); + List list = new ArrayList<>(); list.add("schema/w3c/xmldsig/xmldsig-core-schema.xsd"); return list; } public static List getXMLEnc() { - List list = new ArrayList(); + List list = new ArrayList<>(); list.add("schema/w3c/xmlenc/xenc-schema.xsd"); return list; } public static List getXACMLSchemas() { - List list = new ArrayList(); + List list = new ArrayList<>(); list.add("schema/xacml/access_control-xacml-2.0-policy-schema-os.xsd"); list.add("schema/xacml/access_control-xacml-2.0-context-schema-os.xsd"); @@ -57,7 +57,7 @@ public class SchemaManagerUtil { } public static List getSAML2Schemas() { - List list = new ArrayList(); + List list = new ArrayList<>(); list.add("schema/saml/v2/saml-schema-assertion-2.0.xsd"); list.add("schema/saml/v2/saml-schema-protocol-2.0.xsd"); @@ -72,7 +72,7 @@ public class SchemaManagerUtil { } public static List getSAML11Schemas() { - List list = new ArrayList(); + List list = new ArrayList<>(); list.add("schema/saml/v1/saml-schema-assertion-1.0.xsd"); list.add("schema/saml/v1/oasis-sstc-saml-schema-assertion-1.1.xsd"); @@ -81,7 +81,7 @@ public class SchemaManagerUtil { } public static List getWSTrustSchemas() { - List list = new ArrayList(); + List list = new ArrayList<>(); list.add("schema/wstrust/v1_3/ws-trust-1.3.xsd"); list.add("schema/wstrust/v1_3/oasis-200401-wss-wssecurity-secext-1.0.xsd"); @@ -92,7 +92,7 @@ public class SchemaManagerUtil { } public static List getSchemas() { - List list = new ArrayList(); + List list = new ArrayList<>(); list.addAll(getXMLSchemas()); list.addAll(getXMLDSig()); list.addAll(getXMLEnc());