[java-opensaml] 09/12: JPAR-85 - Checkstyle, check final parameters
Tom Zeller
tzeller at dragonacea.biz
Thu Aug 10 18:25:58 EDT 2017
This is an automated email from the git hooks/post-receive script.
tzeller pushed a commit to branch master
in repository java-opensaml.
View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=a24b585f4d3b5ca9d3034f35dc14929b7b8eca06
commit a24b585f4d3b5ca9d3034f35dc14929b7b8eca06
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Thu Aug 10 16:56:19 2017 -0500
JPAR-85 - Checkstyle, check final parameters
---
.../xmlsec/algorithm/AlgorithmRegistry.java | 17 ++++----
.../xmlsec/algorithm/AlgorithmSupport.java | 9 ++--
.../DecryptionConfigurationCriterion.java | 6 +--
.../EncryptionConfigurationCriterion.java | 6 +--
.../criterion/EncryptionOptionalCriterion.java | 4 +-
.../KeyInfoGenerationProfileCriterion.java | 2 +-
.../SignatureSigningConfigurationCriterion.java | 6 +--
.../SignatureValidationConfigurationCriterion.java | 6 +--
.../xmlsec/encryption/support/Decrypter.java | 50 +++++++++++-----------
.../xmlsec/encryption/support/Encrypter.java | 34 +++++++--------
.../support/KeyEncryptionParameters.java | 2 +-
.../encryption/support/RSAOAEPParameters.java | 8 ++--
...SimpleKeyInfoReferenceEncryptedKeyResolver.java | 4 +-
.../opensaml/xmlsec/keyinfo/KeyInfoCriterion.java | 2 +-
.../opensaml/xmlsec/keyinfo/KeyInfoSupport.java | 7 +--
.../keyinfo/NamedKeyInfoGeneratorManager.java | 2 +-
.../xmlsec/signature/support/SignatureSupport.java | 2 +-
.../SignatureValidationParametersCriterion.java | 2 +-
.../signature/support/URIContentReference.java | 4 +-
19 files changed, 88 insertions(+), 85 deletions(-)
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/algorithm/AlgorithmRegistry.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/algorithm/AlgorithmRegistry.java
index b821328..c7b3ef5 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/algorithm/AlgorithmRegistry.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/algorithm/AlgorithmRegistry.java
@@ -199,7 +199,7 @@ public class AlgorithmRegistry {
*
* @param descriptor the algorithm
*/
- private void index(AlgorithmDescriptor descriptor) {
+ private void index(final AlgorithmDescriptor descriptor) {
if (checkRuntimeSupports(descriptor)) {
runtimeSupported.add(descriptor.getURI());
} else {
@@ -225,7 +225,7 @@ public class AlgorithmRegistry {
*
* @param descriptor the algorithm
*/
- private void deindex(AlgorithmDescriptor descriptor) {
+ private void deindex(final AlgorithmDescriptor descriptor) {
runtimeSupported.remove(descriptor.getURI());
if (descriptor instanceof DigestAlgorithm) {
@@ -246,7 +246,7 @@ public class AlgorithmRegistry {
* @return true if runtime supports the algorithm, false otherwise
*/
// Checkstyle: CyclomaticComplexity OFF
- private boolean checkRuntimeSupports(AlgorithmDescriptor descriptor) {
+ private boolean checkRuntimeSupports(final AlgorithmDescriptor descriptor) {
try {
switch(descriptor.getType()) {
@@ -276,13 +276,13 @@ public class AlgorithmRegistry {
descriptor.getClass().getName());
}
- } catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
+ } catch (final NoSuchAlgorithmException | NoSuchPaddingException e) {
if (!checkSpecialCasesRuntimeSupport(descriptor)) {
log.debug(String.format("AlgorithmDescriptor failed runtime support check: %s",
descriptor.getURI()), e);
return false;
}
- } catch (Throwable t) {
+ } catch (final Throwable t) {
log.error("Fatal error evaluating algorithm runtime support", t);
return false;
}
@@ -299,7 +299,8 @@ public class AlgorithmRegistry {
* @return true if key length supported, false otherwise
* @throws NoSuchAlgorithmException if the associated JCA algorithm is not supported by the runtime
*/
- private boolean checkCipherSupportedKeyLength(AlgorithmDescriptor descriptor) throws NoSuchAlgorithmException {
+ private boolean checkCipherSupportedKeyLength(final AlgorithmDescriptor descriptor)
+ throws NoSuchAlgorithmException {
if (descriptor instanceof KeyLengthSpecifiedAlgorithm) {
int algoLength = ((KeyLengthSpecifiedAlgorithm)descriptor).getKeyLength();
int cipherMaxLength = Cipher.getMaxAllowedKeyLength(descriptor.getJCAAlgorithmID());
@@ -319,7 +320,7 @@ public class AlgorithmRegistry {
*
* @return true if algorithm is supported by the runtime environment, false otherwise
*/
- private boolean checkSpecialCasesRuntimeSupport(AlgorithmDescriptor descriptor) {
+ private boolean checkSpecialCasesRuntimeSupport(final AlgorithmDescriptor descriptor) {
log.trace("Checking runtime support failure for special cases: {}", descriptor.getURI());
try {
// Per Santuario XMLCipher: Some JDKs don't support RSA/ECB/OAEPPadding.
@@ -371,7 +372,7 @@ public class AlgorithmRegistry {
/** {@inheritDoc} */
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/algorithm/AlgorithmSupport.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/algorithm/AlgorithmSupport.java
index d820ed4..edd46f8 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/algorithm/AlgorithmSupport.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/algorithm/AlgorithmSupport.java
@@ -92,7 +92,7 @@ public final class AlgorithmSupport {
* @param algorithm the algorithm descriptor to evaluate
* @return true if the algorithm may be used for key encryption, false otherwise
*/
- public static boolean isDataEncryptionAlgorithm(@Nullable AlgorithmDescriptor algorithm) {
+ public static boolean isDataEncryptionAlgorithm(@Nullable final AlgorithmDescriptor algorithm) {
if (algorithm == null) {
return false;
}
@@ -351,7 +351,7 @@ public final class AlgorithmSupport {
* @throws NoSuchProviderException provider not found
* @throws NoSuchAlgorithmException algorithm not found
*/
- @Nonnull public static KeyPair generateKeyPair(@Nonnull final String algoURI, int keyLength)
+ @Nonnull public static KeyPair generateKeyPair(@Nonnull final String algoURI, final int keyLength)
throws NoSuchAlgorithmException, NoSuchProviderException {
String jceAlgorithmName = getKeyAlgorithm(algoURI);
return KeySupport.generateKeyPair(jceAlgorithmName, keyLength, null);
@@ -381,8 +381,9 @@ public final class AlgorithmSupport {
* @throws NoSuchAlgorithmException algorithm not found
* @throws NoSuchProviderException provider not found
*/
- @Nonnull public static Credential generateKeyPairAndCredential(@Nonnull final String algorithmURI, int keyLength,
- boolean includePrivate) throws NoSuchAlgorithmException, NoSuchProviderException {
+ @Nonnull public static Credential generateKeyPairAndCredential(@Nonnull final String algorithmURI,
+ final int keyLength,
+ final boolean includePrivate) throws NoSuchAlgorithmException, NoSuchProviderException {
KeyPair keyPair = generateKeyPair(algorithmURI, keyLength);
BasicCredential credential = new BasicCredential(keyPair.getPublic());
if (includePrivate) {
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/DecryptionConfigurationCriterion.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/DecryptionConfigurationCriterion.java
index 0889c4e..702063b 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/DecryptionConfigurationCriterion.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/DecryptionConfigurationCriterion.java
@@ -49,7 +49,7 @@ public class DecryptionConfigurationCriterion implements Criterion {
*
* @param configurations list of configuration instances
*/
- public DecryptionConfigurationCriterion(@Nonnull @NonnullElements @NotEmpty
+ public DecryptionConfigurationCriterion(@Nonnull @NonnullElements @NotEmpty final
List<DecryptionConfiguration> configurations) {
Constraint.isNotNull(configurations, "List of configurations cannot be null");
configs = new ArrayList<>(Collections2.filter(configurations, Predicates.notNull()));
@@ -62,7 +62,7 @@ public class DecryptionConfigurationCriterion implements Criterion {
*
* @param configurations varargs array of configuration instances
*/
- public DecryptionConfigurationCriterion(@Nonnull @NonnullElements @NotEmpty
+ public DecryptionConfigurationCriterion(@Nonnull @NonnullElements @NotEmpty final
DecryptionConfiguration... configurations) {
Constraint.isNotNull(configurations, "List of configurations cannot be null");
configs = new ArrayList<>(Collections2.filter(Arrays.asList(configurations), Predicates.notNull()));
@@ -97,7 +97,7 @@ public class DecryptionConfigurationCriterion implements Criterion {
/** {@inheritDoc} */
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/EncryptionConfigurationCriterion.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/EncryptionConfigurationCriterion.java
index 6d323ac..25cba7b 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/EncryptionConfigurationCriterion.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/EncryptionConfigurationCriterion.java
@@ -49,7 +49,7 @@ public class EncryptionConfigurationCriterion implements Criterion {
*
* @param configurations list of configuration instances
*/
- public EncryptionConfigurationCriterion(@Nonnull @NonnullElements @NotEmpty
+ public EncryptionConfigurationCriterion(@Nonnull @NonnullElements @NotEmpty final
List<EncryptionConfiguration> configurations) {
Constraint.isNotNull(configurations, "List of configurations cannot be null");
configs = new ArrayList<>(Collections2.filter(configurations, Predicates.notNull()));
@@ -62,7 +62,7 @@ public class EncryptionConfigurationCriterion implements Criterion {
*
* @param configurations varargs array of configuration instances
*/
- public EncryptionConfigurationCriterion(@Nonnull @NonnullElements @NotEmpty
+ public EncryptionConfigurationCriterion(@Nonnull @NonnullElements @NotEmpty final
EncryptionConfiguration... configurations) {
Constraint.isNotNull(configurations, "List of configurations cannot be null");
configs = new ArrayList<>(Collections2.filter(Arrays.asList(configurations), Predicates.notNull()));
@@ -96,7 +96,7 @@ public class EncryptionConfigurationCriterion implements Criterion {
/** {@inheritDoc} */
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/EncryptionOptionalCriterion.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/EncryptionOptionalCriterion.java
index cd43214..a8aa12d 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/EncryptionOptionalCriterion.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/EncryptionOptionalCriterion.java
@@ -45,7 +45,7 @@ public class EncryptionOptionalCriterion implements Criterion {
*
* @param value the encryptionOptional flag value
*/
- public EncryptionOptionalCriterion(boolean value) {
+ public EncryptionOptionalCriterion(final boolean value) {
encryptionOptional = value;
}
@@ -64,7 +64,7 @@ public class EncryptionOptionalCriterion implements Criterion {
}
/** {@inheritDoc} */
- public boolean equals(Object other) {
+ public boolean equals(final Object other) {
if (this == other) {
return true;
}
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/KeyInfoGenerationProfileCriterion.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/KeyInfoGenerationProfileCriterion.java
index 86f97dc..9bddecc 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/KeyInfoGenerationProfileCriterion.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/KeyInfoGenerationProfileCriterion.java
@@ -70,7 +70,7 @@ public final class KeyInfoGenerationProfileCriterion implements Criterion {
/** {@inheritDoc} */
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/SignatureSigningConfigurationCriterion.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/SignatureSigningConfigurationCriterion.java
index eb55228..afad861 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/SignatureSigningConfigurationCriterion.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/SignatureSigningConfigurationCriterion.java
@@ -49,7 +49,7 @@ public class SignatureSigningConfigurationCriterion implements Criterion {
*
* @param configurations list of configuration instances
*/
- public SignatureSigningConfigurationCriterion(@Nonnull @NonnullElements @NotEmpty
+ public SignatureSigningConfigurationCriterion(@Nonnull @NonnullElements @NotEmpty final
List<SignatureSigningConfiguration> configurations) {
Constraint.isNotNull(configurations, "List of configurations cannot be null");
configs = new ArrayList<>(Collections2.filter(configurations, Predicates.notNull()));
@@ -62,7 +62,7 @@ public class SignatureSigningConfigurationCriterion implements Criterion {
*
* @param configurations varargs array of configuration instances
*/
- public SignatureSigningConfigurationCriterion(@Nonnull @NonnullElements @NotEmpty
+ public SignatureSigningConfigurationCriterion(@Nonnull @NonnullElements @NotEmpty final
SignatureSigningConfiguration... configurations) {
Constraint.isNotNull(configurations, "List of configurations cannot be null");
configs = new ArrayList<>(Collections2.filter(Arrays.asList(configurations), Predicates.notNull()));
@@ -96,7 +96,7 @@ public class SignatureSigningConfigurationCriterion implements Criterion {
/** {@inheritDoc} */
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/SignatureValidationConfigurationCriterion.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/SignatureValidationConfigurationCriterion.java
index ddf704b..8aa7d39 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/SignatureValidationConfigurationCriterion.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/criterion/SignatureValidationConfigurationCriterion.java
@@ -49,7 +49,7 @@ public class SignatureValidationConfigurationCriterion implements Criterion {
*
* @param configurations list of configuration instances
*/
- public SignatureValidationConfigurationCriterion(@Nonnull @NonnullElements @NotEmpty
+ public SignatureValidationConfigurationCriterion(@Nonnull @NonnullElements @NotEmpty final
List<SignatureValidationConfiguration> configurations) {
Constraint.isNotNull(configurations, "List of configurations cannot be null");
configs = new ArrayList<>(Collections2.filter(configurations, Predicates.notNull()));
@@ -62,7 +62,7 @@ public class SignatureValidationConfigurationCriterion implements Criterion {
*
* @param configurations varargs array of configuration instances
*/
- public SignatureValidationConfigurationCriterion(@Nonnull @NonnullElements @NotEmpty
+ public SignatureValidationConfigurationCriterion(@Nonnull @NonnullElements @NotEmpty final
SignatureValidationConfiguration... configurations) {
Constraint.isNotNull(configurations, "List of configurations cannot be null");
configs = new ArrayList<>(Collections2.filter(Arrays.asList(configurations), Predicates.notNull()));
@@ -96,7 +96,7 @@ public class SignatureValidationConfigurationCriterion implements Criterion {
/** {@inheritDoc} */
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/Decrypter.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/Decrypter.java
index edb451c..c5721bf 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/Decrypter.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/Decrypter.java
@@ -232,7 +232,7 @@ public class Decrypter {
*
* @param params decryption parameters to use
*/
- public Decrypter(DecryptionParameters params) {
+ public Decrypter(final DecryptionParameters params) {
this( params.getDataKeyInfoCredentialResolver(),
params.getKEKKeyInfoCredentialResolver(),
params.getEncryptedKeyResolver(),
@@ -311,7 +311,7 @@ public class Decrypter {
*
* @param flag the current value of the flag for this decrypter instance
*/
- public void setRootInNewDocument(boolean flag) {
+ public void setRootInNewDocument(final boolean flag) {
defaultRootInNewDocument = flag;
}
@@ -357,7 +357,7 @@ public class Decrypter {
*
* @param newCriteria the static criteria set to use
*/
- public void setKeyResolverCriteria(CriteriaSet newCriteria) {
+ public void setKeyResolverCriteria(final CriteriaSet newCriteria) {
resolverCriteria = newCriteria;
}
@@ -377,7 +377,7 @@ public class Decrypter {
*
* @param newCriteria the static criteria set to use
*/
- public void setKEKResolverCriteria(CriteriaSet newCriteria) {
+ public void setKEKResolverCriteria(final CriteriaSet newCriteria) {
kekResolverCriteria = newCriteria;
}
@@ -407,7 +407,7 @@ public class Decrypter {
* contained more than one top-level Element, or some non-Element Node type.
*/
@Nonnull public XMLObject decryptData(@Nonnull final EncryptedData encryptedData,
- boolean rootInNewDocument) throws DecryptionException {
+ final boolean rootInNewDocument) throws DecryptionException {
List<XMLObject> xmlObjects = decryptDataToList(encryptedData, rootInNewDocument);
if (xmlObjects.size() != 1) {
@@ -446,7 +446,7 @@ public class Decrypter {
* contained DOM nodes other than type of Element
*/
@Nonnull public List<XMLObject> decryptDataToList(@Nonnull final EncryptedData encryptedData,
- boolean rootInNewDocument) throws DecryptionException {
+ final boolean rootInNewDocument) throws DecryptionException {
List<XMLObject> xmlObjects = new LinkedList<>();
DocumentFragment docFragment = decryptDataToDOM(encryptedData);
@@ -467,7 +467,7 @@ public class Decrypter {
Document newDoc = null;
try {
newDoc = parserPool.newDocument();
- } catch (XMLParserException e) {
+ } catch (final XMLParserException e) {
log.error("There was an error creating a new DOM Document", e);
throw new DecryptionException("Error creating new DOM Document", e);
}
@@ -491,7 +491,7 @@ public class Decrypter {
}
}
xmlObject = unmarshaller.unmarshall(element);
- } catch (UnmarshallingException e) {
+ } catch (final UnmarshallingException e) {
log.error("There was an error during unmarshalling of the decrypted element", e);
throw new DecryptionException("Unmarshalling error during decryption", e);
}
@@ -577,7 +577,7 @@ public class Decrypter {
try {
checkAndMarshall(encryptedData);
- } catch (DecryptionException e) {
+ } catch (final DecryptionException e) {
log.error("Error marshalling EncryptedData for decryption", e);
throw e;
}
@@ -591,7 +591,7 @@ public class Decrypter {
xmlCipher = XMLCipher.getInstance();
}
xmlCipher.init(XMLCipher.DECRYPT_MODE, dataEncKey);
- } catch (XMLEncryptionException e) {
+ } catch (final XMLEncryptionException e) {
log.error("Error initialzing cipher instance on data decryption", e);
throw new DecryptionException("Error initialzing cipher instance on data decryption", e);
}
@@ -599,10 +599,10 @@ public class Decrypter {
byte[] bytes = null;
try {
bytes = xmlCipher.decryptToByteArray(targetElement);
- } catch (XMLEncryptionException e) {
+ } catch (final XMLEncryptionException e) {
log.error("Error decrypting the encrypted data element", e);
throw new DecryptionException("Error decrypting the encrypted data element", e);
- } catch (Exception e) {
+ } catch (final Exception e) {
// Catch anything else, esp. unchecked RuntimeException, and convert to our checked type.
// BouncyCastle in particular is known to throw unchecked exceptions for what we would
// consider "routine" failures.
@@ -641,13 +641,13 @@ public class Decrypter {
for (Credential cred : kekResolver.resolve(criteriaSet)) {
try {
return decryptKey(encryptedKey, algorithm, CredentialSupport.extractDecryptionKey(cred));
- } catch (DecryptionException e) {
+ } catch (final DecryptionException e) {
String msg = "Attempt to decrypt EncryptedKey using credential from KEK KeyInfo resolver failed: ";
log.debug(msg, e);
continue;
}
}
- } catch (ResolverException e) {
+ } catch (final ResolverException e) {
log.error("Error resolving credentials from EncryptedKey KeyInfo", e);
}
@@ -679,7 +679,7 @@ public class Decrypter {
try {
checkAndMarshall(encryptedKey);
- } catch (DecryptionException e) {
+ } catch (final DecryptionException e) {
log.error("Error marshalling EncryptedKey for decryption", e);
throw e;
}
@@ -693,7 +693,7 @@ public class Decrypter {
xmlCipher = XMLCipher.getInstance();
}
xmlCipher.init(XMLCipher.UNWRAP_MODE, kek);
- } catch (XMLEncryptionException e) {
+ } catch (final XMLEncryptionException e) {
log.error("Error initialzing cipher instance on key decryption", e);
throw new DecryptionException("Error initialzing cipher instance on key decryption", e);
}
@@ -702,7 +702,7 @@ public class Decrypter {
try {
Element targetElement = encryptedKey.getDOM();
encKey = xmlCipher.loadEncryptedKey(targetElement.getOwnerDocument(), targetElement);
- } catch (XMLEncryptionException e) {
+ } catch (final XMLEncryptionException e) {
log.error("Error when loading library native encrypted key representation", e);
throw new DecryptionException("Error when loading library native encrypted key representation", e);
}
@@ -713,10 +713,10 @@ public class Decrypter {
throw new DecryptionException("Key could not be decrypted");
}
return key;
- } catch (XMLEncryptionException e) {
+ } catch (final XMLEncryptionException e) {
log.error("Error decrypting encrypted key", e);
throw new DecryptionException("Error decrypting encrypted key", e);
- } catch (Exception e) {
+ } catch (final Exception e) {
// Catch anything else, esp. unchecked RuntimeException, and convert to our checked type.
// BouncyCastle in particular is known to throw unchecked exceptions for what we would
// consider "routine" failures.
@@ -752,13 +752,13 @@ public class Decrypter {
for (Credential cred : resolver.resolve(criteriaSet)) {
try {
return decryptDataToDOM(encryptedData, CredentialSupport.extractDecryptionKey(cred));
- } catch (DecryptionException e) {
+ } catch (final DecryptionException e) {
String msg = "Decryption attempt using credential from standard KeyInfo resolver failed: ";
log.debug(msg, e);
continue;
}
}
- } catch (ResolverException e) {
+ } catch (final ResolverException e) {
log.error("Error resolving credentials from EncryptedData KeyInfo", e);
}
}
@@ -780,7 +780,7 @@ public class Decrypter {
try {
Key decryptedKey = decryptKey(encryptedKey, algorithm);
return decryptDataToDOM(encryptedData, decryptedKey);
- } catch (DecryptionException e) {
+ } catch (final DecryptionException e) {
String msg = "Attempt to decrypt EncryptedData using key extracted from EncryptedKey failed: ";
log.debug(msg, e);
continue;
@@ -808,7 +808,7 @@ public class Decrypter {
Document newDocument = null;
try {
newDocument = parserPool.parse(input);
- } catch (XMLParserException e) {
+ } catch (final XMLParserException e) {
log.error("Error parsing decrypted input stream", e);
throw new DecryptionException("Error parsing input stream", e);
}
@@ -961,7 +961,7 @@ public class Decrypter {
}
try {
targetElement = marshaller.marshall(xmlObject);
- } catch (MarshallingException e) {
+ } catch (final MarshallingException e) {
log.error("Error marshalling target XMLObject", e);
throw new DecryptionException("Error marshalling target XMLObject", e);
}
@@ -997,7 +997,7 @@ public class Decrypter {
try {
pp.initialize();
return pp;
- } catch (ComponentInitializationException e) {
+ } catch (final ComponentInitializationException e) {
throw new XMLRuntimeException("Problem initializing Decrypter internal ParserPool", e);
}
}
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/Encrypter.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/Encrypter.java
index cb955b8..09e136f 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/Encrypter.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/Encrypter.java
@@ -303,7 +303,7 @@ public class Encrypter {
.getClass().getName());
try {
encryptedKey.setKeyInfo(generator.generate(kekParams.getEncryptionCredential()));
- } catch (SecurityException e) {
+ } catch (final SecurityException e) {
log.error("Error during EncryptedKey KeyInfo generation", e);
throw new EncryptionException("Error during EncryptedKey KeyInfo generation", e);
}
@@ -347,7 +347,7 @@ public class Encrypter {
XMLCipher xmlCipher;
try {
xmlCipher = buildXMLCipher(encryptionKey, encryptionAlgorithmURI, rsaOAEPParams);
- } catch (XMLEncryptionException e) {
+ } catch (final XMLEncryptionException e) {
log.error("Error initializing cipher instance on key encryption", e);
throw new EncryptionException("Error initializing cipher instance on key encryption", e);
}
@@ -363,7 +363,7 @@ public class Encrypter {
}
postProcessApacheEncryptedKey(apacheEncryptedKey, targetKey, encryptionKey, encryptionAlgorithmURI,
containingDocument);
- } catch (XMLEncryptionException e) {
+ } catch (final XMLEncryptionException e) {
log.error("Error encrypting element on key encryption", e);
throw new EncryptionException("Error encrypting element on key encryption", e);
}
@@ -371,7 +371,7 @@ public class Encrypter {
try {
Element encKeyElement = xmlCipher.martial(containingDocument, apacheEncryptedKey);
return (EncryptedKey) encryptedKeyUnmarshaller.unmarshall(encKeyElement);
- } catch (UnmarshallingException e) {
+ } catch (final UnmarshallingException e) {
log.error("Error unmarshalling EncryptedKey element", e);
throw new EncryptionException("Error unmarshalling EncryptedKey element");
}
@@ -451,7 +451,7 @@ public class Encrypter {
} else {
return null;
}
- } catch (RuntimeException e) {
+ } catch (final RuntimeException e) {
throw new EncryptionException(String.format("Error decoding OAEPParams data '%s'", base64Params), e);
}
}
@@ -504,8 +504,8 @@ public class Encrypter {
* @throws EncryptionException exception thrown on encryption errors
*/
@Nonnull protected EncryptedData encryptElement(@Nonnull final XMLObject xmlObject,
- @Nonnull final Key encryptionKey, @Nonnull final String encryptionAlgorithmURI, boolean encryptContentMode)
- throws EncryptionException {
+ @Nonnull final Key encryptionKey, @Nonnull final String encryptionAlgorithmURI,
+ final boolean encryptContentMode) throws EncryptionException {
if (xmlObject == null) {
log.error("XMLObject for encryption was null");
@@ -530,7 +530,7 @@ public class Encrypter {
xmlCipher = XMLCipher.getInstance(encryptionAlgorithmURI);
}
xmlCipher.init(XMLCipher.ENCRYPT_MODE, encryptionKey);
- } catch (XMLEncryptionException e) {
+ } catch (final XMLEncryptionException e) {
log.error("Error initializing cipher instance on XMLObject encryption", e);
throw new EncryptionException("Error initializing cipher instance", e);
}
@@ -538,7 +538,7 @@ public class Encrypter {
org.apache.xml.security.encryption.EncryptedData apacheEncryptedData;
try {
apacheEncryptedData = xmlCipher.encryptData(ownerDocument, targetElement, encryptContentMode);
- } catch (Exception e) {
+ } catch (final Exception e) {
log.error("Error encrypting XMLObject", e);
throw new EncryptionException("Error encrypting XMLObject", e);
}
@@ -546,7 +546,7 @@ public class Encrypter {
try {
Element encDataElement = xmlCipher.martial(ownerDocument, apacheEncryptedData);
return (EncryptedData) encryptedDataUnmarshaller.unmarshall(encDataElement);
- } catch (UnmarshallingException e) {
+ } catch (final UnmarshallingException e) {
log.error("Error unmarshalling EncryptedData element", e);
throw new EncryptionException("Error unmarshalling EncryptedData element", e);
}
@@ -566,7 +566,7 @@ public class Encrypter {
*/
@Nonnull private EncryptedData encryptElement(@Nonnull final XMLObject xmlObject,
@Nonnull final DataEncryptionParameters encParams,
- @Nonnull final List<KeyEncryptionParameters> kekParamsList, boolean encryptContentMode)
+ @Nonnull final List<KeyEncryptionParameters> kekParamsList, final boolean encryptContentMode)
throws EncryptionException {
checkParams(encParams, kekParamsList);
@@ -587,7 +587,7 @@ public class Encrypter {
.getClass().getName());
try {
encryptedData.setKeyInfo(generator.generate(encParams.getEncryptionCredential()));
- } catch (SecurityException e) {
+ } catch (final SecurityException e) {
log.error("Error during EncryptedData KeyInfo generation", e);
throw new EncryptionException("Error during EncryptedData KeyInfo generation", e);
}
@@ -621,7 +621,7 @@ public class Encrypter {
throw new MarshallingException("No marshaller available for " + xmlObject.getElementQName());
}
targetElement = marshaller.marshall(xmlObject);
- } catch (MarshallingException e) {
+ } catch (final MarshallingException e) {
log.error("Error marshalling target XMLObject", e);
throw new EncryptionException("Error marshalling target XMLObject", e);
}
@@ -653,7 +653,7 @@ public class Encrypter {
*
* @throws EncryptionException thrown if any parameters are missing or have invalid values
*/
- protected void checkParams(@Nullable final KeyEncryptionParameters kekParams, boolean allowEmpty)
+ protected void checkParams(@Nullable final KeyEncryptionParameters kekParams, final boolean allowEmpty)
throws EncryptionException {
if (kekParams == null) {
if (allowEmpty) {
@@ -687,7 +687,7 @@ public class Encrypter {
*
* @throws EncryptionException thrown if any parameters are missing or have invalid values
*/
- protected void checkParams(@Nullable final List<KeyEncryptionParameters> kekParamsList, boolean allowEmpty)
+ protected void checkParams(@Nullable final List<KeyEncryptionParameters> kekParamsList, final boolean allowEmpty)
throws EncryptionException {
if (kekParamsList == null || kekParamsList.isEmpty()) {
if (allowEmpty) {
@@ -736,11 +736,11 @@ public class Encrypter {
try {
log.debug("Generating random symmetric data encryption key from algorithm URI: {}", encryptionAlgorithmURI);
return AlgorithmSupport.generateSymmetricKey(encryptionAlgorithmURI);
- } catch (NoSuchAlgorithmException e) {
+ } catch (final NoSuchAlgorithmException e) {
log.error("Could not generate encryption key, algorithm URI was invalid: " + encryptionAlgorithmURI);
throw new EncryptionException("Could not generate encryption key, algorithm URI was invalid: "
+ encryptionAlgorithmURI);
- } catch (KeyException e) {
+ } catch (final KeyException e) {
log.error("Could not generate encryption key from algorithm URI: " + encryptionAlgorithmURI);
throw new EncryptionException("Could not generate encryption key from algorithm URI: "
+ encryptionAlgorithmURI);
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/KeyEncryptionParameters.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/KeyEncryptionParameters.java
index 04bc9d6..c3dbb76 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/KeyEncryptionParameters.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/KeyEncryptionParameters.java
@@ -53,7 +53,7 @@ public class KeyEncryptionParameters extends DataEncryptionParameters {
* @param params the encryption parameters instance
* @param recipientId the recipient of the key
*/
- public KeyEncryptionParameters(EncryptionParameters params, String recipientId) {
+ public KeyEncryptionParameters(final EncryptionParameters params, final String recipientId) {
this();
Constraint.isNotNull(params, "EncryptionParameters instance was null");
setEncryptionCredential(params.getKeyTransportEncryptionCredential());
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/RSAOAEPParameters.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/RSAOAEPParameters.java
index 6ff473e..cd80da3 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/RSAOAEPParameters.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/RSAOAEPParameters.java
@@ -43,7 +43,7 @@ public class RSAOAEPParameters {
* @param mgf the mask generation function (MGF)
* @param params the OAEPParms (base64-encoded)
*/
- public RSAOAEPParameters(String digest, String mgf, String params) {
+ public RSAOAEPParameters(final String digest, final String mgf, final String params) {
setDigestMethod(digest);
setMaskGenerationFunction(mgf);
setOAEPparams(params);
@@ -81,7 +81,7 @@ public class RSAOAEPParameters {
*
* @param value the new digest method URI
*/
- public void setDigestMethod(String value) {
+ public void setDigestMethod(final String value) {
digestMethod = StringSupport.trimOrNull(value);
}
@@ -99,7 +99,7 @@ public class RSAOAEPParameters {
*
* @param value the new MGF algorithm URI
*/
- public void setMaskGenerationFunction(String value) {
+ public void setMaskGenerationFunction(final String value) {
maskGenerationFunction = StringSupport.trimOrNull(value);
}
@@ -117,7 +117,7 @@ public class RSAOAEPParameters {
*
* @param value the new base64-encoded OAEPParams value
*/
- public void setOAEPparams(String value) {
+ public void setOAEPparams(final String value) {
oaepParams = StringSupport.trimOrNull(value);
}
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/SimpleKeyInfoReferenceEncryptedKeyResolver.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/SimpleKeyInfoReferenceEncryptedKeyResolver.java
index 5ad45c7..409ef8d 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/SimpleKeyInfoReferenceEncryptedKeyResolver.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/SimpleKeyInfoReferenceEncryptedKeyResolver.java
@@ -91,7 +91,7 @@ public class SimpleKeyInfoReferenceEncryptedKeyResolver extends AbstractEncrypte
*
* @param limit limit to set
*/
- public void setDepthLimit(int limit) {
+ public void setDepthLimit(final int limit) {
depthLimit = Math.max(1, limit);
}
@@ -110,7 +110,7 @@ public class SimpleKeyInfoReferenceEncryptedKeyResolver extends AbstractEncrypte
* @param limit depth of references to follow
* @return encrypted keys
*/
- @Nonnull protected Iterable<EncryptedKey> resolveKeyInfo(@Nullable final KeyInfo keyInfo, int limit) {
+ @Nonnull protected Iterable<EncryptedKey> resolveKeyInfo(@Nullable final KeyInfo keyInfo, final int limit) {
List<EncryptedKey> resolvedEncKeys = new ArrayList<>();
if (keyInfo == null) {
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/keyinfo/KeyInfoCriterion.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/keyinfo/KeyInfoCriterion.java
index 6899277..69c66cd 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/keyinfo/KeyInfoCriterion.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/keyinfo/KeyInfoCriterion.java
@@ -81,7 +81,7 @@ public final class KeyInfoCriterion implements Criterion {
}
/** {@inheritDoc} */
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/keyinfo/KeyInfoSupport.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/keyinfo/KeyInfoSupport.java
index f463935..85c29b2 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/keyinfo/KeyInfoSupport.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/keyinfo/KeyInfoSupport.java
@@ -280,7 +280,7 @@ public class KeyInfoSupport {
try {
return X509Support.decodeCRL(xmlCRL.getValue());
- } catch (CertificateException e) {
+ } catch (final CertificateException e) {
throw new CRLException("Certificate error attempting to decode CRL", e);
}
}
@@ -345,7 +345,8 @@ public class KeyInfoSupport {
* @throws CertificateEncodingException thrown when there is an error converting the Java certificate representation
* to the XMLObject representation
*/
- @Nonnull public static org.opensaml.xmlsec.signature.X509Certificate buildX509Certificate(X509Certificate cert)
+ @Nonnull public static org.opensaml.xmlsec.signature.X509Certificate
+ buildX509Certificate(final X509Certificate cert)
throws CertificateEncodingException {
Constraint.isNotNull(cert, "X.509 certificate cannot be null");
@@ -370,7 +371,7 @@ public class KeyInfoSupport {
* @throws CRLException thrown when there is an error converting the Java CRL representation to the XMLObject
* representation
*/
- @Nonnull public static org.opensaml.xmlsec.signature.X509CRL buildX509CRL(X509CRL crl) throws CRLException {
+ @Nonnull public static org.opensaml.xmlsec.signature.X509CRL buildX509CRL(final X509CRL crl) throws CRLException {
Constraint.isNotNull(crl, "X.509 CRL cannot be null");
XMLObjectBuilder<org.opensaml.xmlsec.signature.X509CRL> xmlCRLBuilder =
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/keyinfo/NamedKeyInfoGeneratorManager.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/keyinfo/NamedKeyInfoGeneratorManager.java
index cf2d8b4..8c2a06f 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/keyinfo/NamedKeyInfoGeneratorManager.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/keyinfo/NamedKeyInfoGeneratorManager.java
@@ -62,7 +62,7 @@ public class NamedKeyInfoGeneratorManager {
*
* @param newValue the new option value
*/
- public void setUseDefaultManager(boolean newValue) {
+ public void setUseDefaultManager(final boolean newValue) {
useDefaultManager = newValue;
}
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/signature/support/SignatureSupport.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/signature/support/SignatureSupport.java
index 31313af..cf8dd27 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/signature/support/SignatureSupport.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/signature/support/SignatureSupport.java
@@ -152,7 +152,7 @@ public final class SignatureSupport {
try {
KeyInfo keyInfo = kiGenerator.generate(signature.getSigningCredential());
signature.setKeyInfo(keyInfo);
- } catch (SecurityException e) {
+ } catch (final SecurityException e) {
log.error("Error generating KeyInfo from credential", e);
throw e;
}
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/signature/support/SignatureValidationParametersCriterion.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/signature/support/SignatureValidationParametersCriterion.java
index 18db51e..274b6ca 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/signature/support/SignatureValidationParametersCriterion.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/signature/support/SignatureValidationParametersCriterion.java
@@ -72,7 +72,7 @@ public class SignatureValidationParametersCriterion implements Criterion {
/** {@inheritDoc} */
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/signature/support/URIContentReference.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/signature/support/URIContentReference.java
index abdd6ba..0cfefe9 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/signature/support/URIContentReference.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/signature/support/URIContentReference.java
@@ -95,9 +95,9 @@ public class URIContentReference implements ConfigurableContentReference {
dsigTransforms.addTransform(transform);
}
signature.addDocument(referenceID, dsigTransforms, digestAlgorithm);
- } catch (TransformationException e) {
+ } catch (final TransformationException e) {
log.error("Error while creating transforms", e);
- } catch (XMLSignatureException e) {
+ } catch (final XMLSignatureException e) {
log.error("Error while adding content reference", e);
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list