[java-metadata-aggregator] 02/02: MDA-284 - Convert to static loggers while addressing their nullability
Ian Young
ian at iay.org.uk
Mon Apr 3 17:07:43 UTC 2023
This is an automated email from the git hooks/post-receive script.
iay pushed a commit to branch main
in repository java-metadata-aggregator.
View the commit online:
http://git.shibboleth.net/view/?p=java-metadata-aggregator.git;a=commit;h=859ac096f9668ac047b227805dca0d317fc493f8
commit 859ac096f9668ac047b227805dca0d317fc493f8
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Mon Apr 3 18:07:32 2023 +0100
MDA-284 - Convert to static loggers while addressing their nullability
https://shibboleth.atlassian.net/browse/MDA-284
---
.../shibboleth/metadata/cli/SimpleCommandLine.java | 28 +++++++++++++++----
.../net/shibboleth/metadata/cli/MDA137Stage.java | 8 +++---
.../dom/AbstractNamespacesStrippingStage.java | 14 +++++-----
.../metadata/dom/AbstractXSLProcessingStage.java | 6 ++--
.../metadata/dom/DOMElementSerializer.java | 10 +++----
.../metadata/dom/DOMFilesystemSourceStage.java | 10 +++----
.../metadata/dom/DOMResourceSourceStage.java | 16 +++++------
.../metadata/dom/XMLSchemaValidationStage.java | 12 ++++----
.../metadata/dom/XMLSignatureSigningStage.java | 6 ++--
.../metadata/dom/XMLSignatureValidationStage.java | 16 +++++------
.../metadata/dom/XPathFilteringStage.java | 6 ++--
.../metadata/dom/XPathItemSelectionStrategy.java | 6 ++--
.../metadata/dom/impl/XMLSignatureValidator.java | 32 +++++++++++-----------
.../dom/saml/ContactPersonFilterStage.java | 12 ++++----
.../dom/saml/EntitiesDescriptorAssemblerStage.java | 6 ++--
.../saml/EntitiesDescriptorDisassemblerStage.java | 6 ++--
.../metadata/dom/saml/EntityFilterStage.java | 9 +++---
.../metadata/dom/saml/EntityRoleFilterStage.java | 11 ++++----
.../metadata/dom/saml/RemoveOrganizationStage.java | 6 ++--
.../saml/mdattr/EntityAttributeAddingStage.java | 6 ++--
.../saml/mdattr/EntityAttributeFilteringStage.java | 10 +++----
.../EntityRegistrationAuthorityFilterStage.java | 13 ++++-----
.../FilesInDirectoryMultiOutputStrategy.java | 6 ++--
.../metadata/pipeline/ItemMetadataFilterStage.java | 6 ++--
.../pipeline/ItemMetadataTerminationStage.java | 6 ++--
.../metadata/pipeline/SerializationStage.java | 6 ++--
.../metadata/pipeline/SplitMergeStage.java | 8 +++---
.../pipeline/StatusMetadataLoggingStage.java | 22 +++++++--------
.../metadata/pipeline/impl/FutureSupport.java | 4 +--
.../metadata/pipeline/impl/PipelineCallable.java | 6 ++--
30 files changed, 163 insertions(+), 150 deletions(-)
diff --git a/mda-cli/src/main/java/net/shibboleth/metadata/cli/SimpleCommandLine.java b/mda-cli/src/main/java/net/shibboleth/metadata/cli/SimpleCommandLine.java
index 288d1df..0b32845 100644
--- a/mda-cli/src/main/java/net/shibboleth/metadata/cli/SimpleCommandLine.java
+++ b/mda-cli/src/main/java/net/shibboleth/metadata/cli/SimpleCommandLine.java
@@ -26,22 +26,33 @@ import javax.annotation.Nonnull;
import net.shibboleth.metadata.Version;
import net.shibboleth.metadata.pipeline.Pipeline;
import net.shibboleth.metadata.pipeline.TerminationException;
+import net.shibboleth.shared.primitive.LoggerFactory;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.support.FileSystemXmlApplicationContext;
/**
* A simple driver for the metadata aggregator.
- *
+ *
+ * <p>
* This class takes two parameters, the first is the file path to the Spring configuration file. The second parameter is
* the name of bean ID of the Pipeline to be executed. If the pipeline is not initialized by Spring it will be
* initialized by this CLI.
+ * </p>
*
- * All logging is done in accordance with the logback.xml file included in command line JAR file. If you wish to use a
- * different logging configuration you may do so using the <code>-Dlogback.configurationFile=/path/to/logback.xml</code>
- * JVM configuration option.
+ * <p>
+ * Logging is configured through the <code>logback.configurationFile</code> system property.
+ * This property is set here depending on the command-line options selected. A value set
+ * outside this code will be overwritten and therefore ignored.
+ * </p>
+ *
+ * <p>
+ * Because logback only looks at the <code>logback.configurationFile</code> once,
+ * on the first call to <code>getLogger()</code>, it is important that this code
+ * and anything referenced by it does <em>not</em> define static loggers, as this
+ * may cause premature initialisation with the default settings.
+ * </p>
*/
public final class SimpleCommandLine {
@@ -197,7 +208,12 @@ public final class SimpleCommandLine {
/**
* Initialize the logging subsystem.
- *
+ *
+ * <p>
+ * Because this sets the system property logback uses for configuration, it must
+ * be called <em>before</em> any calls to {@link LoggerFactory#getLogger}.
+ * </p>
+ *
* @param cli command line arguments
*/
protected static void initLogging(final SimpleCommandLineArguments cli) {
diff --git a/mda-cli/src/test/java/net/shibboleth/metadata/cli/MDA137Stage.java b/mda-cli/src/test/java/net/shibboleth/metadata/cli/MDA137Stage.java
index f174016..f479b79 100644
--- a/mda-cli/src/test/java/net/shibboleth/metadata/cli/MDA137Stage.java
+++ b/mda-cli/src/test/java/net/shibboleth/metadata/cli/MDA137Stage.java
@@ -22,11 +22,11 @@ import java.util.List;
import javax.annotation.Nonnull;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.metadata.Item;
import net.shibboleth.metadata.pipeline.AbstractStage;
import net.shibboleth.metadata.pipeline.StageProcessingException;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* A stage which does nothing except be created and destroyed.
@@ -36,7 +36,7 @@ import net.shibboleth.metadata.pipeline.StageProcessingException;
public class MDA137Stage<T> extends AbstractStage<T> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(MDA137Stage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(MDA137Stage.class);
@Override
protected void doExecute(@Nonnull List<Item<T>> items) throws StageProcessingException {
@@ -45,12 +45,12 @@ public class MDA137Stage<T> extends AbstractStage<T> {
@Override
protected void doInitialize() {
- log.info("MDA-137 initialized");
+ LOG.info("MDA-137 initialized");
}
@Override
protected void doDestroy() {
- log.info("MDA-137 destroyed");
+ LOG.info("MDA-137 destroyed");
}
}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/AbstractNamespacesStrippingStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/AbstractNamespacesStrippingStage.java
index fb3809e..7e6beea 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/AbstractNamespacesStrippingStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/AbstractNamespacesStrippingStage.java
@@ -26,7 +26,6 @@ import javax.annotation.concurrent.ThreadSafe;
import javax.xml.XMLConstants;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
@@ -37,6 +36,7 @@ import net.shibboleth.metadata.ItemMetadata;
import net.shibboleth.metadata.pipeline.AbstractIteratingStage;
import net.shibboleth.shared.collection.ClassToInstanceMultiMap;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.xml.ElementSupport;
/**
@@ -54,7 +54,7 @@ import net.shibboleth.shared.xml.ElementSupport;
public abstract class AbstractNamespacesStrippingStage extends AbstractIteratingStage<Element> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(AbstractNamespacesStrippingStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(AbstractNamespacesStrippingStage.class);
/**
* Determine whether a particular namespace should be stripped.
@@ -104,21 +104,21 @@ public abstract class AbstractNamespacesStrippingStage extends AbstractIterating
final Attr attribute = (Attr) attributes.item(aIndex);
final String attrNamespace = attribute.getNamespaceURI();
final String attrLocalName = attribute.getLocalName();
- log.trace("checking attribute {{}}:{}", attrNamespace, attrLocalName);
+ LOG.trace("checking attribute {{}}:{}", attrNamespace, attrLocalName);
// Handle namespace prefix definitions first
if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(attrNamespace)) {
// namespace prefix definition
if (removingNamespace(attribute.getTextContent())) {
// remove prefix definition
- log.trace(" prefix {} definition; will remove", attrLocalName);
+ LOG.trace(" prefix {} definition; will remove", attrLocalName);
removeTarget.add(attribute);
}
} else if (attrNamespace != null && removingNamespace(attrNamespace)) {
// remove attribute in target namespace
// never remove attributes without an explicit namespace prefix
- log.trace(" in target namespace; will remove");
+ LOG.trace(" in target namespace; will remove");
removePrefix.add(attribute);
}
}
@@ -144,13 +144,13 @@ public abstract class AbstractNamespacesStrippingStage extends AbstractIterating
*/
private void processElement(@Nonnull final Element element, final int depth) {
Constraint.isNotNull(element, "Element can not be null");
- log.trace("{}: element {}", depth, element.getLocalName());
+ LOG.trace("{}: element {}", depth, element.getLocalName());
/*
* If this element is in the target namespace, remove it from the DOM entirely and we're done.
*/
if (removingNamespace(element.getNamespaceURI())) {
- log.trace("{}: removing element entirely", depth);
+ LOG.trace("{}: removing element entirely", depth);
element.getParentNode().removeChild(element);
return;
}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/AbstractXSLProcessingStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/AbstractXSLProcessingStage.java
index 57852ff..8d5a3c5 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/AbstractXSLProcessingStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/AbstractXSLProcessingStage.java
@@ -38,7 +38,6 @@ import javax.xml.transform.URIResolver;
import javax.xml.transform.stream.StreamSource;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.core.io.Resource;
import org.w3c.dom.Element;
@@ -54,6 +53,7 @@ import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
/**
@@ -69,7 +69,7 @@ import net.shibboleth.shared.primitive.StringSupport;
public abstract class AbstractXSLProcessingStage extends AbstractStage<Element> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(AbstractXSLProcessingStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(AbstractXSLProcessingStage.class);
/** Resource that provides the XSL document. */
@NonnullAfterInit @GuardedBy("this")
@@ -287,7 +287,7 @@ public abstract class AbstractXSLProcessingStage extends AbstractStage<Element>
tfactory.setURIResolver(uriResolver);
}
- log.debug("{} pipeline stage compiling XSL file {}", getId(), xslResource);
+ LOG.debug("{} pipeline stage compiling XSL file {}", getId(), xslResource);
xslTemplate = tfactory.newTemplates(new StreamSource(xslResource.getInputStream(),
xslResource.getURL().toExternalForm()));
} catch (final TransformerConfigurationException e) {
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/DOMElementSerializer.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/DOMElementSerializer.java
index 13f23ac..d904c83 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/DOMElementSerializer.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/DOMElementSerializer.java
@@ -34,9 +34,9 @@ import net.shibboleth.metadata.Item;
import net.shibboleth.metadata.ItemCollectionSerializer;
import net.shibboleth.metadata.ItemSerializer;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
+import net.shibboleth.shared.primitive.LoggerFactory;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;
/**
@@ -50,7 +50,7 @@ import org.w3c.dom.Element;
public class DOMElementSerializer implements ItemSerializer<Element>, ItemCollectionSerializer<Element> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(DOMElementSerializer.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(DOMElementSerializer.class);
@Override
public void serialize(@Nonnull final Item<Element> item, @Nonnull final OutputStream output)
@@ -64,7 +64,7 @@ public class DOMElementSerializer implements ItemSerializer<Element>, ItemCollec
serializer.setOutputProperty("encoding", "UTF-8");
serializer.transform(new DOMSource(documentRoot.getOwnerDocument()), new StreamResult(output));
} catch (final TransformerException e) {
- log.error("Unable to write out XML", e);
+ LOG.error("Unable to write out XML", e);
throw new IOException(e);
}
}
@@ -76,10 +76,10 @@ public class DOMElementSerializer implements ItemSerializer<Element>, ItemCollec
if (iter.hasNext()) {
serialize(iter.next(), output);
if (iter.hasNext()) {
- log.warn("collection contained more than one Item; rest ignored");
+ LOG.warn("collection contained more than one Item; rest ignored");
}
} else {
- log.warn("collection was empty");
+ LOG.warn("collection was empty");
}
}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/DOMFilesystemSourceStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/DOMFilesystemSourceStage.java
index 464b220..05266cf 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/DOMFilesystemSourceStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/DOMFilesystemSourceStage.java
@@ -29,7 +29,6 @@ import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -41,6 +40,7 @@ import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.xml.ParserPool;
/**
@@ -56,7 +56,7 @@ import net.shibboleth.shared.xml.ParserPool;
public class DOMFilesystemSourceStage extends AbstractStage<Element> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(DOMFilesystemSourceStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(DOMFilesystemSourceStage.class);
/** Pool of DOM parsers used to parse the XML file in to a DOM. */
@NonnullAfterInit @GuardedBy("this")
@@ -219,7 +219,7 @@ public class DOMFilesystemSourceStage extends AbstractStage<Element> {
if (sourceFiles.isEmpty()) {
if (!isNoSourceFilesAnError()) {
- log.warn("stage {}: no input XML files in source path {}", getId(), sFile.getPath());
+ LOG.warn("stage {}: no input XML files in source path {}", getId(), sFile.getPath());
return;
}
throw new StageProcessingException("stage " + getId() + ": no source file was available for parsing");
@@ -277,7 +277,7 @@ public class DOMFilesystemSourceStage extends AbstractStage<Element> {
*/
@Nullable
protected DOMElementItem processSourceFile(@Nonnull final File source) throws StageProcessingException {
- log.debug("{} pipeline source parsing XML file {}", getId(), source.getPath());
+ LOG.debug("{} pipeline source parsing XML file {}", getId(), source.getPath());
try (FileInputStream xmlIn = new FileInputStream(source)) {
final Document doc = getParserPool().parse(xmlIn);
return new DOMElementItem(doc);
@@ -286,7 +286,7 @@ public class DOMFilesystemSourceStage extends AbstractStage<Element> {
throw new StageProcessingException(getId() + " pipeline source unable to parse XML input file "
+ source.getPath(), e);
}
- log.warn("{} pipeline source: unable to parse XML source file {}, ignoring it bad file", new Object[] {
+ LOG.warn("{} pipeline source: unable to parse XML source file {}, ignoring it bad file", new Object[] {
getId(), source.getPath(), e,});
return null;
}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/DOMResourceSourceStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/DOMResourceSourceStage.java
index 6d0672b..7714760 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/DOMResourceSourceStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/DOMResourceSourceStage.java
@@ -27,7 +27,6 @@ import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.core.io.Resource;
import org.w3c.dom.Element;
@@ -38,6 +37,7 @@ import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.xml.ParserPool;
import net.shibboleth.shared.xml.XMLParserException;
@@ -55,7 +55,7 @@ import net.shibboleth.shared.xml.XMLParserException;
public class DOMResourceSourceStage extends AbstractStage<Element> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(DOMResourceSourceStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(DOMResourceSourceStage.class);
/** Resource used to fetch remote XML document. */
@NonnullAfterInit @GuardedBy("this")
@@ -135,7 +135,7 @@ public class DOMResourceSourceStage extends AbstractStage<Element> {
final var resource = getDOMResource();
assert resource != null; // enforced by doInitialize
- log.debug("Attempting to fetch XML document from '{}'", resource.getDescription());
+ LOG.debug("Attempting to fetch XML document from '{}'", resource.getDescription());
try (@Nonnull InputStream ins = resource.getInputStream()) {
populateItemCollection(items, ins, resource);
@@ -144,8 +144,8 @@ public class DOMResourceSourceStage extends AbstractStage<Element> {
throw new StageProcessingException("Error retrieving XML document from " +
resource.getDescription(), e);
}
- log.warn("stage {}: unable to read in XML file", getId());
- log.debug("stage {}: HTTP resource exception", getId(), e);
+ LOG.warn("stage {}: unable to read in XML file", getId());
+ LOG.debug("stage {}: HTTP resource exception", getId(), e);
}
}
@@ -162,15 +162,15 @@ public class DOMResourceSourceStage extends AbstractStage<Element> {
protected void populateItemCollection(@Nonnull @NonnullElements final List<Item<Element>> items,
@Nonnull final InputStream data, @Nonnull final Resource resource) throws StageProcessingException {
try {
- log.debug("Parsing XML document retrieved from '{}'", resource.getDescription());
+ LOG.debug("Parsing XML document retrieved from '{}'", resource.getDescription());
items.add(new DOMElementItem(getParserPool().parse(data)));
} catch (final XMLParserException e) {
if (getErrorCausesSourceFailure()) {
throw new StageProcessingException(getId() + " unable to parse returned XML document " +
resource.getDescription(), e);
}
- log.warn("stage {}: unable to parse XML document", getId());
- log.debug("stage {}: parsing exception", getId(), e);
+ LOG.warn("stage {}: unable to parse XML document", getId());
+ LOG.debug("stage {}: parsing exception", getId(), e);
}
}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/XMLSchemaValidationStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/XMLSchemaValidationStage.java
index 567efaa..4a942a1 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/XMLSchemaValidationStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/XMLSchemaValidationStage.java
@@ -30,7 +30,6 @@ import javax.xml.validation.Schema;
import javax.xml.validation.Validator;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.core.io.Resource;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
@@ -45,6 +44,7 @@ import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.xml.SchemaBuilder;
import net.shibboleth.shared.xml.SerializeSupport;
@@ -65,7 +65,7 @@ import net.shibboleth.shared.xml.SerializeSupport;
public class XMLSchemaValidationStage extends AbstractIteratingStage<Element> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(XMLSchemaValidationStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(XMLSchemaValidationStage.class);
/** Collection of schema resources. */
@Nonnull @NonnullElements @Unmodifiable @GuardedBy("this")
@@ -130,14 +130,14 @@ public class XMLSchemaValidationStage extends AbstractIteratingStage<Element> {
@Override
protected void doExecute(@Nonnull final Item<Element> item) throws StageProcessingException {
- log.debug("{} pipeline stage schema validating DOM Element collection elements", getId());
+ LOG.debug("{} pipeline stage schema validating DOM Element collection elements", getId());
final Validator validator = getValidationSchema().newValidator();
try {
validator.validate(new DOMSource(item.unwrap()));
} catch (final Exception e) {
- if (log.isDebugEnabled()) {
- log.debug("DOM Element was not valid:\n{}", SerializeSupport.prettyPrintXML(item.unwrap()), e);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("DOM Element was not valid:\n{}", SerializeSupport.prettyPrintXML(item.unwrap()), e);
}
if (isElementRequiredToBeSchemaValid()) {
item.getItemMetadata().put(new ErrorStatus(getId(), e.getMessage()));
@@ -157,7 +157,7 @@ public class XMLSchemaValidationStage extends AbstractIteratingStage<Element> {
}
try {
- log.debug("{} pipeline stage building validation schema resources", getId());
+ LOG.debug("{} pipeline stage building validation schema resources", getId());
final SchemaBuilder builder = new SchemaBuilder();
for (final Resource schemaResource : schemaResources) {
try {
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/XMLSignatureSigningStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/XMLSignatureSigningStage.java
index 3474817..efbb423 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/XMLSignatureSigningStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/XMLSignatureSigningStage.java
@@ -31,7 +31,6 @@ import javax.xml.namespace.QName;
import org.apache.xml.security.Init;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;
import net.shibboleth.metadata.Item;
@@ -44,6 +43,7 @@ import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* A pipeline stage that creates, and adds, an enveloped signature for each element in the given {@link DOMElementItem}
@@ -71,7 +71,7 @@ public class XMLSignatureSigningStage extends AbstractStage<Element> {
};
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(XMLSignatureSigningStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(XMLSignatureSigningStage.class);
/** SHA algorithm variant used in signature and digest algorithms. Default value: <code>ShaVariant.SHA256</code> */
@Nonnull @GuardedBy("this")
@@ -515,7 +515,7 @@ public class XMLSignatureSigningStage extends AbstractStage<Element> {
@Override
protected void doExecute(@Nonnull @NonnullElements final List<Item<Element>> items)
throws StageProcessingException {
- final var signer = new XMLSignatureSigner(this, log);
+ final var signer = new XMLSignatureSigner(this, LOG);
for (final Item<Element> item : items) {
signer.sign(item);
}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/XMLSignatureValidationStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/XMLSignatureValidationStage.java
index 6e682ff..fabd6b5 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/XMLSignatureValidationStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/XMLSignatureValidationStage.java
@@ -30,7 +30,6 @@ import javax.annotation.concurrent.ThreadSafe;
import org.apache.xml.security.Init;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;
import net.shibboleth.metadata.ErrorStatus;
@@ -45,6 +44,7 @@ import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.xml.SerializeSupport;
/**
@@ -67,7 +67,7 @@ import net.shibboleth.shared.xml.SerializeSupport;
public class XMLSignatureValidationStage extends AbstractStage<Element> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(XMLSignatureValidationStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(XMLSignatureValidationStage.class);
/** Whether Elements are required to be signed. */
@GuardedBy("this")
@@ -250,30 +250,30 @@ public class XMLSignatureValidationStage extends AbstractStage<Element> {
signatureElement = validator.getSignatureElement(docElement);
if (signatureElement == null) {
if (isSignatureRequired()) {
- log.debug("DOM Element was not signed and signature is required");
+ LOG.debug("DOM Element was not signed and signature is required");
item.getItemMetadata().put(
new ErrorStatus(getId(), "DOM Element was not signed but signatures are required"));
} else {
- log.debug("DOM Element is not signed, no verification performed");
+ LOG.debug("DOM Element is not signed, no verification performed");
}
return;
}
} catch (final ValidationException e) {
// pass on an error from signature location (e.g., multiple signatures)
- log.debug("setting status: ", e.getMessage());
+ LOG.debug("setting status: ", e.getMessage());
item.getItemMetadata().put(new ErrorStatus(getId(), e.getMessage()));
return;
}
- if (log.isDebugEnabled()) {
- log.debug("DOM Element contained Signature element\n{}", SerializeSupport.prettyPrintXML(signatureElement));
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("DOM Element contained Signature element\n{}", SerializeSupport.prettyPrintXML(signatureElement));
}
try {
validator.verifySignature(docElement, signatureElement);
} catch (final ValidationException e) {
final String message = "element signature is invalid: " + e.getMessage();
- log.debug("setting status: ", message);
+ LOG.debug("setting status: ", message);
if (isValidSignatureRequired()) {
item.getItemMetadata().put(new ErrorStatus(getId(), message));
} else {
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/XPathFilteringStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/XPathFilteringStage.java
index 1af0b35..30d8694 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/XPathFilteringStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/XPathFilteringStage.java
@@ -31,7 +31,6 @@ import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;
import net.shibboleth.metadata.Item;
@@ -42,6 +41,7 @@ import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
/**
@@ -59,7 +59,7 @@ import net.shibboleth.shared.primitive.StringSupport;
public class XPathFilteringStage extends AbstractStage<Element> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(XPathFilteringStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(XPathFilteringStage.class);
/** The XPath expression to execute on each {@link DOMElementItem}. */
@NonnullAfterInit @NotEmpty @GuardedBy("this")
@@ -132,7 +132,7 @@ public class XPathFilteringStage extends AbstractStage<Element> {
final Item<Element> item = iterator.next();
try {
if (compiledExpression.evaluateExpression(item.unwrap(), Boolean.class)) {
- log.debug("removing item matching XPath condition");
+ LOG.debug("removing item matching XPath condition");
iterator.remove();
}
} catch (final XPathExpressionException e) {
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/XPathItemSelectionStrategy.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/XPathItemSelectionStrategy.java
index 9df129b..b9a4af8 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/XPathItemSelectionStrategy.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/XPathItemSelectionStrategy.java
@@ -29,11 +29,11 @@ import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;
import net.shibboleth.metadata.Item;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* Item selection strategy which selects items on the basis of a boolean XPath expression.
@@ -42,7 +42,7 @@ import net.shibboleth.shared.annotation.constraint.NotEmpty;
public class XPathItemSelectionStrategy implements Predicate<Item<Element>> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(XPathItemSelectionStrategy.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(XPathItemSelectionStrategy.class);
/**
* Compiled form of the expression.
@@ -81,7 +81,7 @@ public class XPathItemSelectionStrategy implements Predicate<Item<Element>> {
try {
return compiledExpression.evaluateExpression(item.unwrap(), Boolean.class);
} catch (final XPathExpressionException e) {
- log.warn("Exception thrown during XPath evaluation: " + e);
+ LOG.warn("Exception thrown during XPath evaluation: " + e);
return false;
}
}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/impl/XMLSignatureValidator.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/impl/XMLSignatureValidator.java
index cd9c993..bf34fca 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/impl/XMLSignatureValidator.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/impl/XMLSignatureValidator.java
@@ -30,6 +30,7 @@ import net.shibboleth.metadata.dom.ds.XMLDSIGSupport;
import net.shibboleth.shared.codec.Base64Support;
import net.shibboleth.shared.codec.EncodingException;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.xml.AttributeSupport;
import net.shibboleth.shared.xml.ElementSupport;
@@ -43,7 +44,6 @@ import org.apache.xml.security.transforms.Transform;
import org.apache.xml.security.transforms.TransformationException;
import org.apache.xml.security.transforms.Transforms;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -66,7 +66,7 @@ import org.w3c.dom.Node;
public final class XMLSignatureValidator {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(XMLSignatureValidator.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(XMLSignatureValidator.class);
/** Public key used to verify signatures. */
private final PublicKey verificationKey;
@@ -157,7 +157,7 @@ public final class XMLSignatureValidator {
* and no attribute is being referenced.
*/
if (referenceURI.isEmpty()) {
- log.debug("reference was empty; no ID marking required");
+ LOG.debug("reference was empty; no ID marking required");
return;
}
@@ -165,7 +165,7 @@ public final class XMLSignatureValidator {
* If something has already identified an ID element, don't interfere
*/
if (AttributeSupport.getIdAttribute(docElement) != null ) {
- log.debug("document element already has an ID attribute");
+ LOG.debug("document element already has an ID attribute");
return;
}
@@ -186,7 +186,7 @@ public final class XMLSignatureValidator {
for (int i = 0; i < attributes.getLength(); i++) {
final Attr attribute = (Attr) attributes.item(i);
if (id.equals(attribute.getValue())) {
- log.debug("marking ID attribute {}", attribute.getName());
+ LOG.debug("marking ID attribute {}", attribute.getName());
docElement.setIdAttributeNode(attribute, true);
return;
}
@@ -197,7 +197,7 @@ public final class XMLSignatureValidator {
* Signature validation will fail later, but let's give a warning here
* as well to help people debug their signature code.
*/
- log.debug("did not find a document element attribute with value '{}'", id);
+ LOG.debug("did not find a document element attribute with value '{}'", id);
}
/**
@@ -210,7 +210,7 @@ public final class XMLSignatureValidator {
public void verifySignature(@Nonnull final Element docElement, @Nonnull final Element signatureElement)
throws ValidationException {
- log.debug("Creating XML security library XMLSignature object");
+ LOG.debug("Creating XML security library XMLSignature object");
XMLSignature signature = null;
try {
signature = new XMLSignature(signatureElement, "");
@@ -228,7 +228,7 @@ public final class XMLSignatureValidator {
// check reference digest algorithm against blacklist
try {
final String alg = ref.getMessageDigestAlgorithm().getAlgorithmURI();
- log.debug("blacklist checking digest {}", alg);
+ LOG.debug("blacklist checking digest {}", alg);
if (blacklistedDigests.contains(alg)) {
throw new ValidationException("Digest algorithm " + alg + " is blacklisted");
}
@@ -238,14 +238,14 @@ public final class XMLSignatureValidator {
// check signature algorithm against blacklist
final String alg = signature.getSignedInfo().getSignatureMethodURI();
- log.debug("blacklist checking signature method {}", alg);
+ LOG.debug("blacklist checking signature method {}", alg);
if (blacklistedSignatureMethods.contains(alg)) {
throw new ValidationException("Signature algorithm " + alg + " is blacklisted");
}
- if (log.isDebugEnabled()) {
+ if (LOG.isDebugEnabled()) {
try {
- log.debug("Verifying XML signature with key\n{}",
+ LOG.debug("Verifying XML signature with key\n{}",
Base64Support.encode(verificationKey.getEncoded(), false));
} catch (final EncodingException e) {
//do nothing, as only logging, and this is unlikely.
@@ -265,13 +265,13 @@ public final class XMLSignatureValidator {
* this point, we can't use one from before the signature validation.
*/
validateSignatureReference(docElement, extractReference(signature));
- log.debug("XML document signature verified.");
+ LOG.debug("XML document signature verified.");
} else {
throw new ValidationException("XML document signature verification failed");
}
} catch (final XMLSignatureException e) {
- if (log.isDebugEnabled()) {
- log.debug("Unable to validate signature", e);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Unable to validate signature", e);
}
throw new ValidationException("XML document signature verification failed with an error: " +
e.getMessage());
@@ -390,11 +390,11 @@ public final class XMLSignatureValidator {
}
final String uri = transform.getURI();
if (Transforms.TRANSFORM_ENVELOPED_SIGNATURE.equals(uri)) {
- log.debug("Saw Enveloped signature transform");
+ LOG.debug("Saw Enveloped signature transform");
sawEnveloped = true;
} else if (Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS.equals(uri)
|| Transforms.TRANSFORM_C14N_EXCL_WITH_COMMENTS.equals(uri)) {
- log.debug("Saw Exclusive C14N signature transform");
+ LOG.debug("Saw Exclusive C14N signature transform");
} else {
throw new ValidationException("Saw invalid signature transform: " + uri);
}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/ContactPersonFilterStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/ContactPersonFilterStage.java
index 3cdddbe..c2cc867 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/ContactPersonFilterStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/ContactPersonFilterStage.java
@@ -27,7 +27,6 @@ import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;
import net.shibboleth.metadata.Item;
@@ -36,6 +35,7 @@ import net.shibboleth.metadata.pipeline.StageProcessingException;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
import net.shibboleth.shared.xml.AttributeSupport;
import net.shibboleth.shared.xml.ElementSupport;
@@ -77,7 +77,7 @@ public class ContactPersonFilterStage extends AbstractIteratingStage<Element> {
private static final Set<String> ALLOWED_TYPES = Set.of(TECHNICAL, SUPPORT, ADMINISTRATIVE, BILLING, OTHER);
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(ContactPersonFilterStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(ContactPersonFilterStage.class);
/** Person types which are white/black listed depending on the value of {@link #whitelistingTypes}. */
@Nonnull @NonnullElements @Unmodifiable @GuardedBy("this")
@@ -110,7 +110,7 @@ public class ContactPersonFilterStage extends AbstractIteratingStage<Element> {
if (ALLOWED_TYPES.contains(type)) {
checkedTypes.add(type);
} else {
- log.debug("Stage {}: {} is not an allowed contact person type and so has been ignored", getId(),
+ LOG.debug("Stage {}: {} is not an allowed contact person type and so has been ignored", getId(),
type);
}
}
@@ -176,7 +176,7 @@ public class ContactPersonFilterStage extends AbstractIteratingStage<Element> {
ElementSupport
.getChildElementsByTagNameNS(entityDescriptor, SAMLMetadataSupport.MD_NS, "ContactPerson");
if (!contactPersons.isEmpty()) {
- log.debug("{} pipeline stage filtering ContactPerson from EntityDescriptor {}", getId(), entityId);
+ LOG.debug("{} pipeline stage filtering ContactPerson from EntityDescriptor {}", getId(), entityId);
for (final Element contactPerson : contactPersons) {
if (!isRetainedContactPersonType(contactPerson)) {
entityDescriptor.removeChild(contactPerson);
@@ -199,7 +199,7 @@ public class ContactPersonFilterStage extends AbstractIteratingStage<Element> {
StringSupport.trimOrNull(AttributeSupport.getAttributeValue(contactPerson, null, "contactType"));
if (type == null) {
- log.debug(
+ LOG.debug(
"The following ContactPerson does not contain the required contactType attribute, " +
"it will be removed:\n{}",
SerializeSupport.prettyPrintXML(contactPerson));
@@ -207,7 +207,7 @@ public class ContactPersonFilterStage extends AbstractIteratingStage<Element> {
}
if (!ALLOWED_TYPES.contains(type)) {
- log.debug("The following ContactPerson contained an invalid contactType, it will be removed:\n{}",
+ LOG.debug("The following ContactPerson contained an invalid contactType, it will be removed:\n{}",
SerializeSupport.prettyPrintXML(contactPerson));
return false;
}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/EntitiesDescriptorAssemblerStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/EntitiesDescriptorAssemblerStage.java
index d93cacd..a998c76 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/EntitiesDescriptorAssemblerStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/EntitiesDescriptorAssemblerStage.java
@@ -26,7 +26,6 @@ import javax.annotation.concurrent.ThreadSafe;
import javax.xml.namespace.QName;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -39,6 +38,7 @@ import net.shibboleth.metadata.pipeline.StageProcessingException;
import net.shibboleth.metadata.pipeline.impl.NoOpItemOrderingStrategy;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
import net.shibboleth.shared.xml.AttributeSupport;
import net.shibboleth.shared.xml.ElementSupport;
@@ -55,7 +55,7 @@ public class EntitiesDescriptorAssemblerStage extends AbstractStage<Element> {
private static final QName NAME_ATTRIB_NAME = new QName("Name");
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(EntitiesDescriptorAssemblerStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(EntitiesDescriptorAssemblerStage.class);
/**
* Whether attempting to turn an empty item collection, which would result in a schema-invalid childless
@@ -137,7 +137,7 @@ public class EntitiesDescriptorAssemblerStage extends AbstractStage<Element> {
if (isNoChildrenAProcessingError()) {
throw new StageProcessingException("Unable to assemble EntitiesDescriptor from an empty collection");
}
- log.debug("Unable to assemble EntitiesDescriptor from an empty collection");
+ LOG.debug("Unable to assemble EntitiesDescriptor from an empty collection");
return;
}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/EntitiesDescriptorDisassemblerStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/EntitiesDescriptorDisassemblerStage.java
index 556399f..a23079b 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/EntitiesDescriptorDisassemblerStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/EntitiesDescriptorDisassemblerStage.java
@@ -24,13 +24,13 @@ import javax.annotation.Nonnull;
import javax.annotation.concurrent.ThreadSafe;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;
import net.shibboleth.metadata.Item;
import net.shibboleth.metadata.dom.DOMElementItem;
import net.shibboleth.metadata.pipeline.AbstractStage;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.xml.ElementSupport;
import net.shibboleth.shared.xml.QNameSupport;
@@ -42,7 +42,7 @@ import net.shibboleth.shared.xml.QNameSupport;
public class EntitiesDescriptorDisassemblerStage extends AbstractStage<Element> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(EntitiesDescriptorDisassemblerStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(EntitiesDescriptorDisassemblerStage.class);
@Override
protected void doExecute(@Nonnull @NonnullElements final List<Item<Element>> items) {
@@ -59,7 +59,7 @@ public class EntitiesDescriptorDisassemblerStage extends AbstractStage<Element>
} else if (SAMLMetadataSupport.isEntityDescriptor(element)) {
processEntityDescriptor(items, element);
} else {
- log.debug("{} pipeline stage: DOM Element {} not supported, ignoring it", getId(),
+ LOG.debug("{} pipeline stage: DOM Element {} not supported, ignoring it", getId(),
QNameSupport.getNodeQName(element));
}
}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/EntityFilterStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/EntityFilterStage.java
index 5087234..bd54d70 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/EntityFilterStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/EntityFilterStage.java
@@ -18,7 +18,6 @@
package net.shibboleth.metadata.dom.saml;
import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -27,7 +26,6 @@ import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;
import net.shibboleth.metadata.Item;
@@ -35,6 +33,7 @@ import net.shibboleth.metadata.pipeline.AbstractFilteringStage;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.collection.CollectionSupport;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.xml.ElementSupport;
/** A pipeline stage that will remove SAML EntityDescriptior elements which do meet specified filtering criteria. */
@@ -42,7 +41,7 @@ import net.shibboleth.shared.xml.ElementSupport;
public class EntityFilterStage extends AbstractFilteringStage<Element> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(EntityFilterStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(EntityFilterStage.class);
/** Entities which are white/black listed depending on the value of {@link #whitelistingEntities}. */
@Nonnull @NonnullElements @Unmodifiable @GuardedBy("this")
@@ -181,13 +180,13 @@ public class EntityFilterStage extends AbstractFilteringStage<Element> {
// if we're whitelisting entities and this entity isn't in the list, kick it out
if (isWhitelistingEntities() && !getDesignatedEntities().contains(entityId)) {
- log.debug("{} pipeline stage removing entity {} because it wasn't on the whitelist", getId(), entityId);
+ LOG.debug("{} pipeline stage removing entity {} because it wasn't on the whitelist", getId(), entityId);
return true;
}
// if we're backlisting entities and this entity is in the list, kick it out
if (!isWhitelistingEntities() && getDesignatedEntities().contains(entityId)) {
- log.debug("{} pipeline stage removing entity {} because it was on the blacklist", getId(), entityId);
+ LOG.debug("{} pipeline stage removing entity {} because it was on the blacklist", getId(), entityId);
return true;
}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/EntityRoleFilterStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/EntityRoleFilterStage.java
index 310220a..6cb0a34 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/EntityRoleFilterStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/EntityRoleFilterStage.java
@@ -18,7 +18,6 @@
package net.shibboleth.metadata.dom.saml;
import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.Set;
@@ -29,7 +28,6 @@ import javax.annotation.concurrent.ThreadSafe;
import javax.xml.namespace.QName;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;
import net.shibboleth.metadata.Item;
@@ -37,6 +35,7 @@ import net.shibboleth.metadata.pipeline.AbstractFilteringStage;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.collection.CollectionSupport;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.xml.DOMTypeSupport;
import net.shibboleth.shared.xml.ElementSupport;
import net.shibboleth.shared.xml.QNameSupport;
@@ -63,7 +62,7 @@ public class EntityRoleFilterStage extends AbstractFilteringStage<Element> {
SAMLMetadataSupport.PDP_DESCRIPTOR_NAME);
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(EntityRoleFilterStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(EntityRoleFilterStage.class);
/** Role element or type names which are white/black listed depending on the value of {@link #whitelistingRoles}. */
@Nonnull @NonnullElements @Unmodifiable @GuardedBy("this")
@@ -229,7 +228,7 @@ public class EntityRoleFilterStage extends AbstractFilteringStage<Element> {
final String entityId = entityDescriptor.getAttributeNS(null, "entityID");
- log.debug("{} pipeline stage filtering roles from EntityDescriptor {}", getId(), entityId);
+ LOG.debug("{} pipeline stage filtering roles from EntityDescriptor {}", getId(), entityId);
final boolean hasRoles = hasFilteredRoles(entityId, entityDescriptor);
if (!hasRoles && isRemovingRolelessEntities()) {
@@ -265,11 +264,11 @@ public class EntityRoleFilterStage extends AbstractFilteringStage<Element> {
if (roleIdentifier != null) {
final boolean isDesignatedRole = getDesignatedRoles().contains(roleIdentifier);
if ((isWhitelistingRoles() && !isDesignatedRole) || (!isWhitelistingRoles() && isDesignatedRole)) {
- log.debug("{} pipeline stage removing role {} from EntityDescriptor {}", new Object[] {getId(),
+ LOG.debug("{} pipeline stage removing role {} from EntityDescriptor {}", new Object[] {getId(),
roleIdentifier, entityId,});
entityDescriptor.removeChild(child);
} else {
- log.debug("{} pipeline did not remove role {} from EntityDescriptor {}", new Object[] {getId(),
+ LOG.debug("{} pipeline did not remove role {} from EntityDescriptor {}", new Object[] {getId(),
roleIdentifier, entityId,});
remains = true;
}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/RemoveOrganizationStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/RemoveOrganizationStage.java
index 2c7a8a6..0dcb9e0 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/RemoveOrganizationStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/RemoveOrganizationStage.java
@@ -23,12 +23,12 @@ import javax.annotation.Nonnull;
import javax.annotation.concurrent.ThreadSafe;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;
import net.shibboleth.metadata.Item;
import net.shibboleth.metadata.pipeline.AbstractIteratingStage;
import net.shibboleth.metadata.pipeline.StageProcessingException;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.xml.ElementSupport;
/** Filtering stage that removes Organization elements from EntityDescriptors. */
@@ -36,7 +36,7 @@ import net.shibboleth.shared.xml.ElementSupport;
public class RemoveOrganizationStage extends AbstractIteratingStage<Element> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(ContactPersonFilterStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(ContactPersonFilterStage.class);
@Override
protected void doExecute(@Nonnull final Item<Element> item) throws StageProcessingException {
@@ -76,7 +76,7 @@ public class RemoveOrganizationStage extends AbstractIteratingStage<Element> {
final List<Element> organizations =
ElementSupport.getChildElementsByTagNameNS(entityDescriptor, SAMLMetadataSupport.MD_NS, "Organization");
if (!organizations.isEmpty()) {
- log.debug("{} pipeline stage filtering Organization from EntityDescriptor {}", getId(), entityId);
+ LOG.debug("{} pipeline stage filtering Organization from EntityDescriptor {}", getId(), entityId);
for (final Element organization : organizations) {
entityDescriptor.removeChild(organization);
}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/mdattr/EntityAttributeAddingStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/mdattr/EntityAttributeAddingStage.java
index 3b9f838..f82d958 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/mdattr/EntityAttributeAddingStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/mdattr/EntityAttributeAddingStage.java
@@ -25,7 +25,6 @@ import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;
import net.shibboleth.metadata.Item;
@@ -41,6 +40,7 @@ import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* A stage which adds entity attribute values to entity definitions.
@@ -51,7 +51,7 @@ import net.shibboleth.shared.logic.Constraint;
public class EntityAttributeAddingStage extends AbstractStage<Element> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(EntityAttributeAddingStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(EntityAttributeAddingStage.class);
/**
* The <code>Name</code> of the attribute to be added.
@@ -215,7 +215,7 @@ public class EntityAttributeAddingStage extends AbstractStage<Element> {
// If any of the existing attribute values match our value, we're done
if (attributeValuePresent(attributes, attributeValueMatcher)) {
- log.debug("attribute value '{}' already present", value);
+ LOG.debug("attribute value '{}' already present", value);
return;
}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/mdattr/EntityAttributeFilteringStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/mdattr/EntityAttributeFilteringStage.java
index f220323..c2db56a 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/mdattr/EntityAttributeFilteringStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/mdattr/EntityAttributeFilteringStage.java
@@ -27,7 +27,6 @@ import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.ThreadSafe;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -41,6 +40,7 @@ import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.xml.ElementSupport;
/**
@@ -63,7 +63,7 @@ import net.shibboleth.shared.xml.ElementSupport;
public class EntityAttributeFilteringStage extends AbstractIteratingStage<Element> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(EntityAttributeFilteringStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(EntityAttributeFilteringStage.class);
/**
* An entity attribute context against which matches can take place. It consists
@@ -334,7 +334,7 @@ public class EntityAttributeFilteringStage extends AbstractIteratingStage<Elemen
attributeNameFormat, registrationAuthority);
final boolean matched = applyRules(ctx);
if (matched ^ isWhitelisting()) {
- log.debug("removing {}", ctx);
+ LOG.debug("removing {}", ctx);
if (isRecordingRemovals()) {
item.getItemMetadata().put(new WarningStatus(getId(),
"removing '" + ctx.getName() + "' = '" + ctx.getValue() + "'"));
@@ -364,7 +364,7 @@ public class EntityAttributeFilteringStage extends AbstractIteratingStage<Elemen
// remove the Attribute container if it is now empty
if (ElementSupport.getFirstChildElement(attribute) == null) {
- log.debug("removing empty Attribute");
+ LOG.debug("removing empty Attribute");
entityAttributes.removeChild(attribute);
}
}
@@ -388,7 +388,7 @@ public class EntityAttributeFilteringStage extends AbstractIteratingStage<Elemen
// remove the EntityAttributes container if it is now empty
if (ElementSupport.getFirstChildElement(entityAttributes) == null) {
- log.debug("removing empty EntityAttributes");
+ LOG.debug("removing empty EntityAttributes");
final Node extensions = entityAttributes.getParentNode();
extensions.removeChild(entityAttributes);
}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/mdrpi/EntityRegistrationAuthorityFilterStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/mdrpi/EntityRegistrationAuthorityFilterStage.java
index 4ff2477..e79b8b0 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/mdrpi/EntityRegistrationAuthorityFilterStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/mdrpi/EntityRegistrationAuthorityFilterStage.java
@@ -18,7 +18,6 @@
package net.shibboleth.metadata.dom.saml.mdrpi;
import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -27,7 +26,6 @@ import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;
import net.shibboleth.metadata.Item;
@@ -36,6 +34,7 @@ import net.shibboleth.metadata.pipeline.AbstractFilteringStage;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.collection.CollectionSupport;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.xml.AttributeSupport;
import net.shibboleth.shared.xml.ElementSupport;
@@ -44,7 +43,7 @@ import net.shibboleth.shared.xml.ElementSupport;
public class EntityRegistrationAuthorityFilterStage extends AbstractFilteringStage<Element> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(EntityRegistrationAuthorityFilterStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(EntityRegistrationAuthorityFilterStage.class);
/** Whether a descriptor is required to have registration information. Default value: false */
@GuardedBy("this") private boolean requiringRegistrationInformation;
@@ -216,7 +215,7 @@ public class EntityRegistrationAuthorityFilterStage extends AbstractFilteringSta
SAMLMetadataSupport.getDescriptorExtension(descriptor, MDRPIMetadataSupport.MDRPI_REGISTRATION_INFO);
if (registrationInfoElement == null) {
if (isRequiringRegistrationInformation()) {
- log.debug(
+ LOG.debug(
"{} pipeline stage removing Item because it did not have " +
"required registration information extension",
getId());
@@ -228,7 +227,7 @@ public class EntityRegistrationAuthorityFilterStage extends AbstractFilteringSta
final String registrationAuthority =
AttributeSupport.getAttributeValue(registrationInfoElement, null, "registrationAuthority");
if (registrationAuthority == null) {
- log.debug(
+ LOG.debug(
"{} pipeline stage removing Item because it contained a registration info extension " +
"but no authority attribute",
getId());
@@ -237,14 +236,14 @@ public class EntityRegistrationAuthorityFilterStage extends AbstractFilteringSta
if (isWhitelistingRegistrationAuthorities() &&
!getDesignatedRegistrationAuthorities().contains(registrationAuthority)) {
- log.debug("{} pipeline stage removing Item because its registration authority was not on the whitelist",
+ LOG.debug("{} pipeline stage removing Item because its registration authority was not on the whitelist",
getId());
return true;
}
if (!isWhitelistingRegistrationAuthorities() &&
getDesignatedRegistrationAuthorities().contains(registrationAuthority)) {
- log.debug("{} pipeline stage removing Item because its registration authority was on the blacklist",
+ LOG.debug("{} pipeline stage removing Item because its registration authority was on the blacklist",
getId());
return true;
}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/FilesInDirectoryMultiOutputStrategy.java b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/FilesInDirectoryMultiOutputStrategy.java
index 4df0b20..0065fe9 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/FilesInDirectoryMultiOutputStrategy.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/FilesInDirectoryMultiOutputStrategy.java
@@ -30,7 +30,6 @@ import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.ThreadSafe;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.metadata.Item;
import net.shibboleth.metadata.ItemId;
@@ -39,6 +38,7 @@ import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.component.AbstractInitializableComponent;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* An output strategy for use with the {@link MultiOutputSerializationStage} which generates
@@ -61,7 +61,7 @@ public class FilesInDirectoryMultiOutputStrategy<T> extends AbstractInitializabl
implements MultiOutputSerializationStage.OutputStrategy<T> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(FilesInDirectoryMultiOutputStrategy.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(FilesInDirectoryMultiOutputStrategy.class);
/**
* Class implementing the returned {@link MultiOutputSerializationStage.Destination} objects.
@@ -191,7 +191,7 @@ public class FilesInDirectoryMultiOutputStrategy<T> extends AbstractInitializabl
// Construct file name
final String name = getNamePrefix() + getNameTransformer().apply(id.getId()) + getNameSuffix();
- log.debug("id mapped {} -> {}", id.getId(), name);
+ LOG.debug("id mapped {} -> {}", id.getId(), name);
// Locate the output file within the directory
final File outputFile = new File(getDirectory(), name);
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/ItemMetadataFilterStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/ItemMetadataFilterStage.java
index e08ec56..67a7fde 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/ItemMetadataFilterStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/ItemMetadataFilterStage.java
@@ -23,12 +23,12 @@ import javax.annotation.Nonnull;
import javax.annotation.concurrent.ThreadSafe;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.metadata.Item;
import net.shibboleth.metadata.ItemMetadata;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.collection.ClassToInstanceMultiMap;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* A {@link Stage} that filters out {@link Item} if they have a specific type of {@link ItemMetadata} attached to them.
@@ -42,7 +42,7 @@ import net.shibboleth.shared.collection.ClassToInstanceMultiMap;
public class ItemMetadataFilterStage<T> extends AbstractItemMetadataSelectionStage<T, ItemMetadata> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(ItemMetadataFilterStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(ItemMetadataFilterStage.class);
@Override
protected void doExecute(@Nonnull @NonnullElements final List<Item<T>> items,
@@ -51,7 +51,7 @@ public class ItemMetadataFilterStage<T> extends AbstractItemMetadataSelectionSta
throws StageProcessingException {
final String itemId = getItemIdentificationStrategy().getItemIdentifier(matchingItem);
- log.debug("Item {} was removed because it was marked with {}", itemId, matchingMetadata.keys());
+ LOG.debug("Item {} was removed because it was marked with {}", itemId, matchingMetadata.keys());
items.remove(matchingItem);
}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/ItemMetadataTerminationStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/ItemMetadataTerminationStage.java
index ee774a9..dbd6e43 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/ItemMetadataTerminationStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/ItemMetadataTerminationStage.java
@@ -23,12 +23,12 @@ import javax.annotation.Nonnull;
import javax.annotation.concurrent.ThreadSafe;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.metadata.Item;
import net.shibboleth.metadata.ItemMetadata;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.collection.ClassToInstanceMultiMap;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* A {@link Stage} that terminates pipeline processing if an {@link Item} has a specific type of {@link ItemMetadata}
@@ -40,7 +40,7 @@ import net.shibboleth.shared.collection.ClassToInstanceMultiMap;
public class ItemMetadataTerminationStage<T> extends AbstractItemMetadataSelectionStage<T, ItemMetadata> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(ItemMetadataTerminationStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(ItemMetadataTerminationStage.class);
@Override
protected void doExecute(@Nonnull @NonnullElements final List<Item<T>> items,
@@ -49,7 +49,7 @@ public class ItemMetadataTerminationStage<T> extends AbstractItemMetadataSelecti
throws TerminationException {
final String itemId = getItemIdentificationStrategy().getItemIdentifier(matchingItem);
- log.error("Item {} caused processing to terminate because it was marked with a {}", itemId,
+ LOG.error("Item {} caused processing to terminate because it was marked with a {}", itemId,
matchingMetadata.keys());
throw new TerminationException("Item " + itemId + " marked with metadata of type "
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/SerializationStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/SerializationStage.java
index 8ac6f10..bdd5eb8 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/SerializationStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/SerializationStage.java
@@ -28,7 +28,6 @@ import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.metadata.Item;
import net.shibboleth.metadata.ItemCollectionSerializer;
@@ -36,6 +35,7 @@ import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* A stage which writes the given item collection out to a file using a provided
@@ -54,7 +54,7 @@ import net.shibboleth.shared.logic.Constraint;
public class SerializationStage<T> extends AbstractStage<T> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(SerializationStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(SerializationStage.class);
/** File to which the item will be written. */
@NonnullAfterInit @GuardedBy("this")
@@ -163,7 +163,7 @@ public class SerializationStage<T> extends AbstractStage<T> {
+ outputFile.getAbsolutePath() + "'");
}
} else {
- log.warn(
+ LOG.warn(
"Unable to determine parent directory for output file {}, " +
"this may result in a problem during stage execution",
outputFile.getAbsolutePath());
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/SplitMergeStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/SplitMergeStage.java
index 191ba37..5dc8a2c 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/SplitMergeStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/SplitMergeStage.java
@@ -33,7 +33,6 @@ import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.metadata.CollectionMergeStrategy;
import net.shibboleth.metadata.Item;
@@ -47,6 +46,7 @@ import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.primitive.DeprecationSupport;
import net.shibboleth.shared.primitive.DeprecationSupport.ObjectType;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* A stage which splits a given collection according to a provided selection strategy
@@ -94,7 +94,7 @@ import net.shibboleth.shared.primitive.DeprecationSupport.ObjectType;
public class SplitMergeStage<T> extends AbstractStage<T> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(SplitMergeStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(SplitMergeStage.class);
/** {@link Executor} used to execute the pipelines. */
@Nonnull @GuardedBy("this")
@@ -332,12 +332,12 @@ public class SplitMergeStage<T> extends AbstractStage<T> {
}
if (selectedItemPipeline != null && !selectedItemPipeline.isInitialized()) {
- log.debug("Selected item pipeline was not initialized, initializing it now.");
+ LOG.debug("Selected item pipeline was not initialized, initializing it now.");
selectedItemPipeline.initialize();
}
if (nonselectedItemPipeline != null && !nonselectedItemPipeline.isInitialized()) {
- log.debug("Non-selected item pipeline was not initialized, initializing it now.");
+ LOG.debug("Non-selected item pipeline was not initialized, initializing it now.");
nonselectedItemPipeline.initialize();
}
}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/StatusMetadataLoggingStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/StatusMetadataLoggingStage.java
index c0abd42..bcf6faa 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/StatusMetadataLoggingStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/StatusMetadataLoggingStage.java
@@ -23,7 +23,6 @@ import javax.annotation.Nonnull;
import javax.annotation.concurrent.ThreadSafe;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.metadata.ErrorStatus;
import net.shibboleth.metadata.InfoStatus;
@@ -32,6 +31,7 @@ import net.shibboleth.metadata.StatusMetadata;
import net.shibboleth.metadata.WarningStatus;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.collection.ClassToInstanceMultiMap;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* A {@link Stage} that logs {@link StatusMetadata} associated with an {@link Item}.
@@ -42,7 +42,7 @@ import net.shibboleth.shared.collection.ClassToInstanceMultiMap;
public class StatusMetadataLoggingStage<T> extends AbstractItemMetadataSelectionStage<T, StatusMetadata> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(StatusMetadataLoggingStage.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(StatusMetadataLoggingStage.class);
@Override
protected void doExecute(
@@ -66,10 +66,10 @@ public class StatusMetadataLoggingStage<T> extends AbstractItemMetadataSelection
*/
private void logInfos(@Nonnull final String itemId,
@Nonnull @NonnullElements final List<InfoStatus> statuses) {
- if (!statuses.isEmpty() && log.isInfoEnabled()) {
- log.info("Item {} was marked with the following Info status messages", itemId);
+ if (!statuses.isEmpty() && LOG.isInfoEnabled()) {
+ LOG.info("Item {} was marked with the following Info status messages", itemId);
for (final var status : statuses) {
- log.info(" {}: {}", status.getComponentId(), status.getStatusMessage());
+ LOG.info(" {}: {}", status.getComponentId(), status.getStatusMessage());
}
}
}
@@ -82,10 +82,10 @@ public class StatusMetadataLoggingStage<T> extends AbstractItemMetadataSelection
*/
private void logWarnings(@Nonnull final String itemId,
@Nonnull @NonnullElements final List<WarningStatus> statuses) {
- if (!statuses.isEmpty() && log.isWarnEnabled()) {
- log.warn("Item {} was marked with the following Warning status messages", itemId);
+ if (!statuses.isEmpty() && LOG.isWarnEnabled()) {
+ LOG.warn("Item {} was marked with the following Warning status messages", itemId);
for (final var status : statuses) {
- log.warn(" {}: {}", status.getComponentId(), status.getStatusMessage());
+ LOG.warn(" {}: {}", status.getComponentId(), status.getStatusMessage());
}
}
}
@@ -98,10 +98,10 @@ public class StatusMetadataLoggingStage<T> extends AbstractItemMetadataSelection
*/
private void logErrors(@Nonnull final String itemId,
@Nonnull @NonnullElements final List<ErrorStatus> statuses) {
- if (!statuses.isEmpty() && log.isErrorEnabled()) {
- log.error("Item {} was marked with the following Error status messages", itemId);
+ if (!statuses.isEmpty() && LOG.isErrorEnabled()) {
+ LOG.error("Item {} was marked with the following Error status messages", itemId);
for (final var status : statuses) {
- log.error(" {}: {}", status.getComponentId(), status.getStatusMessage());
+ LOG.error(" {}: {}", status.getComponentId(), status.getStatusMessage());
}
}
}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/impl/FutureSupport.java b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/impl/FutureSupport.java
index 6f41519..0cc2d33 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/impl/FutureSupport.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/impl/FutureSupport.java
@@ -25,10 +25,10 @@ import javax.annotation.Nonnull;
import javax.annotation.concurrent.ThreadSafe;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.metadata.Item;
import net.shibboleth.metadata.pipeline.StageProcessingException;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* Helper class for dealing with {@link Future} values.
@@ -37,7 +37,7 @@ import net.shibboleth.metadata.pipeline.StageProcessingException;
public final class FutureSupport {
/** Class logger. */
- private static final Logger LOG = LoggerFactory.getLogger(FutureSupport.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(FutureSupport.class);
/** Constructor. */
private FutureSupport() {
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/impl/PipelineCallable.java b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/impl/PipelineCallable.java
index 47c0ced..5cc375b 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/impl/PipelineCallable.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/impl/PipelineCallable.java
@@ -24,13 +24,13 @@ import javax.annotation.Nonnull;
import javax.annotation.concurrent.Immutable;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.metadata.Item;
import net.shibboleth.metadata.pipeline.Pipeline;
import net.shibboleth.metadata.pipeline.PipelineProcessingException;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* A {@link Callable} that executes a {@link Pipeline} and returns the given item collection.
@@ -41,7 +41,7 @@ import net.shibboleth.shared.logic.Constraint;
public class PipelineCallable<T> implements Callable<List<Item<T>>> {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(PipelineCallable.class);
+ private static final @Nonnull Logger LOG = LoggerFactory.getLogger(PipelineCallable.class);
/** The pipeline to be executed, never null. */
private final @Nonnull Pipeline<T> thePipeline;
@@ -64,7 +64,7 @@ public class PipelineCallable<T> implements Callable<List<Item<T>>> {
}
@Override @Nonnull @NonnullElements public List<Item<T>> call() throws PipelineProcessingException {
- log.debug("Executing pipeline {} on an item collection containing {} items", thePipeline.getId(),
+ LOG.debug("Executing pipeline {} on an item collection containing {} items", thePipeline.getId(),
theItems.size());
thePipeline.execute(theItems);
return theItems;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list