[java-identity-provider] branch main updated: Fix warnings.
Scott Cantor
cantor.2 at osu.edu
Thu Aug 3 17:02:59 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=b2c209ad7eba1fdde4786df04bac483f125abf46
The following commit(s) were added to refs/heads/main by this push:
new b2c209ad7 Fix warnings.
b2c209ad7 is described below
commit b2c209ad7eba1fdde4786df04bac483f125abf46
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Aug 3 13:02:55 2023 -0400
Fix warnings.
---
.../attribute/AbstractCASAttributeTranscoder.java | 1 +
.../idp/cas/ticket/ProxyGrantingTicket.java | 6 +++-
.../PrepareTicketValidationResponseAction.java | 1 +
.../consent/flow/ar/impl/ReleaseAttributes.java | 4 +--
.../impl/AbstractConsentIndexedStorageAction.java | 7 ++--
.../storage/impl/CreateGlobalConsentResult.java | 4 +--
.../flow/storage/impl/ReadConsentFromStorage.java | 3 +-
.../impl/AttributeReleaseConsentFunction.java | 5 +--
.../logic/impl/CounterStorageKeyFunction.java | 5 +--
.../logic/impl/PreferExplicitOrderComparator.java | 4 +--
.../shibboleth/idp/installer/InstallerSupport.java | 11 +++---
.../idp/installer/impl/CurrentInstallState.java | 2 +-
.../idp/installer/impl/FinalizeJettyBase.java | 17 +++++----
.../shibboleth/idp/installer/impl/IdPBuildWar.java | 2 +-
.../idp/installer/impl/IdPInstallerArguments.java | 12 ++++---
.../idp/installer/impl/IdPInstallerCLI.java | 4 ++-
.../impl/InstalledMetadataParameters.java | 17 ++++-----
.../idp/installer/impl/InstallerProperties.java | 22 +++++++-----
.../idp/installer/impl/UpdateIdPArguments.java | 8 +++--
.../idp/installer/impl/UpdateIdPCLI.java | 40 ++++++++++++++--------
.../shibboleth/idp/installer/impl/V5Install.java | 23 ++++++++-----
.../idp/installer/plugin/impl/PluginInstaller.java | 9 +++--
.../installer/plugin/impl/PluginInstallerCLI.java | 25 +++++++-------
.../idp/installer/plugin/impl/PluginState.java | 5 ++-
.../idp/installer/plugin/impl/TrustStore.java | 6 ++--
.../impl/ProcessAssertionsForAuthentication.java | 14 ++++----
.../idp/session/impl/StorageBackedIdPSession.java | 11 ++++--
.../impl/StorageBackedIdPSessionSerializer.java | 8 +++--
.../session/impl/StorageBackedSessionManager.java | 9 +++--
.../factory/FlowDefinitionResourceFactory.java | 8 +++--
.../spring/factory/FlowModelFlowBuilder.java | 2 +-
.../spring/factory/FlowRelativeResourceLoader.java | 5 ++-
.../idp/ui/context/RelyingPartyUIContext.java | 2 --
.../csrf/impl/CSRFTokenFlowExecutionListener.java | 2 +-
.../shibboleth/idp/ui/impl/SetRPUIInformation.java | 5 +--
35 files changed, 187 insertions(+), 122 deletions(-)
diff --git a/idp-cas-api/src/main/java/net/shibboleth/idp/cas/attribute/AbstractCASAttributeTranscoder.java b/idp-cas-api/src/main/java/net/shibboleth/idp/cas/attribute/AbstractCASAttributeTranscoder.java
index 4953dba76..bd0d745d8 100644
--- a/idp-cas-api/src/main/java/net/shibboleth/idp/cas/attribute/AbstractCASAttributeTranscoder.java
+++ b/idp-cas-api/src/main/java/net/shibboleth/idp/cas/attribute/AbstractCASAttributeTranscoder.java
@@ -91,6 +91,7 @@ public abstract class AbstractCASAttributeTranscoder<EncodedType extends IdPAttr
continue;
}
+ @SuppressWarnings("unchecked")
final EncodedType attributeValue = (EncodedType) o;
final String casAttributeValue = encodeValue(profileRequestContext, attribute, rule, attributeValue);
if (casAttributeValue == null) {
diff --git a/idp-cas-api/src/main/java/net/shibboleth/idp/cas/ticket/ProxyGrantingTicket.java b/idp-cas-api/src/main/java/net/shibboleth/idp/cas/ticket/ProxyGrantingTicket.java
index 2bebb8bd0..138fc7a81 100644
--- a/idp-cas-api/src/main/java/net/shibboleth/idp/cas/ticket/ProxyGrantingTicket.java
+++ b/idp-cas-api/src/main/java/net/shibboleth/idp/cas/ticket/ProxyGrantingTicket.java
@@ -54,7 +54,11 @@ public class ProxyGrantingTicket extends Ticket {
parentPgTicketId = StringSupport.trimOrNull(parentId);
}
- /** @return Proxy callback URL that uniquely identifies the proxying party to which the PGT was issued. */
+ /**
+ * Gets the proxy callback URL that uniquely identifies the proxying party to which the PGT was issued.
+ *
+ * @return proxy callback URL
+ */
@Nonnull public String getProxyCallbackUrl() {
return proxyCallbackUrl;
}
diff --git a/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/flow/impl/PrepareTicketValidationResponseAction.java b/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/flow/impl/PrepareTicketValidationResponseAction.java
index 272b8c3db..ac97ad5e1 100644
--- a/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/flow/impl/PrepareTicketValidationResponseAction.java
+++ b/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/flow/impl/PrepareTicketValidationResponseAction.java
@@ -257,6 +257,7 @@ public class PrepareTicketValidationResponseAction extends
if (transcodingRules.isEmpty()) {
log.debug("{} Attribute {} does not have any transcoding rules, applying default", getLogPrefix(),
attribute.getId());
+ assert defaultTranscodingRule != null;
transcodingRules = CollectionSupport.singletonList(defaultTranscodingRule);
}
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/ar/impl/ReleaseAttributes.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/ar/impl/ReleaseAttributes.java
index 6d005fec3..80d98feb6 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/ar/impl/ReleaseAttributes.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/ar/impl/ReleaseAttributes.java
@@ -62,8 +62,8 @@ public class ReleaseAttributes extends AbstractAttributeReleaseAction {
final ConsentContext consentContext = getConsentContext();
assert attributeContext != null && releaseContext != null && consentContext!=null;
- final Map<String, Consent>consents =
- consentContext.getCurrentConsents().isEmpty() ? consentContext.getPreviousConsents() : consentContext.getCurrentConsents();
+ final Map<String, Consent>consents = consentContext.getCurrentConsents().isEmpty() ?
+ consentContext.getPreviousConsents() : consentContext.getCurrentConsents();
log.debug("{} Consents '{}'", getLogPrefix(), consents);
final Map<String, IdPAttribute> attributes = attributeContext.getIdPAttributes();
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 aa06c5994..b6bb3360b 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
@@ -198,7 +198,8 @@ public class AbstractConsentIndexedStorageAction extends AbstractConsentStorageA
if (storageRecord == null) {
log.debug("{} Creating storage index with key '{}'", getLogPrefix(), keyToAdd);
- return service.create(storageContext, indexKey, CollectionSupport.singletonList(keyToAdd), storageKeysSerializer, null);
+ return service.create(storageContext, indexKey, CollectionSupport.singletonList(keyToAdd),
+ storageKeysSerializer, null);
}
final LinkedHashSet<String> keys = new LinkedHashSet<>(getStorageKeysFromIndex());
@@ -247,7 +248,7 @@ public class AbstractConsentIndexedStorageAction extends AbstractConsentStorageA
return false;
}
-//CheckStyle: ReturnCount OFF
+// CheckStyle: CyclomaticComplexity OFF
/**
* Storage records will be pruned based on the record maximums set on the flow descriptor,
* and the storage service value size. Below a defined threshold, the basic maximum is applied, while at
@@ -316,7 +317,7 @@ public class AbstractConsentIndexedStorageAction extends AbstractConsentStorageA
removeKeyFromStorageIndex(keyToDelete);
}
}
- //CheckStyle: ReturnCount ON
+// CheckStyle: CyclomaticComplexity ON
/**
* Store a profile interceptor result.
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/storage/impl/CreateGlobalConsentResult.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/storage/impl/CreateGlobalConsentResult.java
index e95b9ca51..a6d0ea00c 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/storage/impl/CreateGlobalConsentResult.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/storage/impl/CreateGlobalConsentResult.java
@@ -53,8 +53,8 @@ public class CreateGlobalConsentResult extends AbstractConsentIndexedStorageActi
final Consent globalConsent = new Consent();
globalConsent.setId(Consent.WILDCARD);
globalConsent.setApproved(true);
- final String value =
- getStorageSerializer().serialize(CollectionSupport.singletonMap( globalConsent.ensureId(), globalConsent));
+ final String value = getStorageSerializer().serialize(
+ CollectionSupport.singletonMap(globalConsent.ensureId(), globalConsent));
final ConsentFlowDescriptor flowDescriptor = getConsentFlowDescriptor();
final String storageContext = getStorageContext();
final String storageKey = getStorageKey();
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/storage/impl/ReadConsentFromStorage.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/storage/impl/ReadConsentFromStorage.java
index 1ba8bf638..aa29174b9 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/storage/impl/ReadConsentFromStorage.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/storage/impl/ReadConsentFromStorage.java
@@ -49,7 +49,8 @@ public class ReadConsentFromStorage extends AbstractConsentStorageAction {
final String key = getStorageKey();
final StorageService service = getStorageService();
final StorageSerializer<Map<String, Consent>> storageSerializer = getStorageSerializer();
- assert consentContext != null && service != null && key != null && storageContext!= null && storageSerializer!=null;
+ assert consentContext != null && service != null && key != null && storageContext!= null
+ && storageSerializer!=null;
try {
final StorageRecord<Map<String,Consent>> storageRecord = service.read(storageContext, key);
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 e26523025..432d32db5 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
@@ -125,8 +125,9 @@ public class AttributeReleaseConsentFunction implements Function<ProfileRequestC
consent.setId(attribute.getId());
if (consentFlowDescriptor.compareValues()) {
- String value = ((AttributeReleaseFlowDescriptor) consentFlowDescriptor).getAttributeValuesHashFunction().apply(
- attribute.getValues());
+ String value =
+ ((AttributeReleaseFlowDescriptor) consentFlowDescriptor).getAttributeValuesHashFunction().apply(
+ attribute.getValues());
assert value != null;
unsortedConsent.setValue(value);
final List<IdPAttributeValue> sorted = new ArrayList<>(attribute.getValues());
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 d00c5b513..4abc1dbbb 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
@@ -108,8 +108,9 @@ public class CounterStorageKeyFunction extends AbstractInitializableComponent im
Constraint.isNotNull(interceptorContext,
"Profile interceptor context not available from profile request context");
- final ProfileInterceptorFlowDescriptor flowDescriptor = Constraint.isNotNull(interceptorContext.getAttemptedFlow(),
- "Profile interceptor flow descriptor not available from profile interceptor context");
+ final ProfileInterceptorFlowDescriptor flowDescriptor =
+ Constraint.isNotNull(interceptorContext.getAttemptedFlow(),
+ "Profile interceptor flow descriptor not available from profile interceptor context");
return Constraint.isNotNull(flowDescriptor.getStorageService(),
"Storage service not available from interceptor flow descriptor");
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 f71a4677d..5de25c711 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
@@ -40,10 +40,10 @@ import net.shibboleth.shared.primitive.StringSupport;
public class PreferExplicitOrderComparator implements Comparator<String> {
/** Explicit ordering. */
- @Nonnull final private Ordering<String> explicitOrdering;
+ @Nonnull private final Ordering<String> explicitOrdering;
/** Strings in order. */
- @Nonnull @Unmodifiable final private List<String> explicitOrder;
+ @Nonnull @Unmodifiable private final List<String> explicitOrder;
/**
* Constructor.
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 67fd21e20..b96189b68 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
@@ -109,7 +109,8 @@ public final class InstallerSupport {
* @param excludes pattern to exclude
* @return a partially populated {@link Copy} task
*/
- @Nonnull public static Copy getCopyTask(@Nonnull final Path from, @Nonnull final Path to, @Nonnull final String excludes) {
+ @Nonnull public static Copy getCopyTask(@Nonnull final Path from, @Nonnull final Path to,
+ @Nonnull final String excludes) {
final Copy result = new Copy();
result.setTodir(to.toFile());
final FileSet fromSet = new FileSet();
@@ -245,8 +246,8 @@ public final class InstallerSupport {
* @param includes what to include
* @throws BuildException if badness occurs
*/
- public static void setMode(@Nonnull final Path directory, @Nonnull final String permissions, @Nonnull final String includes)
- throws BuildException {
+ public static void setMode(@Nonnull final Path directory, @Nonnull final String permissions,
+ @Nonnull final String includes) throws BuildException {
if (!Files.exists(directory) ) {
log.debug("Directory {} does not exist, not performing chmod", directory);
return;
@@ -271,8 +272,8 @@ public final class InstallerSupport {
* @param includes what to include
* @throws BuildException if badness occurs
*/
- public static void setGroup(@Nonnull final Path directory, @Nonnull final String group, @Nonnull final String includes)
- throws BuildException {
+ public static void setGroup(@Nonnull final Path directory, @Nonnull final String group,
+ @Nonnull final String includes) throws BuildException {
if (!Files.exists(directory) ) {
log.debug("Directory {} does not exist, not performing chgrp", directory);
return;
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 2b6cf03af..666df1254 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
@@ -162,7 +162,7 @@ public final class CurrentInstallState extends AbstractInitializableComponent {
findPreviousVersion();
try {
findEnabledModules();
- } catch (IOException | ServiceConfigurationError e) {
+ } catch (final IOException | ServiceConfigurationError e) {
log.error("Error loading modules", e);
}
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/FinalizeJettyBase.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/FinalizeJettyBase.java
index 260e05af3..6f31d58f5 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/FinalizeJettyBase.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/FinalizeJettyBase.java
@@ -31,7 +31,7 @@ import net.shibboleth.idp.installer.PropertiesWithComments;
* Small class to do the post install work on an embedded jetty-base.
* (primarily generated by the windows explorer but not tied to that).
*/
-public class FinalizeJettyBase {
+public final class FinalizeJettyBase {
/** The IdP Installation dir. */
@Nonnull private final Path idpHome;
@@ -91,7 +91,9 @@ public class FinalizeJettyBase {
reprotect();
}
- /** if they don't exists create
+ /**
+ * If they don't exists create.
+ *
* @throws IOException if we failed to create a directory
*/
private void createDirectories() throws IOException {
@@ -137,7 +139,8 @@ public class FinalizeJettyBase {
final PropertiesWithComments idpIni = new PropertiesWithComments();
final File inputIni = jettyBase.resolve("start.d.dist").resolve("idp.ini.windows").toFile();
final File outputIni = jettyBase.resolve("start.d").resolve("idp.ini").toFile();
- try (final FileInputStream in = new FileInputStream(inputIni); final FileOutputStream out = new FileOutputStream(outputIni)) {
+ try (final FileInputStream in = new FileInputStream(inputIni);
+ final FileOutputStream out = new FileOutputStream(outputIni)) {
idpIni.load(in);
idpIni.replaceProperties(replace);
idpIni.store(out);
@@ -150,8 +153,10 @@ public class FinalizeJettyBase {
private void updateIdPini() throws IOException {
final PropertiesWithComments props = new PropertiesWithComments();
final File idpIni = jettyBase.resolve("start.d").resolve("idp.ini").toFile();
- final File replacementFile = jettyBase.resolve("start.d.dist").resolve("idp.ini.rewrite.property.names").toFile();
- try (final FileInputStream in = new FileInputStream(idpIni); final FileInputStream replacementStream = new FileInputStream(replacementFile)) {
+ final File replacementFile =
+ jettyBase.resolve("start.d.dist").resolve("idp.ini.rewrite.property.names").toFile();
+ try (final FileInputStream in = new FileInputStream(idpIni);
+ final FileInputStream replacementStream = new FileInputStream(replacementFile)) {
props.loadNameReplacement(replacementStream);
props.load(in);
}
@@ -191,7 +196,7 @@ public class FinalizeJettyBase {
* @param args As supplied
* @throws IOException if there is a problem with the jetty base.
*/
- public static void main(String[] args) throws IOException {
+ public static void main(final String[] args) throws IOException {
new FinalizeJettyBase().execute();
}
}
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 97d42e8ee..8cb69ac17 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
@@ -27,7 +27,7 @@ import net.shibboleth.shared.cli.AbstractCommandLine;
import net.shibboleth.shared.primitive.LoggerFactory;
/**
- * Command line for 'build'
+ * Command line for 'build'.
*/
public class IdPBuildWar extends AbstractCommandLine<IdPBuildArguments> {
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 a34448e4d..bc0c01521 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
@@ -120,8 +120,10 @@ public class IdPInstallerArguments extends AbstractCommandLineArguments {
return propertyFile;
}
- /** Return the DNS name for the IdP
- * @return Returns the DNS name.
+ /**
+ * Return the DNS name for the IdP.
+ *
+ * @return the DNS name
*/
@Nullable public String getHostName() {
return hostName;
@@ -191,8 +193,10 @@ public class IdPInstallerArguments extends AbstractCommandLineArguments {
out.println(String.format(" %-22s %s", "-sp, --sealerPassword", "Password for the generated Data Sealer"));
out.println(String.format(" %-22s %s", "--noPrompt", "Unattended Install"));
- out.println(String.format(" %-22s %s", "-hc, --http-client", "Bean name for an http client (for Module and Plugin Operations"));
- out.println(String.format(" %-22s %s", "-hs, --http-securityt", "Bean name for http security parameters (for Module and Plugin Operations"));
+ out.println(String.format(" %-22s %s", "-hc, --http-client",
+ "Bean name for an http client (for Module and Plugin Operations"));
+ out.println(String.format(" %-22s %s", "-hs, --http-securityt",
+ "Bean name for http security parameters (for Module and Plugin Operations"));
out.println();
}
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 ce8dbb76e..3e7b30c99 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
@@ -73,6 +73,7 @@ public class IdPInstallerCLI extends AbstractCommandLine<IdPInstallerArguments>
new ClassPathResource("net/shibboleth/idp/conf/http-client.xml"));
}
+// Checkstyle: MethodLength OFF
/** {@inheritDoc} */
protected int doRun(@Nonnull final IdPInstallerArguments args) {
@@ -147,13 +148,14 @@ public class IdPInstallerCLI extends AbstractCommandLine<IdPInstallerArguments>
}
return RC_OK;
}
+// Checkstyle: MethodLength ON
/** Helper for translating arguments to properties. Look at the value and if it is non-null
* set the associate property.
* @param value the value to check and potentially set
* @param propertyName the property name to set
*/
- private void setIfNotNull(@Nullable String value, @Nonnull String propertyName) {
+ private void setIfNotNull(@Nullable final String value, @Nonnull final String propertyName) {
if (value == null) {
return;
}
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstalledMetadataParameters.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstalledMetadataParameters.java
index 8cce00ee2..883690e65 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstalledMetadataParameters.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstalledMetadataParameters.java
@@ -60,9 +60,10 @@ import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.resource.Resource;
/**
- * Parameters to metadata generation
+ * Parameters to metadata generation.
*/
-public class InstalledMetadataParameters extends AbstractInitializableComponent implements TemplateMetadataGeneratorParameters {
+public class InstalledMetadataParameters extends AbstractInitializableComponent
+ implements TemplateMetadataGeneratorParameters {
/** Logger. */
private final Logger log = LoggerFactory.getLogger(InstalledMetadataParameters.class);
@@ -95,17 +96,17 @@ public class InstalledMetadataParameters extends AbstractInitializableComponent
* Static settings.
*/
/** logout services. */
- final @Nonnull List<Pair<String, String>> logoutServices = CollectionSupport.singletonList(
+ @Nonnull private final List<Pair<String, String>> logoutServices = CollectionSupport.singletonList(
new Pair<>("SOAP/","/idp/profile/SAML2/SOAP/ArtifactResolution"));
/** sso services. */
- final @Nonnull List<Pair<String, String>> ssoServices = CollectionSupport.listOf(
+ @Nonnull private final List<Pair<String, String>> ssoServices = CollectionSupport.listOf(
new Pair<>("SimpleSign/","/idp/profile/SAML2/POST-SimpleSign/SSO"),
new Pair<>("Redirect/","/idp/profile/SAML2/Redirect/SSO"),
new Pair<>("POST/","idp/profile/SAML2/POST/SSO"));
/** artifact services. */
- final @Nonnull List<Pair<String, String>> artifactServices = CollectionSupport.emptyList();
+ @Nonnull private final List<Pair<String, String>> artifactServices = CollectionSupport.emptyList();
/** {@inheritDoc} */
protected void doInitialize() throws ComponentInitializationException {
@@ -242,8 +243,8 @@ public class InstalledMetadataParameters extends AbstractInitializableComponent
@Nonnull final Collection<Pair<String,String>> input) {
return input
.stream()
- .map(p -> converter.apply(new StringBuffer(p.getFirst()).append(dnsName).append(p.getSecond()).toString(),
- protocols))
+ .map(p -> converter.apply(
+ new StringBuffer(p.getFirst()).append(dnsName).append(p.getSecond()).toString(), protocols))
.collect(CollectionSupport.nonnullCollector(Collectors.toUnmodifiableList())).get();
}
@@ -269,7 +270,7 @@ public class InstalledMetadataParameters extends AbstractInitializableComponent
for (final IndexedEndpoint e : role.getArtifactResolutionServices()) {
e.setIndex(index++);
}
- protocols.forEach(role::addSupportedProtocol);
+ protocols.forEach(role::addSupportedProtocol);
return role;
}
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 34e2a69fb..6e258b12e 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
@@ -119,6 +119,14 @@ public class InstallerProperties {
/** Whether to tidy up after ourselves. */
public static final int DEFAULT_KEY_SIZE = 3072;
+ /** Those modules which are "core". */
+ @Nonnull public static final Set<String> CORE_MODULES =
+ CollectionSupport.setOf("idp.Core", "idp.EditWebApp", "idp.CommandLine");
+
+ /** Those modules enabled by default. */
+ @Nonnull public static final Set<String> DEFAULT_MODULES =
+ CollectionSupport.setOf("idp.authn.Password", "idp.admin.Hello");
+
/** Class logger. */
@Nonnull private final Logger log = LoggerFactory.getLogger(InstallerProperties.class);
@@ -167,12 +175,6 @@ public class InstallerProperties {
/** Input handler from the prompting. */
@Nonnull private final InputHandler inputHandler;
- /** Those modules which are "core". */
- @Nonnull public static final Set<String> CORE_MODULES = CollectionSupport.setOf("idp.Core", "idp.EditWebApp", "idp.CommandLine");
-
- /** Those modules enabled by default. */
- @Nonnull public static final Set<String> DEFAULT_MODULES = CollectionSupport.setOf("idp.authn.Password", "idp.admin.Hello");
-
/**
* Constructor.
*
@@ -306,7 +308,7 @@ public class InstallerProperties {
final String s = Base64Support.encode(key, false).substring(0, 32);
assert s != null;
return s;
- } catch (NoSuchAlgorithmException|EncodingException e) {
+ } catch (final NoSuchAlgorithmException|EncodingException e) {
log.error("Password Generation failed", e);
throw new BuildException("Password Generation failed", e);
}
@@ -325,7 +327,8 @@ public class InstallerProperties {
if (targetDir != null) {
return targetDir;
}
- final Path td = targetDir = Path.of(getValue(TARGET_DIR, "Installation Directory:", () -> "/opt/shibboleth-idp"));
+ final Path td = targetDir =
+ Path.of(getValue(TARGET_DIR, "Installation Directory:", () -> "/opt/shibboleth-idp"));
assert td != null;
return td;
}
@@ -347,7 +350,8 @@ public class InstallerProperties {
@Nonnull public String getEntityID() {
String result = entityID;
if (result == null) {
- entityID = result = getValue(ENTITY_ID, "SAML EntityID:", () -> "https://" + getHostName() + "/idp/shibboleth");
+ entityID = result =
+ getValue(ENTITY_ID, "SAML EntityID:", () -> "https://" + getHostName() + "/idp/shibboleth");
}
return result;
}
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 f8b22880e..b52164921 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
@@ -171,6 +171,7 @@ public class UpdateIdPArguments extends AbstractIdPHomeAwareCommandLineArguments
return operation;
}
+// Checkstyle: CyclomaticComplexity OFF
/** {@inheritDoc} */
public void validate() throws IllegalArgumentException {
super.validate();
@@ -221,6 +222,7 @@ public class UpdateIdPArguments extends AbstractIdPHomeAwareCommandLineArguments
operation = OperationType.CHECK;
}
}
+// Checkstyle: CyclomaticComplexity ON
/** {@inheritDoc} */
public void printHelp(final @Nonnull PrintStream out) {
@@ -233,8 +235,10 @@ public class UpdateIdPArguments extends AbstractIdPHomeAwareCommandLineArguments
out.println();
out.println("With no options displays the update status of the IdP");
out.println();
- out.println(String.format(" %-22s %s", "-d, --downloadDir <directory>", "Download the distribution for an available update"));
- out.println(String.format(" %-22s %s", "-fd, --force-download <file>", "Specify the version to be downloaded by -d"));
+ out.println(String.format(" %-22s %s", "-d, --downloadDir <directory>",
+ "Download the distribution for an available update"));
+ out.println(String.format(" %-22s %s", "-fd, --force-download <file>",
+ "Specify the version to be downloaded by -d"));
out.println();
out.println(String.format(" %-22s %s", "-l, --list", "list all available versions"));
out.println();
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 bc74674af..f656bc917 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
@@ -25,7 +25,6 @@ import java.nio.file.Path;
import java.security.Security;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import java.util.Properties;
import javax.annotation.Nonnull;
@@ -63,7 +62,7 @@ import net.shibboleth.shared.spring.httpclient.resource.HTTPResource;
public class UpdateIdPCLI extends AbstractIdPHomeAwareCommandLine<UpdateIdPArguments> {
/** The place we publish our keys. */
- @Nonnull public static String SHIBBOLETH_SIGNING_KEYS = "http://shibboleth.net/downloads/PGP_KEYS";
+ @Nonnull public static final String SHIBBOLETH_SIGNING_KEYS = "http://shibboleth.net/downloads/PGP_KEYS";
/** Logger. */
@Nullable private Logger log;
@@ -123,14 +122,15 @@ public class UpdateIdPCLI extends AbstractIdPHomeAwareCommandLine<UpdateIdPArgum
for (final String s:urlStrings) {
try {
urls.add(new URL(s));
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
getLogger().error("Could not convert {} to a URL", s);
return RC_IO;
}
}
final HttpClient client = getHttpClient();
assert client != null;
- final Properties properties = InstallableComponentSupport.loadInfo(urls, client, getHttpClientSecurityParameters());
+ final Properties properties =
+ InstallableComponentSupport.loadInfo(urls, client, getHttpClientSecurityParameters());
if (properties == null) {
return RC_IO;
}
@@ -144,13 +144,17 @@ public class UpdateIdPCLI extends AbstractIdPHomeAwareCommandLine<UpdateIdPArgum
}
}
- /** Check for a potential upgrade, then download if that was requested
+ /**
+ * Check for a potential upgrade, then download if that was requested.
+ *
* @param args The command line
* @param info information about the IdP update states, digested from "plugin.properties"
- * @param doDownload whether to download the distribution
+ * @param doDownload whether to download the distribution
+ *
* @return a "return status"
*/
- private int checkUpdate(@Nonnull UpdateIdPArguments args, @Nonnull final InstallableComponentInfo info, boolean doDownload) {
+ private int checkUpdate(@Nonnull final UpdateIdPArguments args, @Nonnull final InstallableComponentInfo info,
+ final boolean doDownload) {
final InstallableComponentVersion from = args.getUpdateFromVersion();
final VersionInfo currInfo = info.getAvailableVersions().get(from);
@@ -172,7 +176,7 @@ public class UpdateIdPCLI extends AbstractIdPHomeAwareCommandLine<UpdateIdPArgum
}
InstallableComponentVersion newIdPVersion = args.getUpdateToVersion();
- boolean versionSpecified = newIdPVersion != null;
+ final boolean versionSpecified = newIdPVersion != null;
if (!versionSpecified) {
newIdPVersion = InstallableComponentSupport.getBestVersion(from, from, info);
}
@@ -200,13 +204,14 @@ public class UpdateIdPCLI extends AbstractIdPHomeAwareCommandLine<UpdateIdPArgum
*/
private int list(@Nonnull final UpdateIdPArguments args, @Nonnull final InstallableComponentInfo info) {
- final Map<InstallableComponentVersion, InstallableComponentInfo.VersionInfo> versionMap = info.getAvailableVersions();
+ final var versionMap = info.getAvailableVersions();
final List<InstallableComponentVersion> versionList = new ArrayList<>(versionMap.keySet());
versionList.sort(null);
final InstallableComponentVersion us = args.getUpdateFromVersion();
for (final InstallableComponentVersion ver:versionList) {
final InstallableComponentInfo.VersionInfo inf = versionMap.get(ver);
- getLogger().info("Version {}{} Supported Status: {}, Upgrade Candidate: {}", ver, ver.equals(us) ? " (current);" : ";",
+ getLogger().info("Version {}{} Supported Status: {}, Upgrade Candidate: {}", ver,
+ ver.equals(us) ? " (current);" : ";",
inf.getSupportLevel(),
info.isSupportedWithIdPVersion(ver, us)?"yes": "no");
}
@@ -214,10 +219,13 @@ public class UpdateIdPCLI extends AbstractIdPHomeAwareCommandLine<UpdateIdPArgum
return RC_OK;
}
- /** Download the provided or inferred version
+ /**
+ * Download the provided or inferred version.
+ *
* @param args the command line
* @param version the idp version to download
* @param info version about all IdP release
+ *
* @return a "return status"
*/
private int download(@Nonnull final UpdateIdPArguments args,
@@ -236,7 +244,8 @@ public class UpdateIdPCLI extends AbstractIdPHomeAwareCommandLine<UpdateIdPArgum
return RC_IO;
}
- getLogger().info("Downloading version {} to {} from {}/{}", version, args.getDownloadLocation(), baseUrl, fileName);
+ getLogger().info("Downloading version {} to {} from {}/{}", version, args.getDownloadLocation(), baseUrl,
+ fileName);
try {
final HttpClient client = getHttpClient();
assert client != null;
@@ -255,13 +264,13 @@ public class UpdateIdPCLI extends AbstractIdPHomeAwareCommandLine<UpdateIdPArgum
return RC_IO;
}
getLogger().debug("Checking signature");
- int result = checkSignature(args, fileName);
+ final int result = checkSignature(args, fileName);
if (result != RC_OK) {
getLogger().info("Deleting downloaded files");
try {
Files.delete(args.getDownloadLocation().resolve(fileName));
Files.delete(args.getDownloadLocation().resolve(fileName + ".asc"));
- } catch (IOException e) {
+ } catch (final IOException e) {
getLogger().error("Could not delete {}[.asc]", fileName, e);
args.getDownloadLocation().resolve(fileName).toFile().deleteOnExit();
args.getDownloadLocation().resolve(fileName + ".asc").toFile().deleteOnExit();
@@ -314,7 +323,8 @@ public class UpdateIdPCLI extends AbstractIdPHomeAwareCommandLine<UpdateIdPArgum
new FileInputStream(args.getDownloadLocation().resolve(fileName).toFile()))) {
if (!trust.checkSignature(distroStream, sig)) {
getLogger().info("Signature checked for {} failed", fileName);
- return RC_IO; }
+ return RC_IO;
+ }
}
} catch (final ComponentInitializationException | IOException e) {
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 9346d79da..808a89f5d 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
@@ -133,7 +133,8 @@ public class V5Install {
*/
protected void checkPreConditions() throws BuildException {
final String versionAsString = Version.getVersion();
- final InstallableComponentVersion idpVersion = new InstallableComponentVersion(versionAsString!=null?versionAsString:"5.0.0");
+ final InstallableComponentVersion idpVersion =
+ new InstallableComponentVersion(versionAsString!=null?versionAsString:"5.0.0");
for (final IdPPlugin plugin: ServiceLoader.load(IdPPlugin.class, currentState.getInstalledPluginsLoader())) {
final String pluginId = plugin.getPluginId();
final InstallableComponentVersion pluginVersion = new InstallableComponentVersion(plugin);
@@ -344,20 +345,21 @@ public class V5Install {
final Pattern pat = Pattern.compile(".*net\\.shibboleth\\.ext\\.spring"+
"\\.context\\.DeferPlaceholderFileSystemXmlWebApplicationContext.*");
final Pattern systemInWebXml = Pattern.compile(".*\\$\\{idp\\.home\\}/system.*");
- boolean foundPat1 = false, foundSystemInWebXml = false;
+ boolean foundPat1 = false;
+ boolean foundSystemInWebXml = false;
String line = in.readLine();
while (line != null) {
if (!foundPat1 && pat.matcher(line).matches()) {
foundPat1=true;
log.warn("Your copy of edit-webapp/WEB-INF/web.xml contains a reference to a replaced class, {}",
DeferPlaceholderFileSystemXmlWebApplicationContext.class.getCanonicalName());
- log.warn("You MUST update this to {} and rebuild the war after installation or the IdP will refuse to start.",
+ log.warn("You MUST update this to {} and rebuild the war after installation or the IdP will refuse to start",
DelimiterAwareApplicationContext.class.getCanonicalName());
}
if (!foundSystemInWebXml && systemInWebXml.matcher(line).matches()) {
foundSystemInWebXml=true;
log.warn("Your copy of edit-webapp/WEB-INF/web.xml contains a reference to ${idp.home}/system");
- log.warn("This no longer exists. Make the required changed and rebuild the war after installation or the IdP will refuse to start.");
+ log.warn("This no longer exists. Make the required changed and rebuild the war after installation or the IdP will refuse to start");
}
line = in.readLine();
}
@@ -366,7 +368,9 @@ public class V5Install {
}
}
- /** Enable Core modules if this is a new install
+ /**
+ * Enable Core modules if this is a new install.
+ *
* @throws BuildException if badness occurs
*/
protected void enableCoreModules() throws BuildException {
@@ -470,7 +474,7 @@ public class V5Install {
}
try {
InitializationService.initialize();
- } catch (InitializationException e) {
+ } catch (final InitializationException e) {
log.error("Could not intiailize opensaml", e);
throw new BuildException(e);
}
@@ -483,7 +487,8 @@ public class V5Install {
.build();
log.info("Creating Metadata to {}", metadataFile);
- final InstalledMetadataParameters parameters = context.getBean("IdPConfiguration", InstalledMetadataParameters.class);
+ final InstalledMetadataParameters parameters =
+ context.getBean("IdPConfiguration", InstalledMetadataParameters.class);
parameters.setDnsName(installerProps.getHostName());
final VelocityEngine engine = context.getBean("VelocityEngine", VelocityEngine.class);
log.debug("Parameters {}", parameters);
@@ -497,10 +502,10 @@ public class V5Install {
generator.setVelocityEngine(engine);
generator.initialize();
generator.generate(parameters, sink);
- } catch (ComponentInitializationException e) {
+ } catch (final ComponentInitializationException e) {
log.error("Metadata Generator initialization failed", e);
throw new BuildException(e);
- } catch (IOException e) {
+ } catch (final IOException e) {
log.error("Metadata Generator failed to write to", metadataFile, e);
throw new BuildException(e);
}
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 81057a7ea..47f8a3e30 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
@@ -302,7 +302,8 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
}
}
LOG.info("Installing Plugin {} version {}.{}.{}", pluginId,
- getDescription().getMajorVersion(),getDescription().getMinorVersion(), getDescription().getPatchVersion());
+ getDescription().getMajorVersion(),getDescription().getMinorVersion(),
+ getDescription().getPatchVersion());
final Set<String> loadedModules = getLoadedModules();
try (final RollbackPluginInstall rollBack = new RollbackPluginInstall(getModuleContext(), moduleChanges)) {
@@ -824,7 +825,8 @@ 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(@Nonnull 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);
@@ -1017,7 +1019,8 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
@Nonnull public List<IdPPlugin> getInstalledPlugins() throws BuildException {
final Stream<Provider<IdPPlugin>> loaderStream =
ServiceLoader.load(IdPPlugin.class, getInstalledPluginsLoader()).stream();
- return loaderStream.map(ServiceLoader.Provider::get).collect(CollectionSupport.nonnullCollector(Collectors.toList())).get();
+ return loaderStream.map(ServiceLoader.Provider::get)
+ .collect(CollectionSupport.nonnullCollector(Collectors.toList())).get();
}
/** Find the {@link IdPPlugin} with the provided Id.
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 aa16c263f..70f6fdfdf 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
@@ -135,7 +135,8 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
}
}
- try (final PluginInstaller inst = new PluginInstaller(Constraint.isNotNull(getHttpClient(), "HJttpClient cannot be non null (by construction"))) {
+ try (final PluginInstaller inst = new PluginInstaller(
+ Constraint.isNotNull(getHttpClient(), "HJttpClient cannot be non null (by construction"))) {
constructPluginInstaller(inst, args);
assert inst == installer;
final String pluginId = args.getPluginId();
@@ -160,7 +161,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
inst.setPluginId(pluginId);
}
if (args.isInstallId()) {
- assert(pluginId != null);
+ assert pluginId != null;
return autoPluginFromId(pluginId, !args.isNoCheck());
}
inst.installPlugin(args.getInputURL(), args.getInputFileName(), !args.isNoCheck());
@@ -224,7 +225,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
//
assert client != null;
inst.setModuleContextSecurityParams(getHttpClientSecurityParameters());
- assert(updateURLs != null);
+ assert updateURLs != null;
inst.setUpdateOverrideURLs(updateURLs);
inst.setRebuildWar(args.isRebuild());
inst.initialize();
@@ -260,7 +261,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
log.error("Could not interrogate plugin {}", plugin.getPluginId(), e);
return;
}
- final Map<InstallableComponentVersion, InstallableComponentInfo.VersionInfo> versionMap = state.getPluginInfo().getAvailableVersions();
+ final var versionMap = state.getPluginInfo().getAvailableVersions();
final List<InstallableComponentVersion> versionList = new ArrayList<>(versionMap.keySet());
versionList.sort(null);
outOrLog("\tVersions ");
@@ -391,7 +392,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
@Nonnull final InstallableComponentInfo pluginInfo) {
final InstallableComponentVersion idpVersion;
- String idpVersionString = Version.getVersion();
+ final String idpVersionString = Version.getVersion();
if (idpVersionString!=null) {
idpVersion = new InstallableComponentVersion(idpVersionString);
} else {
@@ -484,7 +485,8 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
log.error("Plugin {}: Information not found", pluginId);
return RC_INIT;
}
- final InstallableComponentVersion versionToInstall = getBestVersion(new InstallableComponentVersion(0,0,0), info);
+ final InstallableComponentVersion versionToInstall =
+ getBestVersion(new InstallableComponentVersion(0,0,0), info);
if (versionToInstall == null) {
log.error("Plugin {}: No version available to install", pluginId);
return RC_INIT;
@@ -505,13 +507,12 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
assert client != null;
if (updateURLs.isEmpty()) {
try {
- return InstallableComponentSupport.loadInfo(
- CollectionSupport.listOf(
- new URL("https://shibboleth.net/downloads/identity-provider/plugins/plugins.properties"),
- new URL("http://plugins.shibboleth.net/plugins.properties")),
+ return InstallableComponentSupport.loadInfo(CollectionSupport.listOf(
+ new URL("https://shibboleth.net/downloads/identity-provider/plugins/plugins.properties"),
+ new URL("http://plugins.shibboleth.net/plugins.properties")),
client,
getHttpClientSecurityParameters());
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
getLogger().error("Could not contruct URL list");
return new Properties();
}
@@ -557,7 +558,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
}
} else {
installVersion = pluginVersion;
- final Map<InstallableComponentVersion, InstallableComponentInfo.VersionInfo> versions = state.getPluginInfo().getAvailableVersions();
+ final var versions = state.getPluginInfo().getAvailableVersions();
if (!versions.containsKey(installVersion)) {
log.error("Specified version {} could not be found. Available versions: {}",
installVersion, versions.keySet());
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginState.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginState.java
index 8fe14618c..574b53edb 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginState.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginState.java
@@ -165,7 +165,7 @@ public class PluginState extends AbstractInitializableComponent {
propertyResource = new FileSystemResource(path);
} else if ("http".equals(url.getProtocol()) || "https".equals(url.getProtocol())) {
final HTTPResource httpResource;
- assert(httpClient != null);
+ assert httpClient != null;
propertyResource = httpResource = new HTTPResource(httpClient, url);
final HttpClientSecurityContextHandler handler = new HttpClientSecurityContextHandler();
handler.setHttpClientSecurityParameters(httpClientSecurityParameters);
@@ -191,8 +191,7 @@ public class PluginState extends AbstractInitializableComponent {
}
return;
}
- }
- catch (final IOException e) {
+ } catch (final IOException e) {
log.error("Could not open Update Resource for {} :", plugin.getPluginId(), e);
continue;
}
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 92f13c7df..e854c7f5c 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
@@ -261,7 +261,8 @@ 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(@Nonnull final InputStream input, @Nonnull 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());
@@ -365,7 +366,8 @@ import net.shibboleth.shared.primitive.LoggerFactory;
if (list.isEmpty()) {
throw new IOException("Provided signature file was empty");
}
- signature = Constraint.isNotNull(list.get(0), "PGPSignatureList#get(0) retiurned null for non empty list");
+ signature = Constraint.isNotNull(list.get(0),
+ "PGPSignatureList#get(0) retiurned null for non empty list");
} else {
throw new IOException("Provided file was not a signature");
}
diff --git a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessAssertionsForAuthentication.java b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessAssertionsForAuthentication.java
index 976a497b9..a476b13a8 100644
--- a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessAssertionsForAuthentication.java
+++ b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessAssertionsForAuthentication.java
@@ -30,7 +30,6 @@ import org.opensaml.messaging.context.MessageContext;
import org.opensaml.messaging.context.navigate.ChildContextLookup;
import org.opensaml.profile.action.ActionSupport;
import org.opensaml.profile.context.ProfileRequestContext;
-import org.opensaml.saml.common.SAMLObject;
import org.opensaml.saml.common.assertion.ValidationContext;
import org.opensaml.saml.common.assertion.ValidationProcessingData;
import org.opensaml.saml.common.assertion.ValidationResult;
@@ -248,13 +247,12 @@ public class ProcessAssertionsForAuthentication extends AbstractAuthenticationAc
private class DefaultResponseResolver implements Function<ProfileRequestContext, Response> {
/** {@inheritDoc} */
- public Response apply(final @Nullable ProfileRequestContext profileContext) {
- assert profileContext!= null;
- final MessageContext imc = Constraint.isNotNull(profileContext.getInboundMessageContext(), "No inbound Message Context");;
-
- final SAMLObject message = (SAMLObject) imc.getMessage();
- if (message instanceof Response) {
- return (Response) message;
+ @Nullable public Response apply(@Nullable final ProfileRequestContext profileContext) {
+ if (profileContext != null) {
+ final MessageContext imc = profileContext.ensureInboundMessageContext();
+ if (imc.getMessage() instanceof Response r) {
+ return r;
+ }
}
return null;
diff --git a/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSession.java b/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSession.java
index 0ae408e18..fd75f916a 100644
--- a/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSession.java
+++ b/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSession.java
@@ -449,7 +449,8 @@ public class StorageBackedIdPSession extends AbstractIdPSession {
if (super.removeSPSession(spSession)) {
try {
// Remove the separate record.
- sessionManager.getStorageService().delete(getId(), getSPSessionStorageKey(Constraint.isNotNull(spSession.getId(), "SessionID was empty")));
+ sessionManager.getStorageService().delete(getId(),
+ getSPSessionStorageKey(Constraint.isNotNull(spSession.getId(), "SessionID was empty")));
} catch (final IOException e) {
log.error("Exception removing SPSession record for IdP session {} and service {}", getId(),
spSession.getId(), e);
@@ -634,7 +635,9 @@ public class StorageBackedIdPSession extends AbstractIdPSession {
}
final String sessionClassName = record.getValue().substring(0, pos);
- final SPSessionSerializerRegistry registry = Constraint.isNotNull(sessionManager.getSPSessionSerializerRegistry(), "Session Serializer Registry not set up");
+ final SPSessionSerializerRegistry registry =
+ Constraint.isNotNull(sessionManager.getSPSessionSerializerRegistry(),
+ "Session Serializer Registry not set up");
// Look up the serializer instance for that class type.
final Class<? extends SPSession> claz = Class.forName(sessionClassName).asSubclass(SPSession.class);
@@ -671,7 +674,9 @@ public class StorageBackedIdPSession extends AbstractIdPSession {
private boolean saveSPSessionToStorage(@Nonnull final SPSession session) throws IOException {
log.debug("Saving SPSession for service {} in session {}", session.getId(), getId());
- final SPSessionSerializerRegistry registry = Constraint.isNotNull(sessionManager.getSPSessionSerializerRegistry(), "Session Serializer Registry not set up");
+ final SPSessionSerializerRegistry registry =
+ Constraint.isNotNull(sessionManager.getSPSessionSerializerRegistry(),
+ "Session Serializer Registry not set up");
// Look up the serializer instance for that class type.
final Class<? extends SPSession> claz = session.getClass();
assert claz != null;
diff --git a/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSessionSerializer.java b/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSessionSerializer.java
index fccbe2d5a..1d641366a 100644
--- a/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSessionSerializer.java
+++ b/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSessionSerializer.java
@@ -94,7 +94,7 @@ public class StorageBackedIdPSessionSerializer extends AbstractInitializableComp
@Nullable final StorageBackedIdPSession target) {
sessionManager = Constraint.isNotNull(manager, "SessionManager cannot be null");
targetObject = target;
- final JsonProvider prov = JsonProvider.provider();;
+ final JsonProvider prov = JsonProvider.provider();
assert prov!=null;
jsonProvider = prov;
}
@@ -156,8 +156,10 @@ public class StorageBackedIdPSessionSerializer extends AbstractInitializableComp
}
}
+// Checkstyle: MethodLength OFF
/** {@inheritDoc} */
- @Override @Nonnull public StorageBackedIdPSession deserialize(final long version,
+ @Override
+ @Nonnull public StorageBackedIdPSession deserialize(final long version,
@Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String key,
@Nonnull @NotEmpty final String value, @Nullable final Long expiration) throws IOException {
@@ -235,6 +237,6 @@ public class StorageBackedIdPSessionSerializer extends AbstractInitializableComp
throw new IOException("Found invalid data structure while parsing IdPSession", e);
}
}
-// Checkstyle: CyclomaticComplexity ON
+// Checkstyle: CyclomaticComplexity|MethodLength ON
}
\ No newline at end of file
diff --git a/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedSessionManager.java b/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedSessionManager.java
index 766b4cf30..9cd8ae746 100644
--- a/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedSessionManager.java
+++ b/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedSessionManager.java
@@ -434,7 +434,7 @@ public class StorageBackedSessionManager extends AbstractIdentifiableInitializab
/** Get the {@link HttpServletRequest} associated with this operation.
* @return the {@link HttpServletRequest}
*/
- @Nullable final private HttpServletRequest getHttpRequest() {
+ @Nullable private HttpServletRequest getHttpRequest() {
final NonnullSupplier<HttpServletRequest> supplier = httpRequestSupplier;
if (supplier == null) {
return null;
@@ -681,8 +681,9 @@ public class StorageBackedSessionManager extends AbstractIdentifiableInitializab
// Need to update record.
final String updated = sessionList.getValue() + idpSession.getId() + ',';
if (storageService.updateWithVersion(sessionList.getVersion(), serviceId, serviceKey, updated,
- Math.max(Constraint.isNotNull(sessionList.getExpiration(),"Session List Expiration not set"),
- spSession.getExpirationInstant().plus(sessionSlop).toEpochMilli())) == null) {
+ Math.max(Constraint.isNotNull(sessionList.getExpiration(),
+ "Session List Expiration not set"),
+ spSession.getExpirationInstant().plus(sessionSlop).toEpochMilli())) == null) {
log.debug("Secondary index record disappeared, retrying as insert");
indexBySPSession(idpSession, spSession, attempts - 1);
}
@@ -708,6 +709,7 @@ public class StorageBackedSessionManager extends AbstractIdentifiableInitializab
}
}
+ // Checkstyle: MethodLength OFF
/**
* Remove or update a secondary index record from an SPSession to a parent IdPSession.
*
@@ -789,6 +791,7 @@ public class StorageBackedSessionManager extends AbstractIdentifiableInitializab
}
}
}
+// Checkstyle: MethodLength ON
/**
* Performs a lookup and deserializes a record based on session ID.
diff --git a/idp-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/FlowDefinitionResourceFactory.java b/idp-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/FlowDefinitionResourceFactory.java
index 23607663a..1be149a74 100644
--- a/idp-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/FlowDefinitionResourceFactory.java
+++ b/idp-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/FlowDefinitionResourceFactory.java
@@ -156,6 +156,7 @@ public class FlowDefinitionResourceFactory {
return flowResources;
}
+// Checkstyle: CyclomaticComplexity OFF
/**
* Obtains the flow id from the flow resource. By default, the flow id becomes the portion of the path between the
* basePath and the filename.
@@ -190,7 +191,8 @@ public class FlowDefinitionResourceFactory {
if (fname != null) {
return StringUtils.stripFilenameExtension(fname);
} else {
- throw new IOException("Unable to obtain filename from Resource of type " + flowResource.getClass().getName());
+ throw new IOException("Unable to obtain filename from Resource of type " +
+ flowResource.getClass().getName());
}
}
@@ -214,11 +216,13 @@ public class FlowDefinitionResourceFactory {
if (fname != null) {
return StringUtils.stripFilenameExtension(fname);
} else {
- throw new IOException("Unable to obtain filename from Resource of type " + flowResource.getClass().getName());
+ throw new IOException("Unable to obtain filename from Resource of type " +
+ flowResource.getClass().getName());
}
}
return filePath.substring(beginIndex, endIndex);
}
+// Checkstyle: CyclomaticComplexity ON
/**
* If the file path contains the base path, then the part after the base path is returned,
diff --git a/idp-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/FlowModelFlowBuilder.java b/idp-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/FlowModelFlowBuilder.java
index ce67ad807..468792be4 100644
--- a/idp-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/FlowModelFlowBuilder.java
+++ b/idp-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/FlowModelFlowBuilder.java
@@ -77,7 +77,7 @@ public class FlowModelFlowBuilder extends org.springframework.webflow.engine.bui
.map(BeanImportModel::getResource)
.collect(CollectionSupport.nonnullCollector(Collectors.toUnmodifiableList()))
.get();
- final String result[] = resultAsList.toArray(resources);
+ final String[] result = resultAsList.toArray(resources);
assert result != null;
return result;
}
diff --git a/idp-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/FlowRelativeResourceLoader.java b/idp-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/FlowRelativeResourceLoader.java
index 4d4741e55..15c06cfca 100644
--- a/idp-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/FlowRelativeResourceLoader.java
+++ b/idp-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/FlowRelativeResourceLoader.java
@@ -76,8 +76,11 @@ class FlowRelativeResourceLoader extends DefaultResourceLoader {
return createFlowRelativeResource(location);
}
- /** Return resource relative to the {@linkplain #flowResource}
+ /**
+ * Return resource relative to the {@linkplain #flowResource}.
+ *
* @param location the resource location
+ *
* @return a corresponding Resource handle
*/
@Nonnull private Resource createFlowRelativeResource(@Nonnull final String location) {
diff --git a/idp-ui/src/main/java/net/shibboleth/idp/ui/context/RelyingPartyUIContext.java b/idp-ui/src/main/java/net/shibboleth/idp/ui/context/RelyingPartyUIContext.java
index 0440fb293..b195dd852 100644
--- a/idp-ui/src/main/java/net/shibboleth/idp/ui/context/RelyingPartyUIContext.java
+++ b/idp-ui/src/main/java/net/shibboleth/idp/ui/context/RelyingPartyUIContext.java
@@ -51,8 +51,6 @@ import net.shibboleth.shared.annotation.constraint.NotLive;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
-import net.shibboleth.shared.primitive.DeprecationSupport;
-import net.shibboleth.shared.primitive.DeprecationSupport.ObjectType;
import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.NonnullSupplier;
import net.shibboleth.shared.primitive.StringSupport;
diff --git a/idp-ui/src/main/java/net/shibboleth/idp/ui/csrf/impl/CSRFTokenFlowExecutionListener.java b/idp-ui/src/main/java/net/shibboleth/idp/ui/csrf/impl/CSRFTokenFlowExecutionListener.java
index 0e7c2539a..d8413e281 100644
--- a/idp-ui/src/main/java/net/shibboleth/idp/ui/csrf/impl/CSRFTokenFlowExecutionListener.java
+++ b/idp-ui/src/main/java/net/shibboleth/idp/ui/csrf/impl/CSRFTokenFlowExecutionListener.java
@@ -157,7 +157,7 @@ public class CSRFTokenFlowExecutionListener extends AbstractInitializableCompone
final Object storedCsrfTokenObject = context.getViewScope().get(CSRF_TOKEN_VIEWSCOPE_NAME);
final String activeFlowId = context.getActiveFlow().getId();
assert activeFlowId != null;
- if (storedCsrfTokenObject == null || (!(storedCsrfTokenObject instanceof CSRFToken))) {
+ if (storedCsrfTokenObject == null || !(storedCsrfTokenObject instanceof CSRFToken)) {
log.warn("CSRF token is required but was not found in the view-scope; for "
+ "view-state '{}' and event '{}'.",stateId,event.getId());
throw new InvalidCSRFTokenException(activeFlowId, stateId,
diff --git a/idp-ui/src/main/java/net/shibboleth/idp/ui/impl/SetRPUIInformation.java b/idp-ui/src/main/java/net/shibboleth/idp/ui/impl/SetRPUIInformation.java
index c000ddab4..4c81a5158 100644
--- a/idp-ui/src/main/java/net/shibboleth/idp/ui/impl/SetRPUIInformation.java
+++ b/idp-ui/src/main/java/net/shibboleth/idp/ui/impl/SetRPUIInformation.java
@@ -152,7 +152,8 @@ public class SetRPUIInformation extends AbstractProfileAction {
if (spSSODescriptor != null) {
final Extensions exts = spSSODescriptor.getExtensions();
if (exts != null) {
- final List<XMLObject> children = Constraint.isNotNull(exts.getOrderedChildren(), "Extension Object had no children");
+ final List<XMLObject> children =
+ Constraint.isNotNull(exts.getOrderedChildren(), "Extension Object had no children");
for (final XMLObject object : children) {
if (object instanceof UIInfo) {
return (UIInfo) object;
@@ -209,7 +210,7 @@ public class SetRPUIInformation extends AbstractProfileAction {
rpUIContext.setRPUInfo(getRPUInfo());
final HttpServletRequest request = getHttpServletRequest();
final NonnullSupplier<HttpServletRequest> supplier = getHttpServletRequestSupplier();
- assert request != null && supplier!= null;;
+ assert request != null && supplier!= null;
rpUIContext.setBrowserLanguageRanges(SpringSupport.getLanguageRange(request));
rpUIContext.setRequestSupplier(supplier);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list