[java-support] 06/10: JPAR-85 - Add missing final parameter to catch clauses.
Tom Zeller
tzeller at dragonacea.biz
Mon May 16 21:19:41 EDT 2016
This is an automated email from the git hooks/post-receive script.
tzeller pushed a commit to branch JPAR-85
in repository java-support.
commit c99d7111b9ae13079ed8a32a745139d926765630
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Mon May 16 20:03:27 2016 -0500
JPAR-85 - Add missing final parameter to catch clauses.
---
.../utilities/java/support/codec/StringDigester.java | 2 +-
.../httpclient/FileCachingHttpClientBuilder.java | 4 ++--
.../java/support/httpclient/HttpClientSupport.java | 4 ++--
.../java/support/httpclient/TLSSocketFactory.java | 2 +-
.../support/httpclient/TLSSocketFactoryBuilder.java | 6 +++---
.../utilities/java/support/net/BasicURLComparator.java | 4 ++--
.../shibboleth/utilities/java/support/net/IPRange.java | 6 +++---
.../utilities/java/support/net/URISupport.java | 18 +++++++++---------
.../utilities/java/support/security/DataSealer.java | 6 +++---
.../security/RandomIdentifierGenerationStrategy.java | 6 +++---
.../utilities/java/support/velocity/Template.java | 8 ++++----
.../utilities/java/support/xml/AttributeSupport.java | 2 +-
.../utilities/java/support/xml/BasicParserPool.java | 12 ++++++------
.../utilities/java/support/xml/ClasspathResolver.java | 2 +-
.../utilities/java/support/xml/DOMTypeSupport.java | 2 +-
.../utilities/java/support/xml/SchemaBuilder.java | 2 +-
.../utilities/java/support/xml/SerializeSupport.java | 4 ++--
17 files changed, 45 insertions(+), 45 deletions(-)
diff --git a/src/main/java/net/shibboleth/utilities/java/support/codec/StringDigester.java b/src/main/java/net/shibboleth/utilities/java/support/codec/StringDigester.java
index 27f56c7..88b29bf 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/codec/StringDigester.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/codec/StringDigester.java
@@ -159,7 +159,7 @@ public class StringDigester implements Function<String, String> {
final MessageDigest digest;
try {
digest = MessageDigest.getInstance(digestAlgorithm);
- } catch (NoSuchAlgorithmException e) {
+ } catch (final NoSuchAlgorithmException e) {
// This shouldn't happen, because we tested it earlier in the constructor, so just log and return null.
log.error("Digest algorithm '{}' was invalid", digestAlgorithm, e);
return null;
diff --git a/src/main/java/net/shibboleth/utilities/java/support/httpclient/FileCachingHttpClientBuilder.java b/src/main/java/net/shibboleth/utilities/java/support/httpclient/FileCachingHttpClientBuilder.java
index f1f021c..86b8c1f 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/httpclient/FileCachingHttpClientBuilder.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/httpclient/FileCachingHttpClientBuilder.java
@@ -362,7 +362,7 @@ public class FileCachingHttpClientBuilder extends HttpClientBuilder {
try {
log.debug("Executing ManagedHttpCacheStorage shutdown()");
storage.shutdown();
- } catch (Throwable t) {
+ } catch (final Throwable t) {
log.warn("Error invoking ManagedHttpCacheStorage shutdown()", t);
}
storage = null;
@@ -399,7 +399,7 @@ public class FileCachingHttpClientBuilder extends HttpClientBuilder {
try {
log.debug("Executing ManagedHttpCacheStorage cleanResources()");
storage.cleanResources();
- } catch (Throwable t) {
+ } catch (final Throwable t) {
log.warn("Error invoking ManagedHttpCacheStorage cleanResources()", t);
}
}
diff --git a/src/main/java/net/shibboleth/utilities/java/support/httpclient/HttpClientSupport.java b/src/main/java/net/shibboleth/utilities/java/support/httpclient/HttpClientSupport.java
index 0fa2067..801a53f 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/httpclient/HttpClientSupport.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/httpclient/HttpClientSupport.java
@@ -99,9 +99,9 @@ public final class HttpClientSupport {
SSLContext sslcontext = SSLContext.getInstance("TLS");
sslcontext.init(null, new TrustManager[] {noTrustManager}, null);
return new SSLConnectionSocketFactory(sslcontext, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
- } catch (NoSuchAlgorithmException e) {
+ } catch (final NoSuchAlgorithmException e) {
throw new RuntimeException("TLS SSLContext type is required to be supported by the JVM but is not", e);
- } catch (KeyManagementException e) {
+ } catch (final KeyManagementException e) {
throw new RuntimeException("Some how the trust everything trust manager didn't trust everything", e);
}
diff --git a/src/main/java/net/shibboleth/utilities/java/support/httpclient/TLSSocketFactory.java b/src/main/java/net/shibboleth/utilities/java/support/httpclient/TLSSocketFactory.java
index e26abcf..9ddc9fe 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/httpclient/TLSSocketFactory.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/httpclient/TLSSocketFactory.java
@@ -352,7 +352,7 @@ public class TLSSocketFactory implements LayeredConnectionSocketFactory {
log.trace("Peer certificates: {}", (Object)session.getPeerCertificates());
log.trace("Local principal: {}", session.getLocalPrincipal());
log.trace("Local certificates: {}", (Object)session.getLocalCertificates());
- } catch (SSLPeerUnverifiedException e) {
+ } catch (final SSLPeerUnverifiedException e) {
log.warn("SSL exception enumerating peer certificates", e);
}
}
diff --git a/src/main/java/net/shibboleth/utilities/java/support/httpclient/TLSSocketFactoryBuilder.java b/src/main/java/net/shibboleth/utilities/java/support/httpclient/TLSSocketFactoryBuilder.java
index ef42a48..ba82c84 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/httpclient/TLSSocketFactoryBuilder.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/httpclient/TLSSocketFactoryBuilder.java
@@ -325,11 +325,11 @@ public class TLSSocketFactoryBuilder {
return sslcontext;
- } catch (NoSuchAlgorithmException e) {
+ } catch (final NoSuchAlgorithmException e) {
throw new RuntimeException("Problem obtaining SSLContext, unsupported protocol: " + sslContextProtocol, e);
- } catch (NoSuchProviderException e) {
+ } catch (final NoSuchProviderException e) {
throw new RuntimeException("Problem obtaining SSLContext, invalid provider: " + sslContextProvider, e);
- } catch (KeyManagementException e) {
+ } catch (final KeyManagementException e) {
throw new RuntimeException("Key Problem initializing SSLContext", e);
}
diff --git a/src/main/java/net/shibboleth/utilities/java/support/net/BasicURLComparator.java b/src/main/java/net/shibboleth/utilities/java/support/net/BasicURLComparator.java
index e78c927..6c97115 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/net/BasicURLComparator.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/net/BasicURLComparator.java
@@ -61,14 +61,14 @@ public class BasicURLComparator implements URIComparator {
try {
uri1Canon = SimpleURLCanonicalizer.canonicalize(uri1);
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
throw new URIException("URI was invalid: " + uri1Canon);
}
String uri2Canon = null;
try {
uri2Canon = SimpleURLCanonicalizer.canonicalize(uri2);
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
throw new URIException("URI was invalid: " + uri2Canon);
}
diff --git a/src/main/java/net/shibboleth/utilities/java/support/net/IPRange.java b/src/main/java/net/shibboleth/utilities/java/support/net/IPRange.java
index 4d54ef5..0849507 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/net/IPRange.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/net/IPRange.java
@@ -181,9 +181,9 @@ public class IPRange {
InetAddress address = InetAddress.getByName(blockParts[0]);
int maskSize = Integer.parseInt(blockParts[1]);
return new IPRange(address, maskSize);
- } catch (UnknownHostException e) {
+ } catch (final UnknownHostException e) {
throw new IllegalArgumentException("Invalid IP address");
- } catch (NumberFormatException e) {
+ } catch (final NumberFormatException e) {
throw new IllegalArgumentException("Invalid netmask size");
}
}
@@ -272,7 +272,7 @@ public class IPRange {
}
try {
return InetAddress.getByAddress(toByteArray(bits));
- } catch (UnknownHostException e) {
+ } catch (final UnknownHostException e) {
// only supposed to happen if the address length is invalid
return null;
}
diff --git a/src/main/java/net/shibboleth/utilities/java/support/net/URISupport.java b/src/main/java/net/shibboleth/utilities/java/support/net/URISupport.java
index 759cb82..cac8672 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/net/URISupport.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/net/URISupport.java
@@ -53,7 +53,7 @@ public final class URISupport {
try {
return new URI(prototype.getScheme(), prototype.getUserInfo(), prototype.getHost(), prototype.getPort(),
prototype.getPath(), prototype.getQuery(), trimOrNullFragment(fragment));
- } catch (URISyntaxException e) {
+ } catch (final URISyntaxException e) {
throw new IllegalArgumentException("Illegal fragment text", e);
}
}
@@ -70,7 +70,7 @@ public final class URISupport {
try {
return new URI(prototype.getScheme(), prototype.getUserInfo(), StringSupport.trimOrNull(host),
prototype.getPort(), prototype.getPath(), prototype.getQuery(), prototype.getFragment());
- } catch (URISyntaxException e) {
+ } catch (final URISyntaxException e) {
throw new IllegalArgumentException("Illegal host", e);
}
}
@@ -87,7 +87,7 @@ public final class URISupport {
try {
return new URI(prototype.getScheme(), prototype.getUserInfo(), prototype.getHost(), prototype.getPort(),
trimOrNullPath(path), prototype.getQuery(), prototype.getFragment());
- } catch (URISyntaxException e) {
+ } catch (final URISyntaxException e) {
throw new IllegalArgumentException("Illegal path", e);
}
}
@@ -104,7 +104,7 @@ public final class URISupport {
try {
return new URI(prototype.getScheme(), prototype.getUserInfo(), prototype.getHost(), port,
prototype.getPath(), prototype.getQuery(), prototype.getFragment());
- } catch (URISyntaxException e) {
+ } catch (final URISyntaxException e) {
throw new IllegalArgumentException("Illegal port", e);
}
}
@@ -129,7 +129,7 @@ public final class URISupport {
try {
return new URI(prototype.getScheme(), prototype.getUserInfo(), prototype.getHost(), prototype.getPort(),
prototype.getPath(), trimOrNullQuery(query), prototype.getFragment());
- } catch (URISyntaxException e) {
+ } catch (final URISyntaxException e) {
throw new IllegalArgumentException("Illegal query", e);
}
}
@@ -154,7 +154,7 @@ public final class URISupport {
try {
return new URI(prototype.getScheme(), prototype.getUserInfo(), prototype.getHost(), prototype.getPort(),
prototype.getPath(), buildQuery(parameters), prototype.getFragment());
- } catch (URISyntaxException e) {
+ } catch (final URISyntaxException e) {
throw new IllegalArgumentException("Illegal query", e);
}
}
@@ -171,7 +171,7 @@ public final class URISupport {
try {
return new URI(StringSupport.trimOrNull(scheme), prototype.getUserInfo(), prototype.getHost(),
prototype.getPort(), prototype.getPath(), prototype.getQuery(), prototype.getFragment());
- } catch (URISyntaxException e) {
+ } catch (final URISyntaxException e) {
throw new IllegalArgumentException("Illegal scheme", e);
}
}
@@ -375,7 +375,7 @@ public final class URISupport {
try {
return URLDecoder.decode(value, "UTF-8");
- } catch (UnsupportedEncodingException e) {
+ } catch (final UnsupportedEncodingException e) {
// UTF-8 encoding is required to be supported by all JVMs
return null;
}
@@ -394,7 +394,7 @@ public final class URISupport {
try {
return URLEncoder.encode(value, "UTF-8");
- } catch (UnsupportedEncodingException e) {
+ } catch (final UnsupportedEncodingException e) {
// UTF-8 encoding is required to be supported by all JVMs
return null;
}
diff --git a/src/main/java/net/shibboleth/utilities/java/support/security/DataSealer.java b/src/main/java/net/shibboleth/utilities/java/support/security/DataSealer.java
index 658664f..ecbf6f3 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/security/DataSealer.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/security/DataSealer.java
@@ -97,7 +97,7 @@ public class DataSealer extends AbstractInitializableComponent {
try {
try {
Constraint.isNotNull(keyStrategy, "Keystore type cannot be null");
- } catch (ConstraintViolationException e) {
+ } catch (final ConstraintViolationException e) {
throw new ComponentInitializationException(e);
}
@@ -234,7 +234,7 @@ public class DataSealer extends AbstractInitializableComponent {
log.trace("Unwrapped data verified");
return accumulator.toString();
- } catch (IOException e) {
+ } catch (final IOException e) {
log.error(e.getMessage());
throw new DataSealerException("Caught IOException unwrapping data", e);
}
@@ -347,7 +347,7 @@ public class DataSealer extends AbstractInitializableComponent {
cipher.doFinal(plaintext, outputLen);
decrypted = Strings.fromUTF8ByteArray(plaintext);
- } catch (IllegalStateException | InvalidCipherTextException e) {
+ } catch (final IllegalStateException | InvalidCipherTextException e) {
log.error("Round trip encryption/decryption test unsuccessful", e);
throw new DataSealerException("Round trip encryption/decryption test unsuccessful", e);
}
diff --git a/src/main/java/net/shibboleth/utilities/java/support/security/RandomIdentifierGenerationStrategy.java b/src/main/java/net/shibboleth/utilities/java/support/security/RandomIdentifierGenerationStrategy.java
index a555b58..0dc46c6 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/security/RandomIdentifierGenerationStrategy.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/security/RandomIdentifierGenerationStrategy.java
@@ -54,7 +54,7 @@ public class RandomIdentifierGenerationStrategy implements IdentifierGenerationS
random = SecureRandom.getInstance("SHA1PRNG");
sizeOfIdentifier = 16;
encoder = new Hex();
- } catch (NoSuchAlgorithmException e) {
+ } catch (final NoSuchAlgorithmException e) {
throw new RuntimeException("SHA1PRNG is required to be supported by the JVM but is not", e);
}
}
@@ -72,7 +72,7 @@ public class RandomIdentifierGenerationStrategy implements IdentifierGenerationS
(int) Constraint.isGreaterThan(0, identifierSize,
"Number of bytes in the identifier must be greater than 0");
encoder = new Hex();
- } catch (NoSuchAlgorithmException e) {
+ } catch (final NoSuchAlgorithmException e) {
throw new RuntimeException("SHA1PRNG is required to be supported by the JVM but is not", e);
}
}
@@ -108,7 +108,7 @@ public class RandomIdentifierGenerationStrategy implements IdentifierGenerationS
} else {
return StringUtils.newStringUsAscii(encoder.encode(buf));
}
- } catch (EncoderException e) {
+ } catch (final EncoderException e) {
throw new RuntimeException(e);
}
}
diff --git a/src/main/java/net/shibboleth/utilities/java/support/velocity/Template.java b/src/main/java/net/shibboleth/utilities/java/support/velocity/Template.java
index 7930b6f..285bd9e 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/velocity/Template.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/velocity/Template.java
@@ -146,7 +146,7 @@ public final class Template {
try {
engine.getTemplate(templateName);
- } catch (VelocityException e) {
+ } catch (final VelocityException e) {
throw new VelocityException("The following template is not valid:\n" + trimmedTemplate, e);
}
@@ -193,7 +193,7 @@ public final class Template {
try {
engine.getTemplate(trimmedName);
- } catch (VelocityException e) {
+ } catch (final VelocityException e) {
throw new VelocityException("Template '" + trimmedName + "' is not a valid template", e);
}
@@ -231,10 +231,10 @@ public final class Template {
public void merge(final Context templateContext, final Writer output) {
try {
engine.mergeTemplate(templateName, templateEncoding, templateContext, output);
- } catch (ResourceNotFoundException e) {
+ } catch (final ResourceNotFoundException e) {
throw new VelocityException("Velocity template " + templateName
+ " has been removed since this object was constructed");
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new VelocityException("Velocity template " + templateName + " threw an exception", e);
}
}
diff --git a/src/main/java/net/shibboleth/utilities/java/support/xml/AttributeSupport.java b/src/main/java/net/shibboleth/utilities/java/support/xml/AttributeSupport.java
index d811072..eecdf5a 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/xml/AttributeSupport.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/xml/AttributeSupport.java
@@ -474,7 +474,7 @@ public final class AttributeSupport {
}
try {
return XMLSpace.parseValue(value);
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// No match to the type
return null;
}
diff --git a/src/main/java/net/shibboleth/utilities/java/support/xml/BasicParserPool.java b/src/main/java/net/shibboleth/utilities/java/support/xml/BasicParserPool.java
index 155a6e7..068b0cf 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/xml/BasicParserPool.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/xml/BasicParserPool.java
@@ -244,9 +244,9 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
throw new XMLParserException("DocumentBuilder parsed a null Document");
}
return document;
- } catch (SAXException e) {
+ } catch (final SAXException e) {
throw new XMLParserException("Unable to parse inputstream, it contained invalid XML", e);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new XMLParserException("Unable to read data from input stream", e);
} finally {
returnBuilder(builder);
@@ -267,9 +267,9 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
throw new XMLParserException("DocumentBuilder parsed a null Document");
}
return document;
- } catch (SAXException e) {
+ } catch (final SAXException e) {
throw new XMLParserException("Invalid XML", e);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new XMLParserException("Unable to read XML from input stream", e);
} finally {
returnBuilder(builder);
@@ -570,7 +570,7 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
final DocumentBuilder builder = builderFactory.newDocumentBuilder();
return builder;
- } catch (ParserConfigurationException e) {
+ } catch (final ParserConfigurationException e) {
log.debug("Unable to create new document builder", e);
throw new XMLParserException("Unable to create new document builder", e);
}
@@ -625,7 +625,7 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
builderFactory = newFactory;
- } catch (ParserConfigurationException e) {
+ } catch (final ParserConfigurationException e) {
throw new ComponentInitializationException("Unable to configure builder factory", e);
}
}
diff --git a/src/main/java/net/shibboleth/utilities/java/support/xml/ClasspathResolver.java b/src/main/java/net/shibboleth/utilities/java/support/xml/ClasspathResolver.java
index 87bc775..9aac901 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/xml/ClasspathResolver.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/xml/ClasspathResolver.java
@@ -175,7 +175,7 @@ public class ClasspathResolver implements EntityResolver, LSResourceResolver {
byte[] input = new byte[buffInput.available()];
buffInput.read(input);
return new String(input);
- } catch (IOException e) {
+ } catch (final IOException e) {
return null;
}
}
diff --git a/src/main/java/net/shibboleth/utilities/java/support/xml/DOMTypeSupport.java b/src/main/java/net/shibboleth/utilities/java/support/xml/DOMTypeSupport.java
index c128f52..dc1566b 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/xml/DOMTypeSupport.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/xml/DOMTypeSupport.java
@@ -158,7 +158,7 @@ public final class DOMTypeSupport {
try {
dataTypeFactory = DatatypeFactory.newInstance();
baseline = new GregorianCalendar(1696, 9, 1, 0, 0, 0);
- } catch (DatatypeConfigurationException e) {
+ } catch (final DatatypeConfigurationException e) {
throw new RuntimeException("JVM is required to support XML DatatypeFactory but it does not", e);
}
}
diff --git a/src/main/java/net/shibboleth/utilities/java/support/xml/SchemaBuilder.java b/src/main/java/net/shibboleth/utilities/java/support/xml/SchemaBuilder.java
index 7361c4f..844d028 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/xml/SchemaBuilder.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/xml/SchemaBuilder.java
@@ -275,7 +275,7 @@ public class SchemaBuilder {
try {
addSchema(resource.getInputStream());
- } catch (IOException e) {
+ } catch (final IOException e) {
log.error("IO error adding schema from resource: {}", resource.getDescription(), e);
}
diff --git a/src/main/java/net/shibboleth/utilities/java/support/xml/SerializeSupport.java b/src/main/java/net/shibboleth/utilities/java/support/xml/SerializeSupport.java
index a5dcd9f..c1569c6 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/xml/SerializeSupport.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/xml/SerializeSupport.java
@@ -76,7 +76,7 @@ public final class SerializeSupport {
writeNode(node, baout, serializerParams);
try {
return new String(baout.toByteArray(), "UTF-8");
- } catch (UnsupportedEncodingException e) {
+ } catch (final UnsupportedEncodingException e) {
// all VMs are required to support UTF-8, if it's not something is really wrong
throw new RuntimeException(e);
}
@@ -97,7 +97,7 @@ public final class SerializeSupport {
writeNode(node, baout, prettyPrintParams);
try {
return new String(baout.toByteArray(), "UTF-8");
- } catch (UnsupportedEncodingException e) {
+ } catch (final UnsupportedEncodingException e) {
// all VMs are required to support UTF-8, if it's not something is really wrong
throw new RuntimeException(e);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list