[java-identity-provider] branch main updated: IDP-2083 - Treat NonnullElements as the default for collections
Scott Cantor
cantor.2 at osu.edu
Tue Jun 20 18:40:57 UTC 2023
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=a9775ce7c36f477d7b9ff3e35696cd3f7897b0c3
The following commit(s) were added to refs/heads/main by this push:
new a9775ce7c IDP-2083 - Treat NonnullElements as the default for collections
a9775ce7c is described below
commit a9775ce7c36f477d7b9ff3e35696cd3f7897b0c3
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Jun 20 14:40:53 2023 -0400
IDP-2083 - Treat NonnullElements as the default for collections
https://shibboleth.atlassian.net/browse/IDP-2083
Review idp-consent-api/impl, idp-installer.
---
.../consent/context/AttributeReleaseContext.java | 8 +-
.../idp/consent/context/ConsentContext.java | 11 +-
.../idp/consent/context/package-info.java | 4 +-
.../net/shibboleth/idp/consent/package-info.java | 4 +-
.../idp/consent/audit/impl/package-info.java | 4 +-
.../idp/consent/flow/ar/impl/package-info.java | 4 +-
.../idp/consent/flow/impl/package-info.java | 4 +-
.../impl/AbstractConsentIndexedStorageAction.java | 9 +-
.../consent/flow/storage/impl/package-info.java | 4 +-
.../logic/impl/AttributeDisplayNameFunction.java | 8 +-
.../idp/consent/logic/impl/AttributePredicate.java | 12 +-
.../impl/AttributeReleaseConsentFunction.java | 4 +-
.../logic/impl/AttributeValueLookupFunction.java | 2 +-
.../logic/impl/AttributeValuesHashFunction.java | 20 +-
.../logic/impl/CounterStorageKeyComparator.java | 2 +-
.../logic/impl/CounterStorageKeyFunction.java | 2 +-
.../impl/GlobalAttributeConsentPredicate.java | 4 +-
.../logic/impl/IsAttributeRequiredPredicate.java | 2 +-
.../idp/consent/logic/impl/JoinFunction.java | 2 +-
.../consent/logic/impl/LocaleLookupFunction.java | 2 +-
.../logic/impl/MessageSourceConsentFunction.java | 4 +-
.../logic/impl/PreferExplicitOrderComparator.java | 5 +-
.../idp/consent/logic/impl/package-info.java | 4 +-
.../consent/storage/impl/CollectionSerializer.java | 3 +-
.../idp/consent/storage/impl/ConsentResult.java | 2 +-
.../consent/storage/impl/ConsentSerializer.java | 6 +-
.../idp/consent/storage/impl/package-info.java | 4 +-
.../shibboleth/idp/installer/InstallerSupport.java | 7 +-
.../installer/ProgressReportingOutputStream.java | 9 +-
.../idp/installer/impl/CopyDistribution.java | 12 +-
.../idp/installer/impl/CurrentInstallState.java | 45 +++-
.../idp/installer/impl/IdPBuildArguments.java | 2 +-
.../shibboleth/idp/installer/impl/IdPBuildWar.java | 12 +-
.../idp/installer/impl/IdPInstallerArguments.java | 2 +-
.../idp/installer/impl/IdPInstallerCLI.java | 11 +-
.../idp/installer/impl/InstallerProperties.java | 251 +++++++++++++--------
.../idp/installer/impl/UpdateIdPArguments.java | 4 +-
.../idp/installer/impl/UpdateIdPCLI.java | 11 +-
.../shibboleth/idp/installer/impl/V5Install.java | 2 +-
.../idp/installer/impl/package-info.java | 5 +-
.../installer/metadata/impl/MetadataGenerator.java | 27 +--
.../metadata/impl/MetadataGeneratorParameters.java | 33 +--
.../idp/installer/metadata/impl/package-info.java | 5 +-
.../net/shibboleth/idp/installer/package-info.java | 5 +-
.../idp/installer/plugin/impl/LoggingVisitor.java | 29 ++-
.../idp/installer/plugin/impl/PluginInstaller.java | 32 +--
.../installer/plugin/impl/PluginInstallerCLI.java | 3 +-
.../plugin/impl/RollbackPluginInstall.java | 2 +-
.../idp/installer/plugin/impl/TrustStore.java | 15 +-
.../idp/installer/plugin/impl/package-info.java | 5 +-
50 files changed, 399 insertions(+), 270 deletions(-)
diff --git a/idp-consent-api/src/main/java/net/shibboleth/idp/consent/context/AttributeReleaseContext.java b/idp-consent-api/src/main/java/net/shibboleth/idp/consent/context/AttributeReleaseContext.java
index ff3e478a8..fedbd40b0 100644
--- a/idp-consent-api/src/main/java/net/shibboleth/idp/consent/context/AttributeReleaseContext.java
+++ b/idp-consent-api/src/main/java/net/shibboleth/idp/consent/context/AttributeReleaseContext.java
@@ -24,7 +24,6 @@ import javax.annotation.Nonnull;
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.shared.annotation.constraint.Live;
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
import org.opensaml.messaging.context.BaseContext;
@@ -38,7 +37,7 @@ import com.google.common.base.MoreObjects;
public final class AttributeReleaseContext extends BaseContext {
/** Attributes to be consented to. */
- @Nonnull @NonnullElements @Live private Map<String, IdPAttribute> consentableAttributes;
+ @Nonnull @Live private Map<String, IdPAttribute> consentableAttributes;
/** Constructor. */
public AttributeReleaseContext() {
@@ -50,7 +49,7 @@ public final class AttributeReleaseContext extends BaseContext {
*
* @return the attributes to be consented to
*/
- @Nonnull @NonnullElements @Live public Map<String, IdPAttribute> getConsentableAttributes() {
+ @Nonnull @Live public Map<String, IdPAttribute> getConsentableAttributes() {
return consentableAttributes;
}
@@ -60,4 +59,5 @@ public final class AttributeReleaseContext extends BaseContext {
.add("consentableAttributes", consentableAttributes)
.toString();
}
-}
+
+}
\ No newline at end of file
diff --git a/idp-consent-api/src/main/java/net/shibboleth/idp/consent/context/ConsentContext.java b/idp-consent-api/src/main/java/net/shibboleth/idp/consent/context/ConsentContext.java
index 650ead6c4..eaf9be768 100644
--- a/idp-consent-api/src/main/java/net/shibboleth/idp/consent/context/ConsentContext.java
+++ b/idp-consent-api/src/main/java/net/shibboleth/idp/consent/context/ConsentContext.java
@@ -24,7 +24,6 @@ import javax.annotation.Nonnull;
import net.shibboleth.idp.consent.Consent;
import net.shibboleth.shared.annotation.constraint.Live;
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
import org.opensaml.messaging.context.BaseContext;
@@ -38,10 +37,10 @@ import com.google.common.base.MoreObjects;
public final class ConsentContext extends BaseContext {
/** Map of previous consent read from storage and keyed by consent id. */
- @Nonnull @NonnullElements @Live private Map<String, Consent> previousConsents;
+ @Nonnull @Live private Map<String, Consent> previousConsents;
/** Map of current consent extracted from user input and keyed by consent id. */
- @Nonnull @NonnullElements @Live private Map<String, Consent> currentConsents;
+ @Nonnull @Live private Map<String, Consent> currentConsents;
/** Constructor. */
public ConsentContext() {
@@ -54,7 +53,7 @@ public final class ConsentContext extends BaseContext {
*
* @return map of current consent extracted from user input and keyed by consent id
*/
- @Nonnull @NonnullElements @Live public Map<String, Consent> getCurrentConsents() {
+ @Nonnull @Live public Map<String, Consent> getCurrentConsents() {
return currentConsents;
}
@@ -63,7 +62,7 @@ public final class ConsentContext extends BaseContext {
*
* @return map of previous consent read from storage and keyed by consent id
*/
- @Nonnull @NonnullElements @Live public Map<String, Consent> getPreviousConsents() {
+ @Nonnull @Live public Map<String, Consent> getPreviousConsents() {
return previousConsents;
}
@@ -75,4 +74,4 @@ public final class ConsentContext extends BaseContext {
.toString();
}
-}
+}
\ No newline at end of file
diff --git a/idp-consent-api/src/main/java/net/shibboleth/idp/consent/context/package-info.java b/idp-consent-api/src/main/java/net/shibboleth/idp/consent/context/package-info.java
index ac866a7d2..ffc30aa58 100644
--- a/idp-consent-api/src/main/java/net/shibboleth/idp/consent/context/package-info.java
+++ b/idp-consent-api/src/main/java/net/shibboleth/idp/consent/context/package-info.java
@@ -18,5 +18,7 @@
/**
* Context classes related to consent flows.
*/
+ at NonnullElements
+package net.shibboleth.idp.consent.context;
-package net.shibboleth.idp.consent.context;
\ No newline at end of file
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/idp-consent-api/src/main/java/net/shibboleth/idp/consent/package-info.java b/idp-consent-api/src/main/java/net/shibboleth/idp/consent/package-info.java
index 23254b852..bf0302a60 100644
--- a/idp-consent-api/src/main/java/net/shibboleth/idp/consent/package-info.java
+++ b/idp-consent-api/src/main/java/net/shibboleth/idp/consent/package-info.java
@@ -18,5 +18,7 @@
/**
* Classed related to consent.
*/
+ at NonnullElements
+package net.shibboleth.idp.consent;
-package net.shibboleth.idp.consent;
\ No newline at end of file
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/audit/impl/package-info.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/audit/impl/package-info.java
index d14b8f889..bd5b9495c 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/audit/impl/package-info.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/audit/impl/package-info.java
@@ -18,5 +18,7 @@
/**
* Classes implementing consent-specific audit log behavior.
*/
+ at NonnullElements
+package net.shibboleth.idp.consent.audit.impl;
-package net.shibboleth.idp.consent.audit.impl;
\ No newline at end of file
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/ar/impl/package-info.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/ar/impl/package-info.java
index 632ef59c1..3f8fccd32 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/ar/impl/package-info.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/ar/impl/package-info.java
@@ -18,5 +18,7 @@
/**
* Actions and flow descriptors related to attribute release consent.
*/
+ at NonnullElements
+package net.shibboleth.idp.consent.flow.ar.impl;
-package net.shibboleth.idp.consent.flow.ar.impl;
\ No newline at end of file
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/impl/package-info.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/impl/package-info.java
index 7a12e24ef..62af1ad33 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/impl/package-info.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/impl/package-info.java
@@ -18,5 +18,7 @@
/**
* Actions and flow descriptors related to consent.
*/
+ at NonnullElements
+package net.shibboleth.idp.consent.flow.impl;
-package net.shibboleth.idp.consent.flow.impl;
\ No newline at end of file
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/storage/impl/AbstractConsentIndexedStorageAction.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/storage/impl/AbstractConsentIndexedStorageAction.java
index 2d2a70520..5755547e7 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/storage/impl/AbstractConsentIndexedStorageAction.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/storage/impl/AbstractConsentIndexedStorageAction.java
@@ -40,8 +40,9 @@ import net.shibboleth.idp.consent.storage.impl.CollectionSerializer;
import net.shibboleth.idp.profile.context.ProfileInterceptorContext;
import net.shibboleth.idp.profile.interceptor.ProfileInterceptorResult;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.collection.Pair;
import net.shibboleth.shared.component.ComponentInitializationException;
@@ -77,7 +78,6 @@ public class AbstractConsentIndexedStorageAction extends AbstractConsentStorageA
/** Constructor. */
public AbstractConsentIndexedStorageAction() {
- super();
storageKeysSerializer = new CollectionSerializer();
}
@@ -164,7 +164,7 @@ public class AbstractConsentIndexedStorageAction extends AbstractConsentStorageA
* @return the storage keys from the storage index record
* @throws IOException if errors occur in the read process
*/
- @Nonnull @NonnullElements protected List<String> getStorageKeysFromIndex() throws IOException {
+ @Nonnull @Unmodifiable @NotLive protected List<String> getStorageKeysFromIndex() throws IOException {
final StorageService service = getStorageService();
final String context = getStorageContext();
@@ -375,4 +375,5 @@ public class AbstractConsentIndexedStorageAction extends AbstractConsentStorageA
addKeyToStorageIndex(result.getStorageKey());
}
-}
+
+}
\ No newline at end of file
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/storage/impl/package-info.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/storage/impl/package-info.java
index 01096ffa8..afa9b8999 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/storage/impl/package-info.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/storage/impl/package-info.java
@@ -18,5 +18,7 @@
/**
* Actions related to consent storage.
*/
+ at NonnullElements
+package net.shibboleth.idp.consent.flow.storage.impl;
-package net.shibboleth.idp.consent.flow.storage.impl;
\ No newline at end of file
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeDisplayNameFunction.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeDisplayNameFunction.java
index 452834add..316d06161 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeDisplayNameFunction.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeDisplayNameFunction.java
@@ -27,6 +27,8 @@ import javax.annotation.Nullable;
import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.service.ReloadableService;
/**
@@ -49,9 +51,11 @@ public class AttributeDisplayNameFunction extends AbstractAttributeDisplayFuncti
}
/** {@inheritDoc} */
- @Override @Nonnull protected Map<Locale, String> getDisplayInfo(
+ @Override
+ @Nonnull @Unmodifiable @NotLive protected Map<Locale, String> getDisplayInfo(
@Nonnull final AttributeTranscoderRegistry registry,
@Nonnull final IdPAttribute attribute) {
return registry.getDisplayNames(attribute);
}
-}
+
+}
\ No newline at end of file
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributePredicate.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributePredicate.java
index 5f9b97fbb..42b6ae7bf 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributePredicate.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributePredicate.java
@@ -29,7 +29,6 @@ import javax.annotation.Nullable;
import net.shibboleth.idp.attribute.EmptyAttributeValue;
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.IdPAttributeValue;
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.AbstractInitializableComponent;
import net.shibboleth.shared.primitive.StringSupport;
@@ -40,10 +39,10 @@ import net.shibboleth.shared.primitive.StringSupport;
public class AttributePredicate extends AbstractInitializableComponent implements Predicate<IdPAttribute> {
/** Set of attribute IDs for which to prompt for consent. */
- @Nonnull @NonnullElements private Set<String> promptedAttributeIds;
+ @Nonnull private Set<String> promptedAttributeIds;
/** Set of attribute IDs to ignore for consent. */
- @Nonnull @NonnullElements private Set<String> ignoredAttributeIds;
+ @Nonnull private Set<String> ignoredAttributeIds;
/** Regular expression to apply for acceptance testing. */
@Nullable private Pattern matchExpression;
@@ -59,7 +58,7 @@ public class AttributePredicate extends AbstractInitializableComponent implement
*
* @param prompted prompted attribute IDs
*/
- public void setPromptedAttributeIds(@Nullable @NonnullElements final Collection<String> prompted) {
+ public void setPromptedAttributeIds(@Nullable final Collection<String> prompted) {
checkSetterPreconditions();
promptedAttributeIds = new HashSet<>(StringSupport.normalizeStringCollection(prompted));
}
@@ -69,7 +68,7 @@ public class AttributePredicate extends AbstractInitializableComponent implement
*
* @param ignored ignored attribute IDs
*/
- public void setIgnoredAttributeIds(@Nullable @NonnullElements final Collection<String> ignored) {
+ public void setIgnoredAttributeIds(@Nullable final Collection<String> ignored) {
checkSetterPreconditions();
ignoredAttributeIds = new HashSet<>(StringSupport.normalizeStringCollection(ignored));
}
@@ -131,4 +130,5 @@ public class AttributePredicate extends AbstractInitializableComponent implement
return true;
}
-}
+
+}
\ No newline at end of file
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeReleaseConsentFunction.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeReleaseConsentFunction.java
index c0d0417c9..e1e1f8ba5 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeReleaseConsentFunction.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeReleaseConsentFunction.java
@@ -97,7 +97,7 @@ public class AttributeReleaseConsentFunction implements Function<ProfileRequestC
}
/** {@inheritDoc} */
- /// CheckStyle: CyclomaticComplexity OFF
+// CheckStyle: CyclomaticComplexity OFF
@Override @Nullable public Map<String, Consent> apply(@Nullable final ProfileRequestContext input) {
if (input == null) {
return null;
@@ -159,6 +159,6 @@ public class AttributeReleaseConsentFunction implements Function<ProfileRequestC
return currentConsents;
}
- // CheckStyle: CyclomaticComplexity ON
+// CheckStyle: CyclomaticComplexity ON
}
\ No newline at end of file
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeValueLookupFunction.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeValueLookupFunction.java
index 332cc4fa5..171375ca6 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeValueLookupFunction.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeValueLookupFunction.java
@@ -130,4 +130,4 @@ public class AttributeValueLookupFunction implements ContextDataLookupFunction<P
return null;
}
-}
+}
\ No newline at end of file
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeValuesHashFunction.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeValuesHashFunction.java
index c984fd722..0a2dfbe5e 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeValuesHashFunction.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeValuesHashFunction.java
@@ -23,7 +23,6 @@ import java.io.ObjectOutputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Collection;
-import java.util.List;
import java.util.function.Function;
import javax.annotation.Nonnull;
@@ -41,7 +40,6 @@ import net.shibboleth.idp.attribute.IdPAttributeValue;
import net.shibboleth.idp.attribute.ScopedStringAttributeValue;
import net.shibboleth.idp.attribute.StringAttributeValue;
import net.shibboleth.idp.attribute.XMLObjectAttributeValue;
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.codec.Base64Support;
import net.shibboleth.shared.codec.EncodingException;
import net.shibboleth.shared.primitive.LoggerFactory;
@@ -60,24 +58,18 @@ public class AttributeValuesHashFunction implements Function<Collection<IdPAttri
/** Class logger. */
@Nonnull private final Logger log = LoggerFactory.getLogger(AttributeValuesHashFunction.class);
- // CheckStyle: CyclomaticComplexity OFF
+// CheckStyle: CyclomaticComplexity OFF
/** {@inheritDoc} */
- @Nullable public String apply(@Nullable @NonnullElements final Collection<IdPAttributeValue> input) {
+ @Nullable public String apply(@Nullable final Collection<IdPAttributeValue> input) {
- if (input == null) {
- return null;
- }
-
- final Collection<IdPAttributeValue> filteredInput = List.copyOf(input);
-
- if (filteredInput.isEmpty()) {
+ if (input == null || input.isEmpty()) {
return null;
}
try (final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
final ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream)) {
- for (final IdPAttributeValue value : filteredInput) {
+ for (final IdPAttributeValue value : input) {
if (log.isTraceEnabled()) {
log.trace("Considering value of '{}' with native value {}",
value.getClass(), value.getNativeValue());
@@ -113,8 +105,6 @@ public class AttributeValuesHashFunction implements Function<Collection<IdPAttri
} else if (value.getNativeValue() != null) {
log.debug("Unknown atribute value '{}' hashed as {}", value.getClass(), value.getNativeValue());
objectOutputStream.writeObject(value.getNativeValue());
- } else {
- log.warn("Unknown attribute value '{}' with no value was not hashed", value.getClass());
}
}
@@ -130,6 +120,6 @@ public class AttributeValuesHashFunction implements Function<Collection<IdPAttri
return null;
}
}
- // CheckStyle: CyclomaticComplexity ON
+// CheckStyle: CyclomaticComplexity ON
}
\ No newline at end of file
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/CounterStorageKeyComparator.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/CounterStorageKeyComparator.java
index 008fb59d9..c1a85eea7 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/CounterStorageKeyComparator.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/CounterStorageKeyComparator.java
@@ -74,4 +74,4 @@ public class CounterStorageKeyComparator implements Comparator<String> {
}
-}
+}
\ No newline at end of file
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/CounterStorageKeyFunction.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/CounterStorageKeyFunction.java
index 36136c0fd..aa9c5f014 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/CounterStorageKeyFunction.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/CounterStorageKeyFunction.java
@@ -221,4 +221,4 @@ public class CounterStorageKeyFunction extends AbstractInitializableComponent im
}
}
-}
+}
\ No newline at end of file
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/GlobalAttributeConsentPredicate.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/GlobalAttributeConsentPredicate.java
index abc367f61..320a23b10 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/GlobalAttributeConsentPredicate.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/GlobalAttributeConsentPredicate.java
@@ -26,11 +26,9 @@ import javax.annotation.Nullable;
import org.opensaml.messaging.context.navigate.ChildContextLookup;
import org.opensaml.profile.context.ProfileRequestContext;
-import org.slf4j.Logger;
import net.shibboleth.idp.consent.Consent;
import net.shibboleth.idp.consent.context.ConsentContext;
-import net.shibboleth.shared.primitive.LoggerFactory;
/**
* Predicate to determine whether global consent has been given by user.
@@ -66,4 +64,4 @@ public class GlobalAttributeConsentPredicate implements Predicate<ProfileRequest
return false;
}
-}
+}
\ No newline at end of file
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/IsAttributeRequiredPredicate.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/IsAttributeRequiredPredicate.java
index 1b055a3c3..06fa3aefb 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/IsAttributeRequiredPredicate.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/IsAttributeRequiredPredicate.java
@@ -145,4 +145,4 @@ public class IsAttributeRequiredPredicate implements Predicate<IdPAttribute> {
return false;
}
-}
+}
\ No newline at end of file
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/JoinFunction.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/JoinFunction.java
index f85f8b05a..ea5a71428 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/JoinFunction.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/JoinFunction.java
@@ -82,4 +82,4 @@ public class JoinFunction implements Function<ProfileRequestContext,String> {
return result;
}
-}
+}
\ No newline at end of file
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/LocaleLookupFunction.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/LocaleLookupFunction.java
index 69125dbb3..0e38a6279 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/LocaleLookupFunction.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/LocaleLookupFunction.java
@@ -47,4 +47,4 @@ public class LocaleLookupFunction implements Function<ProfileRequestContext, Loc
return null;
}
-}
+}
\ No newline at end of file
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/MessageSourceConsentFunction.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/MessageSourceConsentFunction.java
index 7f29e838e..e63672666 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/MessageSourceConsentFunction.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/MessageSourceConsentFunction.java
@@ -35,6 +35,8 @@ import net.shibboleth.idp.consent.flow.impl.ConsentFlowDescriptor;
import net.shibboleth.profile.context.navigate.RelyingPartyIdLookupFunction;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.codec.StringDigester;
import net.shibboleth.shared.codec.StringDigester.OutputFormat;
import net.shibboleth.shared.collection.CollectionSupport;
@@ -168,7 +170,7 @@ public class MessageSourceConsentFunction extends AbstractInitializableComponent
}
/** {@inheritDoc} */
- @Nullable public Map<String,Consent> apply(@Nullable final ProfileRequestContext input) {
+ @Nullable @Unmodifiable @NotLive public Map<String,Consent> apply(@Nullable final ProfileRequestContext input) {
if (input == null) {
return null;
}
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/PreferExplicitOrderComparator.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/PreferExplicitOrderComparator.java
index 4d9785a2b..62317944f 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/PreferExplicitOrderComparator.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/PreferExplicitOrderComparator.java
@@ -26,7 +26,6 @@ import javax.annotation.Nullable;
import com.google.common.collect.Ordering;
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NullableElements;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.collection.CollectionSupport;
@@ -47,7 +46,7 @@ public class PreferExplicitOrderComparator implements Comparator<String> {
@Nonnull final private Ordering<String> explicitOrdering;
/** Strings in order. */
- @Nonnull @NonnullElements @Unmodifiable final private List<String> explicitOrder;
+ @Nonnull @Unmodifiable final private List<String> explicitOrder;
/**
* Constructor.
@@ -97,4 +96,4 @@ public class PreferExplicitOrderComparator implements Comparator<String> {
return Ordering.natural().compare(o1, o2);
}
-}
+}
\ No newline at end of file
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/package-info.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/package-info.java
index 9654ad03c..08a8a2e65 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/package-info.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/package-info.java
@@ -18,5 +18,7 @@
/**
* Predicates and functions related to attribute consent.
*/
+ at NonnullElements
+package net.shibboleth.idp.consent.logic.impl;
-package net.shibboleth.idp.consent.logic.impl;
\ No newline at end of file
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/storage/impl/CollectionSerializer.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/storage/impl/CollectionSerializer.java
index 363a99f58..d90b160f3 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/storage/impl/CollectionSerializer.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/storage/impl/CollectionSerializer.java
@@ -60,6 +60,7 @@ public class CollectionSerializer extends AbstractInitializableComponent impleme
@Nonnull private final JsonReaderFactory readerFactory;
/** Constructor. */
+ @SuppressWarnings("null")
public CollectionSerializer() {
final JsonProvider provider = JsonProvider.provider();
generatorFactory = provider.createGeneratorFactory(null);
@@ -113,4 +114,4 @@ public class CollectionSerializer extends AbstractInitializableComponent impleme
return collection;
}
-}
+}
\ No newline at end of file
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/storage/impl/ConsentResult.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/storage/impl/ConsentResult.java
index 903633b01..1dbeff3e0 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/storage/impl/ConsentResult.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/storage/impl/ConsentResult.java
@@ -60,4 +60,4 @@ public class ConsentResult extends AbstractProfileInterceptorResult {
.toString();
}
-}
+}
\ No newline at end of file
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/storage/impl/ConsentSerializer.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/storage/impl/ConsentSerializer.java
index f47b34b5b..81acd261c 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/storage/impl/ConsentSerializer.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/storage/impl/ConsentSerializer.java
@@ -83,6 +83,7 @@ public class ConsentSerializer extends AbstractInitializableComponent implements
@Nonnull @NonnullElements private BiMap<String, Integer> symbolics;
/** Constructor. */
+ @SuppressWarnings("null")
public ConsentSerializer() {
final JsonProvider provider = JsonProvider.provider();
generatorFactory = provider.createGeneratorFactory(null);
@@ -108,9 +109,6 @@ public class ConsentSerializer extends AbstractInitializableComponent implements
* @return the resulting string, or null if invalid
*/
@Nullable protected String desymbolize(@Nonnull final JsonValue field) {
- if (field == null) {
- return null;
- }
switch (field.getValueType()) {
case STRING:
return ((JsonString) field).getString();
@@ -206,4 +204,4 @@ public class ConsentSerializer extends AbstractInitializableComponent implements
return serialized;
}
-}
+}
\ No newline at end of file
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/storage/impl/package-info.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/storage/impl/package-info.java
index dc8cab1e8..41760544d 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/storage/impl/package-info.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/storage/impl/package-info.java
@@ -18,5 +18,7 @@
/**
* Storage and serialization classes related to attribute consent.
*/
+ at NonnullElements
+package net.shibboleth.idp.consent.storage.impl;
-package net.shibboleth.idp.consent.storage.impl;
\ No newline at end of file
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerSupport.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerSupport.java
index dd9a25462..014b2d68f 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerSupport.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerSupport.java
@@ -50,6 +50,7 @@ import org.slf4j.Logger;
import net.shibboleth.idp.installer.plugin.impl.LoggingVisitor;
import net.shibboleth.shared.annotation.constraint.Live;
+import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.collection.Pair;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.primitive.LoggerFactory;
@@ -62,13 +63,13 @@ import net.shibboleth.shared.spring.httpclient.resource.HTTPResource;
public final class InstallerSupport {
/** The name of the file and the property with the current V4 installation value.*/
- public static final String VERSION_NAME = "idp.installed.version";
+ @Nonnull @NotEmpty public static final String VERSION_NAME = "idp.installed.version";
/** The name of the file and the property with the previous installation value.*/
- public static final String PREVIOUS_VERSION_NAME = "idp.previous.installed.version";
+ @Nonnull @NotEmpty public static final String PREVIOUS_VERSION_NAME = "idp.previous.installed.version";
/** A psuedo ant-project as parent. */
- private static final Project ANT_PROJECT = new Project();
+ @Nonnull private static final Project ANT_PROJECT = new Project();
/** Log. */
@Nonnull private static Logger log = LoggerFactory.getLogger(InstallerSupport.class);
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/ProgressReportingOutputStream.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/ProgressReportingOutputStream.java
index 47cb007b8..b56bbc3a7 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/ProgressReportingOutputStream.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/ProgressReportingOutputStream.java
@@ -21,6 +21,8 @@ import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
+import javax.annotation.Nonnull;
+
/**
* A version of {@link BufferedOutputStream} which provides some idea of progress.
*/
@@ -38,7 +40,7 @@ public class ProgressReportingOutputStream extends BufferedOutputStream {
/** Constructor.
* @param outStream what to bracket.
*/
- public ProgressReportingOutputStream(final OutputStream outStream) {
+ public ProgressReportingOutputStream(@Nonnull final OutputStream outStream) {
super(outStream);
}
@@ -46,7 +48,7 @@ public class ProgressReportingOutputStream extends BufferedOutputStream {
* @param outStream what to bracket.
* @param size buffer size
*/
- public ProgressReportingOutputStream(final OutputStream outStream, final int size) {
+ public ProgressReportingOutputStream(@Nonnull final OutputStream outStream, final int size) {
super(outStream, size);
}
@@ -71,4 +73,5 @@ public class ProgressReportingOutputStream extends BufferedOutputStream {
System.out.println();
}
}
-}
+
+}
\ No newline at end of file
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CopyDistribution.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CopyDistribution.java
index 6db1dc271..8ebcf2847 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CopyDistribution.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CopyDistribution.java
@@ -37,7 +37,7 @@ import net.shibboleth.shared.primitive.LoggerFactory;
public final class CopyDistribution {
/** Log. */
- private final Logger log = LoggerFactory.getLogger(CopyDistribution.class);
+ @Nonnull private final Logger log = LoggerFactory.getLogger(CopyDistribution.class);
/** Properties for the job. */
@Nonnull private final InstallerProperties installerProps;
@@ -100,8 +100,8 @@ public final class CopyDistribution {
* @param overwrite whether we want to overwrite
* @throws BuildException if badness occurs
*/
- private void distCopy(final Path srcDist, final Path dist, final String to, final boolean overwrite)
- throws BuildException {
+ private void distCopy(@Nonnull final Path srcDist, @Nonnull final Path dist, @Nonnull final String to,
+ final boolean overwrite) throws BuildException {
final Path toPath = dist.resolve(to);
final Path fromPath = srcDist.resolve(to);
log.debug("Copying distribution from {} to {}", fromPath, toPath);
@@ -118,7 +118,8 @@ public final class CopyDistribution {
* @param to the subfolder name
* @throws BuildException if badness occurs
*/
- private void distCopy(final Path srcDist, final Path dist, final String to) throws BuildException {
+ private void distCopy(@Nonnull final Path srcDist, @Nonnull final Path dist, @Nonnull final String to)
+ throws BuildException {
distCopy(srcDist, dist, to, false);
}
@@ -150,4 +151,5 @@ public final class CopyDistribution {
copy.setOverwrite(false);
copy.execute();
}
-}
+
+}
\ No newline at end of file
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CurrentInstallState.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CurrentInstallState.java
index 0c6d56ed5..0d55cc6bf 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CurrentInstallState.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CurrentInstallState.java
@@ -76,7 +76,7 @@ public final class CurrentInstallState extends AbstractInitializableComponent {
private boolean ldapPropertiesPresent;
/** Old Version. */
- private String oldVersion;
+ @Nullable private String oldVersion;
/** The files to delete after an upgrade. */
@NonnullAfterInit private List<Path> pathsToDelete;
@@ -92,7 +92,9 @@ public final class CurrentInstallState extends AbstractInitializableComponent {
enabledModules = CollectionSupport.emptySet();
}
- /** Work out what the "current" install state is (before we do any more work).
+ /**
+ * Work out what the "current" install state is (before we do any more work).
+ *
* @throws ComponentInitializationException if we find a strange state
*/
private void findPreviousVersion() throws ComponentInitializationException {
@@ -186,33 +188,57 @@ public final class CurrentInstallState extends AbstractInitializableComponent {
}
}
- /** {@inheritDoc} */
+ /**
+ * Get installed IdP version.
+ *
+ * @return installed version
+ */
@Nullable public String getInstalledVersion() {
return oldVersion;
}
- /** {@inheritDoc} */
+ /**
+ * Get whether the idp.properties file is present.
+ *
+ * @return whether the idp.properties file is present
+ */
public boolean isIdPPropertiesPresent() {
return idpPropertiesPresent;
}
- /** {@inheritDoc} */
+ /**
+ * Get whether the ldap.properties file is present.
+ *
+ * @return whether the ldap.properties file is present
+ */
public boolean isLDAPPropertiesPresent() {
return ldapPropertiesPresent;
}
- /** {@inheritDoc} */
+ /**
+ * Get list of paths to delete.
+ *
+ * @return list of paths to delete
+ */
public @Nonnull List<Path> getPathsToBeDeleted() {
assert pathsToDelete != null;
return pathsToDelete;
}
- /** {@inheritDoc} */
+ /**
+ * Get the module IDs that are enabled.
+ *
+ * @return enabled module IDs
+ */
@Nonnull public Collection<String> getEnabledModules() {
return enabledModules;
}
- /** {@inheritDoc} */
+ /**
+ * Get class loader for installed plugin detection.
+ *
+ * @return class loader
+ */
@Nullable public synchronized ClassLoader getInstalledPluginsLoader() {
if (installedPluginsLoader != null) {
@@ -257,4 +283,5 @@ public final class CurrentInstallState extends AbstractInitializableComponent {
installedPluginsLoader = new URLClassLoader(urls);
return installedPluginsLoader;
}
-}
+
+}
\ No newline at end of file
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/IdPBuildArguments.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/IdPBuildArguments.java
index 7d99ae834..8ad041064 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/IdPBuildArguments.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/IdPBuildArguments.java
@@ -36,7 +36,7 @@ public class IdPBuildArguments extends AbstractIdPHomeAwareCommandLineArguments
@Nullable private Logger log;
/** {@inheritDoc} */
- public @Nonnull Logger getLog() {
+ @Nonnull public Logger getLog() {
if (log == null) {
log = LoggerFactory.getLogger(IdPBuildArguments.class);
}
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/IdPBuildWar.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/IdPBuildWar.java
index 1007281d6..080cda636 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/IdPBuildWar.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/IdPBuildWar.java
@@ -39,15 +39,13 @@ public class IdPBuildWar extends AbstractCommandLine<IdPBuildArguments> {
/** {@inheritDoc} */
@Override
- @Nonnull
- protected Class<IdPBuildArguments> getArgumentClass() {
+ @Nonnull protected Class<IdPBuildArguments> getArgumentClass() {
return IdPBuildArguments.class;
}
/** {@inheritDoc} */
@Override
- @Nonnull
- protected String getVersion() {
+ @Nonnull protected String getVersion() {
final String result = Version.getVersion();
assert result != null;
return result;
@@ -55,8 +53,7 @@ public class IdPBuildWar extends AbstractCommandLine<IdPBuildArguments> {
/** {@inheritDoc} */
@Override
- @Nonnull
- protected Logger getLogger() {
+ @Nonnull protected Logger getLogger() {
Logger localLog = log;
if (localLog == null) {
localLog = log = LoggerFactory.getLogger(IdPBuildWar.class);
@@ -110,4 +107,5 @@ public class IdPBuildWar extends AbstractCommandLine<IdPBuildArguments> {
public static void main(@Nonnull final String[] args) {
System.exit(runMain(args));
}
-}
+
+}
\ No newline at end of file
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/IdPInstallerArguments.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/IdPInstallerArguments.java
index 18b8928f2..14da2194d 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/IdPInstallerArguments.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/IdPInstallerArguments.java
@@ -199,4 +199,4 @@ public class IdPInstallerArguments extends AbstractCommandLineArguments {
out.println();
}
-}
+}
\ No newline at end of file
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/IdPInstallerCLI.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/IdPInstallerCLI.java
index 9a7a5a953..59b0b3632 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/IdPInstallerCLI.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/IdPInstallerCLI.java
@@ -48,15 +48,13 @@ public class IdPInstallerCLI extends AbstractCommandLine<IdPInstallerArguments>
/** {@inheritDoc} */
@Override
- @Nonnull
- protected Class<IdPInstallerArguments> getArgumentClass() {
+ @Nonnull protected Class<IdPInstallerArguments> getArgumentClass() {
return IdPInstallerArguments.class;
}
/** {@inheritDoc} */
@Override
- @Nonnull
- protected String getVersion() {
+ @Nonnull protected String getVersion() {
final String result = Version.getVersion();
assert result != null;
return result;
@@ -64,8 +62,7 @@ public class IdPInstallerCLI extends AbstractCommandLine<IdPInstallerArguments>
/** {@inheritDoc} */
@Override
- @Nonnull
- protected Logger getLogger() {
+ @Nonnull protected Logger getLogger() {
Logger localLog = log;
if (localLog == null) {
localLog = log = LoggerFactory.getLogger(IdPInstallerCLI.class);
@@ -188,4 +185,4 @@ public class IdPInstallerCLI extends AbstractCommandLine<IdPInstallerArguments>
System.exit(runMain(args));
}
-}
+}
\ No newline at end of file
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstallerProperties.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstallerProperties.java
index 4c91e13aa..53f1e3532 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstallerProperties.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstallerProperties.java
@@ -41,6 +41,7 @@ import org.apache.tools.ant.input.InputRequest;
import org.slf4j.Logger;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
+import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.annotation.constraint.NotLive;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.collection.CollectionSupport;
@@ -57,62 +58,62 @@ import net.shibboleth.shared.primitive.StringSupport;
public class InstallerProperties {
/** The name of a property file to fill in some or all of the above. This file is deleted after processing. */
- public static final String PROPERTY_SOURCE_FILE = "idp.property.file";
+ @Nonnull @NotEmpty public static final String PROPERTY_SOURCE_FILE = "idp.property.file";
/** The name of a property file to merge with idp.properties. */
- public static final String IDP_PROPERTIES_MERGE = "idp.merge.properties";
+ @Nonnull @NotEmpty public static final String IDP_PROPERTIES_MERGE = "idp.merge.properties";
/** The name of a property file to merge with ldap.properties. */
- public static final String LDAP_PROPERTIES_MERGE = "ldap.merge.properties";
+ @Nonnull @NotEmpty public static final String LDAP_PROPERTIES_MERGE = "ldap.merge.properties";
/** The LDAP Password (usually associated with a username in ldap.properties). */
- public static final String LDAP_PASSWORD = "idp.LDAP.credential";
+ @Nonnull @NotEmpty public static final String LDAP_PASSWORD = "idp.LDAP.credential";
/** Where to install to. Default is basedir */
- public static final String TARGET_DIR = "idp.target.dir";
+ @Nonnull @NotEmpty public static final String TARGET_DIR = "idp.target.dir";
/** The entity ID. */
- public static final String ENTITY_ID = "idp.entityID";
+ @Nonnull @NotEmpty public static final String ENTITY_ID = "idp.entityID";
/** Do we cause a failure rather than a prompt. */
- public static final String NO_PROMPT = "idp.noprompt";
+ @Nonnull @NotEmpty public static final String NO_PROMPT = "idp.noprompt";
/** What is the installer host name? */
- public static final String HOST_NAME = "idp.host.name";
+ @Nonnull @NotEmpty public static final String HOST_NAME = "idp.host.name";
/** The scope to assert. */
- public static final String SCOPE = "idp.scope";
+ @Nonnull @NotEmpty public static final String SCOPE = "idp.scope";
/** The keystore password to use. */
- public static final String KEY_STORE_PASSWORD = "idp.keystore.password";
+ @Nonnull @NotEmpty public static final String KEY_STORE_PASSWORD = "idp.keystore.password";
/** The sealer password to use. */
- public static final String SEALER_PASSWORD = "idp.sealer.password";
+ @Nonnull @NotEmpty public static final String SEALER_PASSWORD = "idp.sealer.password";
/** The sealer alias to use. */
- public static final String SEALER_ALIAS = "idp.sealer.alias";
+ @Nonnull @NotEmpty public static final String SEALER_ALIAS = "idp.sealer.alias";
/** The keysize for the sealer. */
- public static final String SEALER_KEYSIZE = "idp.sealer.keysize";
+ @Nonnull @NotEmpty public static final String SEALER_KEYSIZE = "idp.sealer.keysize";
/** The the key size to generate. */
- public static final String KEY_SIZE = "idp.keysize";
+ @Nonnull @NotEmpty public static final String KEY_SIZE = "idp.keysize";
/** Mode to set on credential *key files. */
- public static final String MODE_CREDENTIAL_KEYS = "idp.conf.credentials.filemode";
+ @Nonnull @NotEmpty public static final String MODE_CREDENTIAL_KEYS = "idp.conf.credentials.filemode";
/** Group to set on files in the credential and conf directories. */
- public static final String GROUP_CONF_CREDENTIALS = "idp.conf.credentials.group";
+ @Nonnull @NotEmpty public static final String GROUP_CONF_CREDENTIALS = "idp.conf.credentials.group";
/** Do we do any chgrp/chmod work? */
- public static final String PERFORM_SET_MODE = "idp.conf.setmode";
+ @Nonnull @NotEmpty public static final String PERFORM_SET_MODE = "idp.conf.setmode";
/** Whether to tidy up after ourselves. */
- public static final String NO_TIDY = "idp.no.tidy";
+ @Nonnull @NotEmpty public static final String NO_TIDY = "idp.no.tidy";
/** Which modules to enable on initial install.
* @since 4.1.0 */
- public static final String INITIAL_INSTALL_MODULES = "idp.initial.modules";
+ @Nonnull @NotEmpty public static final String INITIAL_INSTALL_MODULES = "idp.initial.modules";
/** Whether to tidy up after ourselves. */
public static final int DEFAULT_KEY_SIZE = 3072;
@@ -124,7 +125,7 @@ public class InstallerProperties {
@NonnullAfterInit private Properties installerProperties;
/** The target Directory. */
- private Path targetDir;
+ @Nullable private Path targetDir;
/** The sourceDirectory. */
@Nonnull private final Path srcDir;
@@ -133,22 +134,22 @@ public class InstallerProperties {
private boolean noPrompt;
/** The entity ID. */
- private String entityID;
+ @Nullable private String entityID;
/** Hostname. */
- private String hostname;
+ @Nullable private String hostname;
/** scope. */
- private String scope;
+ @Nullable private String scope;
/** Keystore Password. */
- private String keyStorePassword;
+ @Nullable private String keyStorePassword;
/** Sealer Password. */
- private String sealerPassword;
+ @Nullable private String sealerPassword;
/** Sealer Alias. */
- private String sealerAlias;
+ @Nullable private String sealerAlias;
/** Key Size. (for signing, encryption and backchannel). */
private int keySize;
@@ -160,10 +161,10 @@ public class InstallerProperties {
private boolean setGroupAndMode = true;
/** credentials key file mode. */
- private String credentialsKeyFileMode;
+ @Nullable private String credentialsKeyFileMode;
/** Input handler from the prompting. */
- private final InputHandler inputHandler;
+ @Nonnull private final InputHandler inputHandler;
/** Those modules which are "core". */
@Nonnull public static final Set<String> CORE_MODULES = CollectionSupport.setOf("idp.Core");
@@ -174,16 +175,20 @@ public class InstallerProperties {
/**
* Constructor.
- * @param sourceDir Where the *source* installation is.
+ *
+ * @param sourceDir Where the *source* installation is
*/
public InstallerProperties(@Nonnull final Path sourceDir) {
srcDir = sourceDir;
inputHandler = getInputHandler();
}
- /** Get an {@link InputHandler} for the prompting.
- * @return an input handler */
- protected InputHandler getInputHandler() {
+ /**
+ * Get an {@link InputHandler} for the prompting.
+ *
+ * @return an input handler
+ */
+ @Nonnull protected InputHandler getInputHandler() {
return new DefaultInputHandler() {
// we want the prompts to be more obviously prompts
protected String getPrompt(final InputRequest request) {
@@ -192,8 +197,12 @@ public class InstallerProperties {
};
}
- /** {@inheritDoc} */
- // CheckStyle: CyclomaticComplexity OFF
+ /**
+ * Initialization routine.
+ *
+ * @throws ComponentInitializationException if initialization fails
+ */
+// CheckStyle: CyclomaticComplexity OFF
protected void doInitialize() throws ComponentInitializationException {
installerProperties = new Properties(System.getProperties());
@@ -235,16 +244,21 @@ public class InstallerProperties {
keySize = Integer.parseInt(value);
}
}
- // CheckStyle: CyclomaticComplexity ON
+// CheckStyle: CyclomaticComplexity ON
- /** Lookup a property. If it isn't defined then ask the user (if we are allowed).
- * This is used by most (but all) getters that redirect through a property
- * @param propertyName the property to lookup.
+ /**
+ * Lookup a property; if it isn't defined then ask the user (if we are allowed).
+ *
+ * <p>This is used by most (but all) getters that redirect through a property.</p>
+ *
+ * @param propertyName the property to lookup
* @param prompt what to say to the user
* @param defaultSupplier how to get the default value. Using a Supplier allows this
- * to be a reasonably heavyweight operation.
- * @throws BuildException of anything goes wrong
+ * to be a reasonably heavyweight operation
+ *
* @return the value
+ *
+ * @throws BuildException of anything goes wrong
*/
@Nonnull protected String getValue(final String propertyName,
final String prompt, final NonnullSupplier<String> defaultSupplier) throws BuildException {
@@ -268,13 +282,18 @@ public class InstallerProperties {
return value;
}
- /** Lookup a property. If it isn't defined then ask the user (if we are allowed) via
+ /**
+ * Lookup a property; if it isn't defined then ask the user (if we are allowed) via
* a no-echo interface.
- * Note that this does not work within a debugger.
- * @param propertyName the property to lookup.
+ *
+ * <p>Note that this does not work within a debugger.</p>
+ *
+ * @param propertyName the property to lookup
* @param prompt what to say to the user
+ *
+ * @return the value (this is not echoed to the terminal)
+ *
* @throws BuildException of anything goes wrong
- * @return the value. this is not repeated to the screen
*/
@Nonnull protected String getPassword(final String propertyName, final String prompt) throws BuildException {
final String value = installerProperties.getProperty(propertyName);
@@ -295,10 +314,14 @@ public class InstallerProperties {
return result;
}
- /** Get where we are installing/updating/building the war.
- * This is slightly complicated because the default depends on what we are doing.
+ /**
+ * Get where we are installing/updating/building the war.
+ *
+ * <p>This is slightly complicated because the default depends on what we are doing.</p>
+ *
* @return the target directory
- * @throws BuildException if something goes awry.
+ *
+ * @throws BuildException if something goes awry
*/
@Nonnull public Path getTargetDir() throws BuildException {
if (targetDir != null) {
@@ -309,15 +332,19 @@ public class InstallerProperties {
return td;
}
- /** Where is the install coming from?
+ /**
+ * Where is the install coming from?
+ *
* @return the source directory
*/
@Nonnull public Path getSourceDir() {
return srcDir;
}
- /** Get the EntityId for this install.
- * @return the name.
+ /**
+ * Get the EntityId for this install.
+ *
+ * @return the name
*/
@Nonnull public String getEntityID() {
String result = entityID;
@@ -327,26 +354,33 @@ public class InstallerProperties {
return result;
}
- /** Does the user want us to *not* tidy up.
- * @return do we not tidy up?*/
+ /**
+ * Does the user want us to *not* tidy up?
+ *
+ * @return do we not tidy up?
+ */
public boolean isNoTidy() {
return !tidy;
}
- /** Is this address named? Helper method for {@link #bestHostName()}
- * @return true unless the name is the canonical name...
+ /**
+ * Is this address named?
+ *
+ * <p>Helper method for {@link #bestHostName()}.</p>
+ *
* @param addr what to look at
+ * @return true unless the name is the canonical name
*/
private boolean hasHostName(final InetAddress addr) {
return !addr.getHostAddress().equals(addr.getCanonicalHostName());
}
/**
- * Find the most apposite network connector. Taken from Ant.
+ * Find the most apposite network connector, taken from Ant.
*
* @return the best name we can work out
*/
- // CheckStyle: CyclomaticComplexity OFF
+// CheckStyle: CyclomaticComplexity OFF
@Nonnull private String bestHostName() {
InetAddress bestSoFar = null;
try {
@@ -395,10 +429,13 @@ public class InstallerProperties {
assert result!=null;
return result;
}
- // CheckStyle: CyclomaticComplexity ON
+// CheckStyle: CyclomaticComplexity ON
- /** Get the host name for this install.
- * Defaults to information pulled from the network.
+ /**
+ * Get the host name for this install.
+ *
+ * <p>Defaults to information pulled from the network.</p>
+ *
* @return the host name.
*/
@Nonnull public String getHostName() {
@@ -409,7 +446,9 @@ public class InstallerProperties {
return result;
}
- /** Mode to set on all files in credentials.
+ /**
+ * Mode to set on all files in credentials.
+ *
* @return the mode
*/
@Nonnull public String getCredentialsKeyFileMode() {
@@ -422,21 +461,27 @@ public class InstallerProperties {
return result;
}
- /** Group to set on all files in credentials and conf.
+ /**
+ * Group to set on all files in credentials and conf.
+ *
* @return the mode or null if none to be set
*/
@Nullable public String getCredentialsGroup() {
return installerProperties.getProperty(GROUP_CONF_CREDENTIALS);
}
- /** Do we set the mode?
+ /**
+ * Do we set the mode?
+ *
* @return do we the mode
*/
public boolean isSetGroupAndMode() {
return setGroupAndMode;
}
- /** Evaluate the default scope value.
+ /**
+ * Evaluate the default scope value.
+ *
* @return everything after the first '.' in {@link #getHostName()}
*/
@Nonnull protected String defaultScope() {
@@ -450,8 +495,10 @@ public class InstallerProperties {
return "localdomain";
}
- /** Get the scope for this installation.
- * @return The scope.
+ /**
+ * Get the scope for this installation.
+ *
+ * @return the scope
*/
@Nonnull public String getScope() {
String result = scope;
@@ -461,7 +508,8 @@ public class InstallerProperties {
return result;
}
- /** Get the LDAP password iff one was provided. DO NOT PROMPT
+ /**
+ * Get the LDAP password iff one was provided. DO NOT PROMPT
*
* @return the password if provided by a properties
* @throws BuildException if badness happens
@@ -470,25 +518,32 @@ public class InstallerProperties {
return installerProperties.getProperty(LDAP_PASSWORD);
}
- /** Get the SubjectAltName for the certificates.
- * @return the SubjectAltName
+ /**
+ * Get the SubjectAltName for the certificates.
+ *
+ * @return the SubjectAltName
*/
@Nonnull public String getSubjectAltName() {
return "https://" + getHostName() + "/idp/shibboleth";
}
- /** Get the password for the keystore for this installation.
+ /**
+ * Get the password for the keystore for this installation.
+ *
* @return the password.
*/
@Nonnull public String getKeyStorePassword() {
- @SuppressWarnings("null") @Nonnull String result = keyStorePassword;
+ String result = keyStorePassword;
if (keyStorePassword == null) {
result = keyStorePassword = getPassword(KEY_STORE_PASSWORD, "Backchannel PKCS12 Password:");
}
+ assert result != null;
return result;
}
- /** Get the password for the sealer for this installation.
+ /**
+ * Get the password for the sealer for this installation.
+ *
* @return the password.
*/
@Nonnull public String getSealerPassword() {
@@ -499,10 +554,12 @@ public class InstallerProperties {
return result;
}
- /** Get the modules to enable after first install.
+ /**
+ * Get the modules to enable after first install.
+ *
* @return the modules
*/
- @Nonnull @NotLive @Unmodifiable public Set<String> getModulesToEnable() {
+ @Nonnull @NotLive @Unmodifiable public Set<String> getModulesToEnable() {
String prop = StringSupport.trimOrNull(installerProperties.getProperty(INITIAL_INSTALL_MODULES));
if (prop == null) {
return InstallerProperties.DEFAULT_MODULES;
@@ -526,12 +583,16 @@ public class InstallerProperties {
/** Get the modules to enable before ant install.
* @return the modules
*/
- @Nonnull @NotLive @Unmodifiable public Set<String> getCoreModules() {
+ @Nonnull @NotLive @Unmodifiable public Set<String> getCoreModules() {
return InstallerProperties.CORE_MODULES;
}
- /** Return the sealer key size, if this has been specified.
+ /**
+ * Return the sealer key size, if this has been specified.
+ *
* @return the key size or null if non specified
+ *
+ * @throws BuildException if the size was not an integer
*/
@Nullable Integer getSealerKeySize() throws BuildException {
final String val = installerProperties.getProperty(SEALER_KEYSIZE);
@@ -549,7 +610,9 @@ public class InstallerProperties {
return result;
}
- /** Get the alias for the sealer key.
+ /**
+ * Get the alias for the sealer key.
+ *
* @return the alias
*/
@Nonnull public String getSealerAlias() {
@@ -563,19 +626,25 @@ public class InstallerProperties {
return result;
}
- /** Get the key size for signing, encryption and backchannel.
- * @return the keysize
- * default is {@value #DEFAULT_KEY_SIZE}. */
+ /**
+ * Get the key size for signing, encryption and backchannel
+ *
+ * @return the keysize, default is {@value #DEFAULT_KEY_SIZE}.
+ */
public int getKeySize() {
return keySize;
}
- /** Get the file specified as the property as a File, or null if it doesn't exist.
- * @param propName the name to lookup;
+ /**
+ * Get the file specified as the property as a File, or null if it doesn't exist.
+ *
+ * @param propName the name to lookup
+ *
* @return null if the property is not provided a {@link Path} otherwise
+ *
* @throws BuildException if the property is supplied but the file doesn't exist.
*/
- protected Path getMergeFile(final String propName) throws BuildException {
+ @Nullable protected Path getMergeFile(final String propName) throws BuildException {
final String propValue = installerProperties.getProperty(propName);
if (propValue == null) {
return null;
@@ -599,22 +668,26 @@ public class InstallerProperties {
return path;
}
- /** Get the a file to merge with idp.properties or null.
+ /**
+ * Get the a file to merge with idp.properties or null.
*
- * @return the file or null if it none required.
+ * @return the file or null if it none required
+ *
* @throws BuildException if badness happens
*/
- public Path getIdPMergeProperties() throws BuildException {
+ @Nullable public Path getIdPMergeProperties() throws BuildException {
return getMergeFile(IDP_PROPERTIES_MERGE);
}
- /** Get the a file to merge with ldap.properties or null.
+ /**
+ * Get the a file to merge with ldap.properties or null.
*
- * @return the path or null if it none required.
+ * @return the path or null if it none required
+ *
* @throws BuildException if badness happens
*/
- public Path getLDAPMergeProperties() throws BuildException {
+ @Nullable public Path getLDAPMergeProperties() throws BuildException {
return getMergeFile(LDAP_PROPERTIES_MERGE);
}
-}
+}
\ No newline at end of file
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/UpdateIdPArguments.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/UpdateIdPArguments.java
index 49f8df968..308997262 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/UpdateIdPArguments.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/UpdateIdPArguments.java
@@ -95,7 +95,7 @@ public class UpdateIdPArguments extends AbstractIdPHomeAwareCommandLineArguments
@Nonnull private OperationType operation = OperationType.UNKNOWN;
/** {@inheritDoc} */
- public @Nonnull Logger getLog() {
+ @Nonnull public Logger getLog() {
if (log == null) {
log = LoggerFactory.getLogger(UpdateIdPArguments.class);
}
@@ -246,4 +246,4 @@ public class UpdateIdPArguments extends AbstractIdPHomeAwareCommandLineArguments
out.println();
}
-}
+}
\ No newline at end of file
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/UpdateIdPCLI.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/UpdateIdPCLI.java
index 32066d28b..3176515c2 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/UpdateIdPCLI.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/UpdateIdPCLI.java
@@ -71,15 +71,13 @@ public class UpdateIdPCLI extends AbstractIdPHomeAwareCommandLine<UpdateIdPArgum
/** {@inheritDoc} */
@Override
- @Nonnull
- protected Class<UpdateIdPArguments> getArgumentClass() {
+ @Nonnull protected Class<UpdateIdPArguments> getArgumentClass() {
return UpdateIdPArguments.class;
}
/** {@inheritDoc} */
@Override
- @Nonnull
- protected String getVersion() {
+ @Nonnull protected String getVersion() {
final String result = Version.getVersion();
assert result != null;
return result;
@@ -87,8 +85,7 @@ public class UpdateIdPCLI extends AbstractIdPHomeAwareCommandLine<UpdateIdPArgum
/** {@inheritDoc} */
@Override
- @Nonnull
- protected Logger getLogger() {
+ @Nonnull protected Logger getLogger() {
Logger localLog = log;
if (localLog == null) {
localLog = log = LoggerFactory.getLogger(UpdateIdPCLI.class);
@@ -333,4 +330,4 @@ public class UpdateIdPCLI extends AbstractIdPHomeAwareCommandLine<UpdateIdPArgum
System.exit(runMain(args));
}
-}
+}
\ No newline at end of file
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/V5Install.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/V5Install.java
index acba0dbc6..3817962db 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/V5Install.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/V5Install.java
@@ -76,7 +76,7 @@ import net.shibboleth.shared.spring.util.ApplicationContextBuilder;
public class V5Install {
/** Log. */
- private final Logger log = LoggerFactory.getLogger(V5Install.class);
+ @Nonnull private final Logger log = LoggerFactory.getLogger(V5Install.class);
/** Installer Properties. */
@Nonnull private final InstallerProperties installerProps;
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/package-info.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/package-info.java
index 06066499f..677c3a9fa 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/package-info.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/package-info.java
@@ -14,8 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/**
* Implementation classes for installation.
*/
+ at NonnullElements
+package net.shibboleth.idp.installer.impl;
-package net.shibboleth.idp.installer.impl;
\ No newline at end of file
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/metadata/impl/MetadataGenerator.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/metadata/impl/MetadataGenerator.java
index e565eea26..cbc6a1e04 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/metadata/impl/MetadataGenerator.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/metadata/impl/MetadataGenerator.java
@@ -104,38 +104,38 @@ public class MetadataGenerator extends AbstractInitializableComponent {
/**
* Those endpoints which require a backchannel.
*/
- static final Set<Endpoints> BACKCHANNEL_ENDPOINTS = Set.copyOf(EnumSet.of(
+ @Nonnull private static final Set<Endpoints> BACKCHANNEL_ENDPOINTS = CollectionSupport.setOf(
Endpoints.SAML1Artifact, Endpoints.SAML2Artifact, Endpoints.SOAPSLO, Endpoints.SAML1Query,
- Endpoints.SAML2Query));
+ Endpoints.SAML2Query);
/**
* the Artifact endpoints.
*/
- static final Set<Endpoints> ARTIFACT_ENDPOINTS = Set.copyOf(EnumSet.of(Endpoints.SAML1Artifact,
- Endpoints.SAML2Artifact));
+ @Nonnull private static final Set<Endpoints> ARTIFACT_ENDPOINTS = CollectionSupport.setOf(Endpoints.SAML1Artifact,
+ Endpoints.SAML2Artifact);
/**
* the SSO endpoints.
*/
- static final Set<Endpoints> SSO_ENDPOINTS = Set.copyOf(EnumSet.of(Endpoints.ShibbolethSSO,
- Endpoints.POSTSSO, Endpoints.POSTSimpleSignSSO, Endpoints.RedirectSSO));
+ @Nonnull private static final Set<Endpoints> SSO_ENDPOINTS = CollectionSupport.setOf(Endpoints.ShibbolethSSO,
+ Endpoints.POSTSSO, Endpoints.POSTSimpleSignSSO, Endpoints.RedirectSSO);
/**
* the SLO endpoints.
*/
- static final Set<Endpoints> SLO_ENDPOINTS = Set.copyOf(EnumSet.of(Endpoints.RedirectSLO,
- Endpoints.POSTSLO, Endpoints.POSTSimpleSignSLO, Endpoints.SOAPSLO));
+ @Nonnull private static final Set<Endpoints> SLO_ENDPOINTS = CollectionSupport.setOf(Endpoints.RedirectSLO,
+ Endpoints.POSTSLO, Endpoints.POSTSimpleSignSLO, Endpoints.SOAPSLO);
/**
* AttributeAuthority endpoints.
*/
- static final Set<Endpoints> AA_ENDPOINTS = Set.copyOf(EnumSet.of(Endpoints.SAML1Query,
- Endpoints.SAML2Query));
+ @Nonnull private static final Set<Endpoints> AA_ENDPOINTS = CollectionSupport.setOf(Endpoints.SAML1Query,
+ Endpoints.SAML2Query);
/**
* Which endpoints to generate.
*/
- private EnumSet<Endpoints> endpoints;
+ @NonnullAfterInit private EnumSet<Endpoints> endpoints;
/**
* Whether to comment out the SAML2 AA endpoint.
@@ -161,7 +161,7 @@ public class MetadataGenerator extends AbstractInitializableComponent {
/**
* Where to write to - as {@link File}.
*/
- private File output;
+ @Nullable private File output;
/** The parameters. */
private MetadataGeneratorParameters params;
@@ -505,7 +505,8 @@ public class MetadataGenerator extends AbstractInitializableComponent {
* @throws IOException if badness happens
*/
protected void writeScope() throws IOException {
- if (null == params.getScope() || params.getScope().isEmpty()) {
+ final String scope = params.getScope();
+ if (null == scope || scope.isEmpty()) {
return;
}
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/metadata/impl/MetadataGeneratorParameters.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/metadata/impl/MetadataGeneratorParameters.java
index b359e89ec..0f9dab109 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/metadata/impl/MetadataGeneratorParameters.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/metadata/impl/MetadataGeneratorParameters.java
@@ -29,6 +29,8 @@ import javax.annotation.Nullable;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.component.AbstractInitializableComponent;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.resource.Resource;
@@ -41,32 +43,32 @@ public class MetadataGeneratorParameters extends AbstractInitializableComponent
/**
* The file with the certificate the IDP uses to encrypt.
*/
- private File encryptionCert;
+ @Nullable private File encryptionCert;
/**
* The strings with the encryption cert in them (to allow for multiline output).
*/
- private List<String> encryptionCerts;
+ @Nullable private List<String> encryptionCerts;
/**
* The file with the certificate that TLS uses to 'sign'.
*/
- private File backChannelCert;
+ @Nullable private File backChannelCert;
/**
* The strings with the back channel cert in them (to allow for multiline output).
*/
- private List<String> backChannelCerts;
+ @Nullable private List<String> backChannelCerts;
/**
* The file with the certificate the IDP uses to sign.
*/
- private File signingCert;
+ @Nullable private File signingCert;
/**
* The strings with the signing certs in them (to allow for multiline output).
*/
- private List<String> signingCerts;
+ @Nullable private List<String> signingCerts;
/** The entityID. */
@NonnullAfterInit private String entityID;
@@ -75,7 +77,7 @@ public class MetadataGeneratorParameters extends AbstractInitializableComponent
@NonnullAfterInit private String dnsName;
/** The scope. */
- private String scope;
+ @Nullable private String scope;
/** {@inheritDoc} */
protected void doInitialize() throws ComponentInitializationException {
@@ -108,7 +110,7 @@ public class MetadataGeneratorParameters extends AbstractInitializableComponent
*
* @param resource what to set.
*/
- public void setEncryptionCertResource(final Resource resource) {
+ public void setEncryptionCertResource(@Nonnull final Resource resource) {
try {
encryptionCert = resource.getFile();
@@ -131,7 +133,7 @@ public class MetadataGeneratorParameters extends AbstractInitializableComponent
*
* @param resource what to set.
*/
- public void setSigningCertResource(final Resource resource) {
+ public void setSigningCertResource(@Nonnull final Resource resource) {
try {
signingCert = resource.getFile();
} catch (final IOException e) {
@@ -153,7 +155,7 @@ public class MetadataGeneratorParameters extends AbstractInitializableComponent
*
* @param file what to set.
*/
- public void setBackchannelCert(final File file) {
+ public void setBackchannelCert(@Nullable final File file) {
backChannelCert = file;
}
@@ -162,7 +164,7 @@ public class MetadataGeneratorParameters extends AbstractInitializableComponent
*
* @param resource what to set.
*/
- public void setBackchannelCertResource(final Resource resource) {
+ public void setBackchannelCertResource(@Nonnull final Resource resource) {
try {
backChannelCert = resource.getFile();
} catch (final IOException e) {
@@ -176,9 +178,10 @@ public class MetadataGeneratorParameters extends AbstractInitializableComponent
*
* @param file the file
* @return the contents
- * @throws IOException if badness occurrs.
+ *
+ * @throws IOException if badness occurrs
*/
- private List<String> getCertificateContents(final File file) throws IOException {
+ @Nullable @Unmodifiable @NotLive private List<String> getCertificateContents(final File file) throws IOException {
if (null == file || !file.exists()) {
return null;
}
@@ -248,7 +251,7 @@ public class MetadataGeneratorParameters extends AbstractInitializableComponent
*
* @return the scope.
*/
- public String getScope() {
+ @Nullable public String getScope() {
return scope;
}
@@ -257,7 +260,7 @@ public class MetadataGeneratorParameters extends AbstractInitializableComponent
*
* @param value what to set.
*/
- public void setScope(final String value) {
+ public void setScope(@Nullable final String value) {
scope = value;
}
}
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/metadata/impl/package-info.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/metadata/impl/package-info.java
index a683a3746..9fb4c8fd4 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/metadata/impl/package-info.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/metadata/impl/package-info.java
@@ -14,8 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/**
* Package to contain classes to do with the one off metadata generation.
*/
+ at NonnullElements
+package net.shibboleth.idp.installer.metadata.impl;
-package net.shibboleth.idp.installer.metadata.impl;
\ No newline at end of file
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/package-info.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/package-info.java
index 4618fce74..4597a1b56 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/package-info.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/package-info.java
@@ -14,8 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/**
* Classes available for installation.
*/
+ at NonnullElements
+package net.shibboleth.idp.installer;
-package net.shibboleth.idp.installer;
\ No newline at end of file
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/LoggingVisitor.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/LoggingVisitor.java
index 1164706b3..9e5ee8c0a 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/LoggingVisitor.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/LoggingVisitor.java
@@ -33,6 +33,8 @@ import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.List;
+import javax.annotation.Nonnull;
+
import org.slf4j.Logger;
import net.shibboleth.shared.primitive.LoggerFactory;
@@ -41,24 +43,26 @@ import net.shibboleth.shared.primitive.LoggerFactory;
* A @{link {@link FileVisitor} copies directory trees keeping a note of all copied target files.
*/
public final class LoggingVisitor extends SimpleFileVisitor<Path> {
- /** How what files have we copied? */
- private final List<Path> copiedFiles = new ArrayList<>();
-
+
/** logger. */
- private final Logger log = LoggerFactory.getLogger(LoggingVisitor.class);
+ @Nonnull private final Logger log = LoggerFactory.getLogger(LoggingVisitor.class);
+
+ /** How what files have we copied? */
+ @Nonnull private final List<Path> copiedFiles = new ArrayList<>();
/** Path we are traversing. */
- private final Path from;
+ @Nonnull private final Path from;
/** Path where we copy to. */
- private final Path to;
+ @Nonnull private final Path to;
+
/**
* Constructor.
*
* @param fromDir Path we are traversing
* @param toDir Path where we check for Duplicates
*/
- public LoggingVisitor(final Path fromDir, final Path toDir) {
+ public LoggingVisitor(@Nonnull final Path fromDir, @Nonnull final Path toDir) {
from = fromDir;
to = toDir;
}
@@ -86,10 +90,13 @@ public final class LoggingVisitor extends SimpleFileVisitor<Path> {
return FileVisitResult.CONTINUE;
}
- /** did we find a name clash?
- * @return whether we found a name clash.
+ /**
+ * Did we find a name clash?
+ *
+ * @return whether we found a name clash
*/
- public List<Path> getCopiedList() {
+ @Nonnull public List<Path> getCopiedList() {
return copiedFiles;
}
-}
+
+}
\ No newline at end of file
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java
index 20ba160a0..9801522f3 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java
@@ -96,13 +96,13 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
@Nonnull private static final Logger LOG = LoggerFactory.getLogger(PluginInstaller.class);
/** Property Name for version. */
- private static final String PLUGIN_VERSION_PROPERTY ="idp.plugin.version";
+ @Nonnull @NotEmpty private static final String PLUGIN_VERSION_PROPERTY ="idp.plugin.version";
/** Property Prefix for install files . */
- private static final String PLUGIN_FILE_PROPERTY_PREFIX = "idp.plugin.file.";
+ @Nonnull @NotEmpty private static final String PLUGIN_FILE_PROPERTY_PREFIX = "idp.plugin.file.";
/** Property Name for whether paths are relative. */
- private static final String PLUGIN_RELATIVE_PATHS_PROPERTY = "idp.plugin.relativePaths";
+ @Nonnull @NotEmpty private static final String PLUGIN_RELATIVE_PATHS_PROPERTY = "idp.plugin.relativePaths";
/** Where we are installing to. */
@NonnullAfterInit private Path idpHome;
@@ -159,13 +159,13 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
@Nonnull private final Map<ModuleResource,ResourceResult> moduleChanges = new HashMap<>();
/** The "plugins" classpath loader. AutoClosed. */
- private URLClassLoader installedPluginsLoader;
+ @Nullable private URLClassLoader installedPluginsLoader;
/** The "plugin under construction" classpath loader. AutoClosed. */
- private URLClassLoader installingPluginLoader;
+ @Nullable private URLClassLoader installingPluginLoader;
/** The securityParams for the module context. */
- private HttpClientSecurityParameters securityParams;
+ @Nullable private HttpClientSecurityParameters securityParams;
/** Do we rebuild? */
private boolean rebuildWar = true;
@@ -512,7 +512,7 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
* @param rollBack Roll Back Context
* @throws BuildException if badness is detected.
*/
- private void installNew(final RollbackPluginInstall rollBack) throws BuildException {
+ private void installNew(@Nonnull final RollbackPluginInstall rollBack) throws BuildException {
final Path from = distribution.resolve("webapp");
assert from != null;
if (InstallerSupport.detectDuplicates(from, getPluginsWebapp())) {
@@ -538,7 +538,7 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
/** Uninstall the old version of the plugin.
* @param rollback Rollback Context
* @throws BuildException on IO or module errors */
- private void uninstallOld(final RollbackPluginInstall rollback) throws BuildException {
+ private void uninstallOld(@Nonnull final RollbackPluginInstall rollback) throws BuildException {
final String oldVersion =getVersionFromContents();
if (oldVersion == null) {
@@ -563,7 +563,7 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
* @param copiedFiles The copied files
* @throws BuildException If we hit an IO exception
*/
- private void saveCopiedFiles(final List<Path> copiedFiles) throws BuildException {
+ private void saveCopiedFiles(@Nonnull final List<Path> copiedFiles) throws BuildException {
try {
Files.createDirectories(pluginsContents);
final Properties props = new Properties(1+copiedFiles.size());
@@ -588,7 +588,7 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
* @param props The property files
* @return the idpHome it was installed to or null if no files installed
*/
- @Nullable private Path inferInstalledIdpHome(final Properties props) {
+ @Nullable private Path inferInstalledIdpHome(@Nonnull final Properties props) {
if (props.get(PLUGIN_FILE_PROPERTY_PREFIX+"1") == null) {
// No files
return null;
@@ -691,7 +691,7 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
/** Capture module changes.
* @param changes what has changed */
- private void captureChanges(final Map<ModuleResource,ResourceResult> changes) {
+ private void captureChanges(@Nonnull final Map<ModuleResource,ResourceResult> changes) {
for (final Entry<ModuleResource, ResourceResult> entry: changes.entrySet()) {
moduleChanges.put(entry.getKey(), entry.getValue());
}
@@ -748,7 +748,7 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
* @throws BuildException if badness is detected.
*/
// CheckStyle: CyclomaticComplexity OFF
- private void unpack(final Path base, final String fileName) throws BuildException {
+ private void unpack(@Nonnull final Path base, @Nonnull final String fileName) throws BuildException {
Constraint.isNull(unpackDirectory, "cannot unpack multiple times");
try {
unpackDirectory = Files.createTempDirectory("plugin-installer-unpack");
@@ -806,7 +806,7 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
* @return true if it ends with .zip
* @throws BuildException if the name is too short
*/
- private boolean isZip(final String fileName) throws BuildException {
+ private boolean isZip(@Nonnull final String fileName) throws BuildException {
if (fileName.length() <= 7) {
LOG.error("Improbably small file name: {}", fileName);
throw new BuildException("Improbably small file name");
@@ -826,7 +826,7 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
* @return the the appropriate {@link ArchiveInputStream}
* @throws IOException if we trip over an unpack
*/
- @Nonnull private ArchiveInputStream getStreamFor(final Path fullName, final boolean isZip) throws IOException {
+ @Nonnull private ArchiveInputStream getStreamFor(@Nonnull final Path fullName, final boolean isZip) throws IOException {
final InputStream inStream = new BufferedInputStream(new FileInputStream(fullName.toFile()));
if (isZip) {
return new ZipArchiveInputStream(inStream);
@@ -1038,7 +1038,7 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
/** close, ignoring errors.
* @param what what to close
*/
- private void closeSilently(final AutoCloseable what) {
+ private void closeSilently(@Nullable final AutoCloseable what) {
if (what == null) {
return;
}
@@ -1073,5 +1073,5 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
}
return new InstallableComponentVersion(version);
}
-}
+}
\ No newline at end of file
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java
index 75bc7d4de..1c3948075 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java
@@ -52,7 +52,6 @@ import net.shibboleth.idp.plugin.impl.PluginInfo;
import net.shibboleth.profile.installablecomponent.InstallableComponentInfo;
import net.shibboleth.profile.installablecomponent.InstallableComponentSupport;
import net.shibboleth.profile.installablecomponent.InstallableComponentVersion;
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.cli.AbstractCommandLine;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
@@ -105,7 +104,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
}
/** {@inheritDoc} */
- @Nonnull @NonnullElements protected List<Resource> getAdditionalSpringResources() {
+ @Nonnull protected List<Resource> getAdditionalSpringResources() {
return CollectionSupport.singletonList(
new ClassPathResource("net/shibboleth/idp/conf/http-client.xml"));
}
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/RollbackPluginInstall.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/RollbackPluginInstall.java
index 9540e2f8f..a21fe5aa1 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/RollbackPluginInstall.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/RollbackPluginInstall.java
@@ -196,7 +196,7 @@ public class RollbackPluginInstall implements AutoCloseable {
/** Capture module changes.
* @param changes what has changed
*/
- private void captureChanges(final Map<ModuleResource,ResourceResult> changes) {
+ private void captureChanges(@Nonnull final Map<ModuleResource,ResourceResult> changes) {
for (final Entry<ModuleResource, ResourceResult> entry: changes.entrySet()) {
moduleChanges.put(entry.getKey(), entry.getValue());
}
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/TrustStore.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/TrustStore.java
index 47a0167a5..48f10d141 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/TrustStore.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/TrustStore.java
@@ -241,7 +241,7 @@ import net.shibboleth.shared.primitive.LoggerFactory;
* @return the Signature.
* @throws IOException if there is a problem reading the file of it it doesn't represent a signature
*/
- public static Signature signatureOf(@Nonnull final InputStream stream) throws IOException {
+ @Nonnull public static Signature signatureOf(@Nonnull final InputStream stream) throws IOException {
return new Signature(stream);
}
@@ -249,7 +249,7 @@ import net.shibboleth.shared.primitive.LoggerFactory;
* @param signature what to ask about
* @return whether it is there
*/
- public boolean contains(final Signature signature) {
+ public boolean contains(@Nonnull final Signature signature) {
final PGPSignature sig = signature.getSignature();
@@ -264,7 +264,7 @@ import net.shibboleth.shared.primitive.LoggerFactory;
* @return whether it passed or not
* @throws IOException if we get an error reading the stream
*/
- public boolean checkSignature(final InputStream input, final Signature signature) throws IOException {
+ public boolean checkSignature(@Nonnull final InputStream input, @Nonnull final Signature signature) throws IOException {
try {
final PGPSignature pgpSignature = signature.getSignature();
final PGPPublicKey pubKey = keyRings.getPublicKey(pgpSignature.getKeyID());
@@ -359,7 +359,7 @@ import net.shibboleth.shared.primitive.LoggerFactory;
*
* @throws IOException if an error occurs
*/
- protected Signature(final @Nonnull InputStream input) throws IOException {
+ protected Signature(@Nonnull final InputStream input) throws IOException {
try (final InputStream sigStream = PGPUtil.getDecoderStream(input)) {
final JcaPGPObjectFactory factory = new JcaPGPObjectFactory(sigStream);
final Object first = factory.nextObject();
@@ -383,13 +383,14 @@ import net.shibboleth.shared.primitive.LoggerFactory;
*
* @return the signature
*/
- protected PGPSignature getSignature() {
+ @Nonnull protected PGPSignature getSignature() {
return signature;
}
/** {@inheritDoc} */
- public String toString() {
+ @Nonnull public String toString() {
return keyId;
}
}
-}
+
+}
\ No newline at end of file
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/package-info.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/package-info.java
index 219482d7f..bad270415 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/package-info.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/package-info.java
@@ -14,8 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/**
* Classes for handling plugins.
*/
+ at NonnullElements
+package net.shibboleth.idp.installer.plugin.impl;
-package net.shibboleth.idp.installer.plugin.impl;
\ No newline at end of file
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list