[spring-extensions] branch master updated: Update Eclipse settings and fix warnings.
Scott Cantor
cantor.2 at osu.edu
Fri Aug 2 13:18:52 EDT 2019
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch master
in repository spring-extensions.
View the commit online:
http://git.shibboleth.net/view/?p=spring-extensions.git;a=commit;h=72e5e2efbff49af851c7bfa82d4effa6a57d2681
The following commit(s) were added to refs/heads/master by this push:
new 72e5e2e Update Eclipse settings and fix warnings.
72e5e2e is described below
commit 72e5e2efbff49af851c7bfa82d4effa6a57d2681
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Aug 2 13:18:44 2019 -0400
Update Eclipse settings and fix warnings.
---
.settings/org.eclipse.jdt.core.prefs | 73 ++++++++++++++++++++--
.settings/org.eclipse.jdt.launching.prefs | 3 +
.../spring/config/StringToDurationConverter.java | 6 +-
.../ext/spring/error/ErrorRaisingController.java | 4 +-
.../ext/spring/factory/HttpClientFactoryBean.java | 4 +-
.../InMemoryCachingHttpClientFactoryBean.java | 4 +-
.../factory/PKCS11PrivateKeyFactoryBean.java | 6 +-
.../ext/spring/factory/PatternFactoryBean.java | 14 ++---
.../ext/spring/factory/ProxiedFactoryBean.java | 4 +-
.../spring/resource/FileBackedHTTPResource.java | 4 +-
.../ext/spring/resource/HTTPResource.java | 2 +-
.../util/AbstractSpringExpressionEvaluator.java | 15 ++++-
.../shibboleth/ext/spring/util/SpringSupport.java | 4 +-
.../ext/spring/velocity/VelocityView.java | 4 +-
.../ext/spring/resource/RunnableResourceTest.java | 18 +-----
.../spring/service/ReloadableBeanServiceTest.java | 12 ++--
.../service/ReloadableSpringServiceTest.java | 20 +++---
.../spring/service/TestServiceableComponent.java | 4 +-
18 files changed, 122 insertions(+), 79 deletions(-)
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index 6063eee..7fa508c 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -1,5 +1,14 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=ignore
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.mainOnlyProjectHasTestOnlyDependency=error
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
org.eclipse.jdt.core.codeComplete.fieldPrefixes=
@@ -10,22 +19,38 @@ org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
+org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=info
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
@@ -33,45 +58,79 @@ org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=info
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
+org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=info
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=info
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=11
@@ -350,3 +409,5 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/.settings/org.eclipse.jdt.launching.prefs b/.settings/org.eclipse.jdt.launching.prefs
new file mode 100644
index 0000000..f8a131b
--- /dev/null
+++ b/.settings/org.eclipse.jdt.launching.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.launching.PREF_COMPILER_COMPLIANCE_DOES_NOT_MATCH_JRE=warning
+org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning
diff --git a/src/main/java/net/shibboleth/ext/spring/config/StringToDurationConverter.java b/src/main/java/net/shibboleth/ext/spring/config/StringToDurationConverter.java
index 4c8e9bd..5d0167d 100644
--- a/src/main/java/net/shibboleth/ext/spring/config/StringToDurationConverter.java
+++ b/src/main/java/net/shibboleth/ext/spring/config/StringToDurationConverter.java
@@ -32,10 +32,10 @@ public class StringToDurationConverter implements Converter<String,Duration> {
public Duration convert(final String source) {
if (source.startsWith("P") || source.startsWith("-P")) {
return DOMTypeSupport.stringToDuration(source.trim());
- } else {
- // Treat as milliseconds.
- return Duration.ofMillis(Long.valueOf(source));
}
+
+ // Treat as milliseconds.
+ return Duration.ofMillis(Long.valueOf(source));
}
}
\ No newline at end of file
diff --git a/src/main/java/net/shibboleth/ext/spring/error/ErrorRaisingController.java b/src/main/java/net/shibboleth/ext/spring/error/ErrorRaisingController.java
index e35a024..0ecdc63 100644
--- a/src/main/java/net/shibboleth/ext/spring/error/ErrorRaisingController.java
+++ b/src/main/java/net/shibboleth/ext/spring/error/ErrorRaisingController.java
@@ -55,9 +55,9 @@ public class ErrorRaisingController {
log.error("Propagating exception thrown by request to {}", uri);
if (e.getCause() != null) {
throw e.getCause();
- } else {
- throw e;
}
+
+ throw e;
}
// Checkstyle: IllegalThrows ON
diff --git a/src/main/java/net/shibboleth/ext/spring/factory/HttpClientFactoryBean.java b/src/main/java/net/shibboleth/ext/spring/factory/HttpClientFactoryBean.java
index 5f6c487..ec2d616 100644
--- a/src/main/java/net/shibboleth/ext/spring/factory/HttpClientFactoryBean.java
+++ b/src/main/java/net/shibboleth/ext/spring/factory/HttpClientFactoryBean.java
@@ -69,9 +69,9 @@ public class HttpClientFactoryBean extends HttpClientBuilder implements FactoryB
singletonInstance = buildClient();
return singletonInstance;
- } else {
- return buildClient();
}
+
+ return buildClient();
}
}
\ No newline at end of file
diff --git a/src/main/java/net/shibboleth/ext/spring/factory/InMemoryCachingHttpClientFactoryBean.java b/src/main/java/net/shibboleth/ext/spring/factory/InMemoryCachingHttpClientFactoryBean.java
index 6641385..272dd96 100644
--- a/src/main/java/net/shibboleth/ext/spring/factory/InMemoryCachingHttpClientFactoryBean.java
+++ b/src/main/java/net/shibboleth/ext/spring/factory/InMemoryCachingHttpClientFactoryBean.java
@@ -70,9 +70,9 @@ public class InMemoryCachingHttpClientFactoryBean extends InMemoryCachingHttpCli
singletonInstance = buildClient();
return singletonInstance;
- } else {
- return buildClient();
}
+
+ return buildClient();
}
}
\ No newline at end of file
diff --git a/src/main/java/net/shibboleth/ext/spring/factory/PKCS11PrivateKeyFactoryBean.java b/src/main/java/net/shibboleth/ext/spring/factory/PKCS11PrivateKeyFactoryBean.java
index 4de8139..369d491 100644
--- a/src/main/java/net/shibboleth/ext/spring/factory/PKCS11PrivateKeyFactoryBean.java
+++ b/src/main/java/net/shibboleth/ext/spring/factory/PKCS11PrivateKeyFactoryBean.java
@@ -126,9 +126,9 @@ public class PKCS11PrivateKeyFactoryBean implements FactoryBean<PrivateKey> {
if (provider == null) {
final ClassLoader loader = PKCS11PrivateKeyFactoryBean.class.getClassLoader();
try {
- final Class<Provider> providerClass = (Class<Provider>) loader.loadClass(PROVIDER_CLASS_NAME);
- final Constructor<Provider> providerConstructor = providerClass.getConstructor(String.class);
- provider = providerConstructor.newInstance(pkcs11Config);
+ final Class<?> providerClass = loader.loadClass(PROVIDER_CLASS_NAME);
+ final Constructor<?> providerConstructor = providerClass.getConstructor(String.class);
+ provider = (Provider) providerConstructor.newInstance(pkcs11Config);
Security.addProvider(provider);
} catch (final ClassNotFoundException e) {
throw new NoSuchProviderException("unable to load keystore provider class " + PROVIDER_CLASS_NAME);
diff --git a/src/main/java/net/shibboleth/ext/spring/factory/PatternFactoryBean.java b/src/main/java/net/shibboleth/ext/spring/factory/PatternFactoryBean.java
index 0a993a8..732576b 100644
--- a/src/main/java/net/shibboleth/ext/spring/factory/PatternFactoryBean.java
+++ b/src/main/java/net/shibboleth/ext/spring/factory/PatternFactoryBean.java
@@ -82,19 +82,15 @@ public class PatternFactoryBean extends AbstractComponentAwareFactoryBean<Patter
@Override protected Pattern doCreateInstance() throws Exception {
Constraint.isNotNull(regexp, "Regular expression cannot be null");
- final Boolean isCaseSentitive;
+ final Boolean isCaseSensitive;
if (caseSensitive != null) {
- isCaseSentitive = StringSupport.booleanOf(caseSensitive);
- Constraint.isNotNull(isCaseSentitive, "caseSensitive cannot be null");
+ isCaseSensitive = StringSupport.booleanOf(caseSensitive);
+ Constraint.isNotNull(isCaseSensitive, "caseSensitive cannot be null");
} else {
- isCaseSentitive = true;
+ isCaseSensitive = true;
}
- if (isCaseSentitive) {
- return Pattern.compile(regexp, 0);
- } else {
- return Pattern.compile(regexp, Pattern.CASE_INSENSITIVE);
- }
+ return Pattern.compile(regexp, isCaseSensitive ? 0 : Pattern.CASE_INSENSITIVE);
}
}
\ No newline at end of file
diff --git a/src/main/java/net/shibboleth/ext/spring/factory/ProxiedFactoryBean.java b/src/main/java/net/shibboleth/ext/spring/factory/ProxiedFactoryBean.java
index 263a53f..6129329 100644
--- a/src/main/java/net/shibboleth/ext/spring/factory/ProxiedFactoryBean.java
+++ b/src/main/java/net/shibboleth/ext/spring/factory/ProxiedFactoryBean.java
@@ -134,9 +134,9 @@ public class ProxiedFactoryBean<T> extends AbstractFactoryBean<T> {
}
throw e;
}
- } else {
- return component.getComponent().getBean(beanType);
}
+
+ return component.getComponent().getBean(beanType);
} finally {
component.unpinComponent();
}
diff --git a/src/main/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResource.java b/src/main/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResource.java
index fa0e2dd..3c1dfb7 100644
--- a/src/main/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResource.java
+++ b/src/main/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResource.java
@@ -145,8 +145,7 @@ public class FileBackedHTTPResource extends HTTPResource {
*/
protected InputStream saveAndClone(final InputStream input) throws IOException {
- final FileOutputStream out = new FileOutputStream(backingResource.getFile());
- try {
+ try (final FileOutputStream out = new FileOutputStream(backingResource.getFile())) {
log.debug("{}: Copying file.", getDescription());
ByteStreams.copy(input, out);
log.debug("{}: Copy done.", getDescription());
@@ -157,7 +156,6 @@ public class FileBackedHTTPResource extends HTTPResource {
throw e;
} finally {
input.close();
- out.close();
}
return new FileInputStream(backingResource.getFile());
}
diff --git a/src/main/java/net/shibboleth/ext/spring/resource/HTTPResource.java b/src/main/java/net/shibboleth/ext/spring/resource/HTTPResource.java
index a818183..5667b40 100644
--- a/src/main/java/net/shibboleth/ext/spring/resource/HTTPResource.java
+++ b/src/main/java/net/shibboleth/ext/spring/resource/HTTPResource.java
@@ -425,7 +425,7 @@ public class HTTPResource extends AbstractIdentifiedInitializableComponent imple
/** {@inheritDoc} */
@Override
- public void mark(final int readLimit) {
+ public synchronized void mark(final int readLimit) {
stream.mark(readLimit);
}
diff --git a/src/main/java/net/shibboleth/ext/spring/util/AbstractSpringExpressionEvaluator.java b/src/main/java/net/shibboleth/ext/spring/util/AbstractSpringExpressionEvaluator.java
index 56c9ed0..9953a21 100644
--- a/src/main/java/net/shibboleth/ext/spring/util/AbstractSpringExpressionEvaluator.java
+++ b/src/main/java/net/shibboleth/ext/spring/util/AbstractSpringExpressionEvaluator.java
@@ -174,10 +174,19 @@ public abstract class AbstractSpringExpressionEvaluator<T, U> {
prepareContext(context, input);
final Object output = parser.parseExpression(springExpression).getValue(context);
- if (null != getOutputType() && null != output && !getOutputType().isInstance(output)) {
- log.error("Output of type {} was not of type {}", output.getClass(), getOutputType());
- return returnOnError;
+ if (output == null) {
+ return null;
+ }
+
+ if (null != getOutputType()) {
+ if (!getOutputType().isInstance(output)) {
+ log.error("Output of type {} was not of type {}", output.getClass(), getOutputType());
+ return returnOnError;
+ }
+
+ return getOutputType().cast(output);
}
+
return (U) output;
} catch (final ParseException|EvaluationException e) {
log.error("Error evaluating Spring expression", e);
diff --git a/src/main/java/net/shibboleth/ext/spring/util/SpringSupport.java b/src/main/java/net/shibboleth/ext/spring/util/SpringSupport.java
index 6eed363..b5b0bc2 100644
--- a/src/main/java/net/shibboleth/ext/spring/util/SpringSupport.java
+++ b/src/main/java/net/shibboleth/ext/spring/util/SpringSupport.java
@@ -228,9 +228,9 @@ public final class SpringSupport {
XMLConstants.XSI_SCHEMA_LOCATION_ATTRIB_NAME.getPrefix() + ':'
+ XMLConstants.XSI_SCHEMA_LOCATION_ATTRIB_NAME.getLocalPart(), schemaLoc);
break;
- } else {
- parent = parent.getParentNode();
}
+
+ parent = parent.getParentNode();
}
}
diff --git a/src/main/java/net/shibboleth/ext/spring/velocity/VelocityView.java b/src/main/java/net/shibboleth/ext/spring/velocity/VelocityView.java
index 325db6f..6e5d56b 100644
--- a/src/main/java/net/shibboleth/ext/spring/velocity/VelocityView.java
+++ b/src/main/java/net/shibboleth/ext/spring/velocity/VelocityView.java
@@ -312,9 +312,9 @@ public class VelocityView extends AbstractTemplateView {
// cache templates in this class is a minor optimization only.
if (isCacheTemplate() && template != null) {
return template;
- } else {
- return getTemplate(getUrl());
}
+
+ return getTemplate(getUrl());
}
/**
diff --git a/src/test/java/net/shibboleth/ext/spring/resource/RunnableResourceTest.java b/src/test/java/net/shibboleth/ext/spring/resource/RunnableResourceTest.java
index 9579688..472a4f5 100644
--- a/src/test/java/net/shibboleth/ext/spring/resource/RunnableResourceTest.java
+++ b/src/test/java/net/shibboleth/ext/spring/resource/RunnableResourceTest.java
@@ -62,16 +62,9 @@ public class RunnableResourceTest {
}
private byte getValue(final Resource resource) throws IOException {
- InputStream io = null;
- try {
- io = resource.getInputStream();
+ try (final InputStream io = resource.getInputStream()) {
return (byte) io.read();
}
- finally {
- if ( null != io) {
- io.close();
- }
- }
}
@BeforeMethod public void reset() {
@@ -177,10 +170,7 @@ public class RunnableResourceTest {
}
public void update() throws IOException {
- FileOutputStream io = null;
- try {
- io = new FileOutputStream(theFile);
-
+ try (final FileOutputStream io = new FileOutputStream(theFile)) {
io.write(count);
if (count == 127 ) {
@@ -188,10 +178,6 @@ public class RunnableResourceTest {
}
count++;
updated = true;
- } finally {
- if (null != io) {
- io.close();
- }
}
}
diff --git a/src/test/java/net/shibboleth/ext/spring/service/ReloadableBeanServiceTest.java b/src/test/java/net/shibboleth/ext/spring/service/ReloadableBeanServiceTest.java
index 50a5711..3d8e463 100644
--- a/src/test/java/net/shibboleth/ext/spring/service/ReloadableBeanServiceTest.java
+++ b/src/test/java/net/shibboleth/ext/spring/service/ReloadableBeanServiceTest.java
@@ -35,19 +35,18 @@ public class ReloadableBeanServiceTest {
@Test public void reloadableService() throws IOException, InterruptedException {
- final GenericApplicationContext appCtx = new ApplicationContextBuilder()
+ try (final GenericApplicationContext appCtx = new ApplicationContextBuilder()
.setName("appCtx")
.setServiceConfigurations(Collections.<Resource>singletonList(
new ClassPathResource("net/shibboleth/ext/spring/service/ReloadableBeans1.xml")))
- .build();
-
- try {
+ .build()) {
final NonReloadableTestBean bean = appCtx.getBean("nonReloadableBean", NonReloadableTestBean.class);
Assert.assertEquals(10, bean.getValue());
final ReloadableTestBean child1 = bean.getChild();
- final ReloadableService<ApplicationContext> embedded = (ReloadableService<ApplicationContext>) appCtx.getBean("reloadableBeanService");
+ final ReloadableService<ApplicationContext> embedded =
+ appCtx.getBean("reloadableBeanService", ReloadableService.class);
final ServiceableComponent<ApplicationContext> component = embedded.getServiceableComponent();
try {
@@ -61,9 +60,6 @@ public class ReloadableBeanServiceTest {
final ReloadableTestBean child2 = bean.getChild();
Assert.assertNotSame(child1, child2);
-
- } finally {
- appCtx.close();
}
}
diff --git a/src/test/java/net/shibboleth/ext/spring/service/ReloadableSpringServiceTest.java b/src/test/java/net/shibboleth/ext/spring/service/ReloadableSpringServiceTest.java
index 7c2ea55..c842df2 100644
--- a/src/test/java/net/shibboleth/ext/spring/service/ReloadableSpringServiceTest.java
+++ b/src/test/java/net/shibboleth/ext/spring/service/ReloadableSpringServiceTest.java
@@ -65,9 +65,9 @@ public class ReloadableSpringServiceTest {
}
private void overwriteFileWith(final String newDataPath) throws IOException {
- final OutputStream stream = new FileOutputStream(testFile);
- ByteStreams.copy(new ClassPathResource(newDataPath).getInputStream(), stream);
- stream.close();
+ try (final OutputStream stream = new FileOutputStream(testFile)) {
+ ByteStreams.copy(new ClassPathResource(newDataPath).getInputStream(), stream);
+ }
}
@Test(enabled=true) public void reloadableService() throws IOException, InterruptedException {
@@ -247,16 +247,13 @@ public class ReloadableSpringServiceTest {
final Resource parentResource = new ClassPathResource("net/shibboleth/ext/spring/service/ReloadableSpringService.xml");
- final GenericApplicationContext appCtx = new ApplicationContextBuilder()
+ try (final GenericApplicationContext appCtx = new ApplicationContextBuilder()
.setName("appCtx")
.setServiceConfigurations(Collections.singletonList(parentResource))
- .build();
- try {
+ .build()) {
final ReloadableSpringService<?> service = appCtx.getBean("testReloadableSpringService", ReloadableSpringService.class);
Assert.assertNotNull(service.getParentContext(), "Parent context should not be null");
- } finally {
- appCtx.close();
}
}
@@ -264,11 +261,10 @@ public class ReloadableSpringServiceTest {
final Resource parentResource = new ClassPathResource("net/shibboleth/ext/spring/service/ReloadableSpringService.xml");
- final GenericApplicationContext appCtx = new ApplicationContextBuilder()
+ try (final GenericApplicationContext appCtx = new ApplicationContextBuilder()
.setName("appCtx")
.setServiceConfigurations(Collections.singletonList(parentResource))
- .build();
- try {
+ .build()) {
final ReloadableSpringService<?> service1 =
appCtx.getBean("testReloadableSpringService", ReloadableSpringService.class);
Assert.assertEquals(service1.getId(), "testReloadableSpringService");
@@ -276,8 +272,6 @@ public class ReloadableSpringServiceTest {
final ReloadableSpringService<?> service2 =
appCtx.getBean("testReloadableSpringServiceWithCustomID", ReloadableSpringService.class);
Assert.assertEquals(service2.getId(), "CustomID");
- } finally {
- appCtx.close();
}
}
diff --git a/src/test/java/net/shibboleth/ext/spring/service/TestServiceableComponent.java b/src/test/java/net/shibboleth/ext/spring/service/TestServiceableComponent.java
index c511833..ebc0848 100644
--- a/src/test/java/net/shibboleth/ext/spring/service/TestServiceableComponent.java
+++ b/src/test/java/net/shibboleth/ext/spring/service/TestServiceableComponent.java
@@ -42,8 +42,8 @@ public class TestServiceableComponent extends AbstractServiceableComponent<TestS
/**
* @param theValue The theValue to set.
*/
- public void setTheValue(final String theValue) {
- this.theValue = theValue;
+ public void setTheValue(final String value) {
+ theValue = value;
}
}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list