[java-metadata-aggregator] 01/03: Checkstyle
Ian Young
ian at iay.org.uk
Wed Apr 5 13:55:26 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=82037c8d5e12ea7549a7dd9632e346ac8908b336
commit 82037c8d5e12ea7549a7dd9632e346ac8908b336
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Wed Apr 5 14:45:36 2023 +0100
Checkstyle
---
.../net/shibboleth/metadata/dom/DOMFilesystemSourceStage.java | 2 +-
.../net/shibboleth/metadata/dom/DOMResourceSourceStage.java | 2 +-
.../net/shibboleth/metadata/dom/impl/XMLSignatureSigner.java | 4 +++-
.../shibboleth/metadata/dom/impl/XMLSignatureValidator.java | 2 ++
.../shibboleth/metadata/dom/saml/EntityRoleFilterStage.java | 2 +-
.../metadata/dom/saml/PullUpCacheDurationStage.java | 11 ++++++-----
.../shibboleth/metadata/dom/saml/PullUpValidUntilStage.java | 5 +++--
7 files changed, 17 insertions(+), 11 deletions(-)
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 18c3609..8d204da 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
@@ -258,7 +258,7 @@ public class DOMFilesystemSourceStage extends AbstractStage<Element> {
if (files != null) {
final var recursing = getRecurseDirectories();
for (final File file : files) {
- if (file.isFile() || (file.isDirectory() && recursing)) {
+ if (file.isFile() || recursing && file.isDirectory()) {
getSourceFiles(file, collector);
}
}
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 7714760..1d19a0a 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
@@ -134,7 +134,7 @@ public class DOMResourceSourceStage extends AbstractStage<Element> {
throws StageProcessingException {
final var resource = getDOMResource();
- assert resource != null; // enforced by doInitialize
+ assert resource != null;
LOG.debug("Attempting to fetch XML document from '{}'", resource.getDescription());
try (@Nonnull InputStream ins = resource.getInputStream()) {
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/impl/XMLSignatureSigner.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/impl/XMLSignatureSigner.java
index bf1859f..fe0555e 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/impl/XMLSignatureSigner.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/impl/XMLSignatureSigner.java
@@ -396,7 +396,8 @@ public class XMLSignatureSigner {
*
* @return the ID value for the element, or null
*/
- @Nullable protected String getElementId(@Nonnull final Element target) {
+ // Checkstyle: CyclomaticComplexity OFF
+ protected @Nullable String getElementId(@Nonnull final Element target) {
final NamedNodeMap attributes = target.getAttributes();
if (attributes == null || attributes.getLength() < 1) {
return null;
@@ -429,6 +430,7 @@ public class XMLSignatureSigner {
return null;
}
+ // Checkstyle: CyclomaticComplexity ON
/**
* Builds the KeyInfo element to be included in the signature.
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 457909f..abe5534 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
@@ -207,6 +207,7 @@ public final class XMLSignatureValidator {
* @param signatureElement element containing the signature to be validated
* @throws ValidationException if any of a number of invalid conditions are detected
*/
+ // Checkstyle: CyclomaticComplexity OFF
public void verifySignature(@Nonnull final Element docElement, @Nonnull final Element signatureElement)
throws ValidationException {
@@ -278,6 +279,7 @@ public final class XMLSignatureValidator {
e.getMessage());
}
}
+ // Checkstyle: CyclomaticComplexity ON
/**
* Extract the reference within the provided XML signature while ensuring that there
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 d24b50d..db23fea 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
@@ -267,7 +267,7 @@ public class EntityRoleFilterStage extends AbstractFilteringStage<Element> {
if (roleIdentifier != null) {
final boolean isDesignatedRole = getDesignatedRoles().contains(roleIdentifier);
- if ((isWhitelistingRoles() && !isDesignatedRole) || (!isWhitelistingRoles() && isDesignatedRole)) {
+ if (isWhitelistingRoles() && !isDesignatedRole || !isWhitelistingRoles() && isDesignatedRole) {
LOG.debug("{} pipeline stage removing role {} from EntityDescriptor {}", new Object[] {getId(),
roleIdentifier, entityId,});
entityDescriptor.removeChild(child);
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/PullUpCacheDurationStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/PullUpCacheDurationStage.java
index d2766ac..6763789 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/PullUpCacheDurationStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/PullUpCacheDurationStage.java
@@ -115,8 +115,8 @@ public class PullUpCacheDurationStage extends AbstractIteratingStage<Element> {
* @return the shortest cache duration from the descriptor and its descendants or null if the descriptor does not
* contain a cache duration
*/
- @Nullable
- protected Duration getShortestCacheDuration(@Nonnull final Element descriptor) {
+ // Checkstyle: CyclomaticComplexity OFF
+ protected @Nullable Duration getShortestCacheDuration(@Nonnull final Element descriptor) {
Duration shortestCacheDuration = null;
if (!SAMLMetadataSupport.isEntityOrEntitiesDescriptor(descriptor)) {
return shortestCacheDuration;
@@ -129,7 +129,7 @@ public class PullUpCacheDurationStage extends AbstractIteratingStage<Element> {
assert entitiesDescriptor != null;
cacheDuration = getShortestCacheDuration(entitiesDescriptor);
if (cacheDuration != null &&
- (shortestCacheDuration == null || (cacheDuration.compareTo(shortestCacheDuration) < 0))) {
+ (shortestCacheDuration == null || cacheDuration.compareTo(shortestCacheDuration) < 0)) {
shortestCacheDuration = cacheDuration;
}
}
@@ -140,7 +140,7 @@ public class PullUpCacheDurationStage extends AbstractIteratingStage<Element> {
assert entityDescriptor != null;
cacheDuration = getShortestCacheDuration(entityDescriptor);
if (cacheDuration != null &&
- (shortestCacheDuration == null || (cacheDuration.compareTo(shortestCacheDuration) < 0))) {
+ (shortestCacheDuration == null || cacheDuration.compareTo(shortestCacheDuration) < 0)) {
shortestCacheDuration = cacheDuration;
}
}
@@ -150,7 +150,7 @@ public class PullUpCacheDurationStage extends AbstractIteratingStage<Element> {
if (cacheDurationAttr != null) {
cacheDuration = AttributeSupport.getDurationAttributeValue(cacheDurationAttr);
if (cacheDuration != null &&
- (shortestCacheDuration == null || (cacheDuration.compareTo(shortestCacheDuration) < 0))) {
+ (shortestCacheDuration == null || cacheDuration.compareTo(shortestCacheDuration) < 0)) {
shortestCacheDuration = cacheDuration;
}
@@ -159,6 +159,7 @@ public class PullUpCacheDurationStage extends AbstractIteratingStage<Element> {
return shortestCacheDuration;
}
+ // Checkstyle: CyclomaticComplexity ON
/**
* Sets the cache duration on the given descriptor. If the given cache duration is less than, or equal to, 0 no
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/PullUpValidUntilStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/PullUpValidUntilStage.java
index 518c323..395e12b 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/PullUpValidUntilStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/PullUpValidUntilStage.java
@@ -119,8 +119,8 @@ public class PullUpValidUntilStage extends AbstractIteratingStage<Element> {
* @return the shortest cache duration from the descriptor and its descendants or null if the descriptor does not
* contain a cache duration
*/
- @Nullable
- protected Instant getNearestValidUntil(@Nonnull final Element descriptor) {
+ // Checkstyle: CyclomaticComplexity OFF
+ protected @Nullable Instant getNearestValidUntil(@Nonnull final Element descriptor) {
Instant nearestValidUntil = null;
if (!SAMLMetadataSupport.isEntityOrEntitiesDescriptor(descriptor)) {
return nearestValidUntil;
@@ -160,6 +160,7 @@ public class PullUpValidUntilStage extends AbstractIteratingStage<Element> {
return nearestValidUntil;
}
+ // Checkstyle: CyclomaticComplexity ON
/**
* Sets the valid until instant on the given descriptor. If the given validUntil is null no instant is set. If the
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list