Sonar Fixes

Critical smells, packages `o.s.i.a*` to `f*`.

Plus new smells caused by these changes.
This commit is contained in:
Gary Russell
2018-11-29 16:29:34 -05:00
committed by Artem Bilan
parent 4ade0ceaf4
commit 62fc7df693
45 changed files with 188 additions and 140 deletions

View File

@@ -448,9 +448,8 @@ public class FileWritingMessageHandler extends AbstractReplyProducingMessageHand
this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory());
if (this.destinationDirectoryExpression instanceof LiteralExpression) {
final File directory =
new File(this.destinationDirectoryExpression.getValue(this.evaluationContext, String.class));
final File directory = ExpressionUtils.expressionToFile(this.destinationDirectoryExpression,
this.evaluationContext, null, "destinationDirectoryExpression");
validateDestinationDirectory(directory, this.autoCreateDirectory);
}

View File

@@ -253,7 +253,7 @@ public class FileTailInboundChannelAdapterFactoryBean extends AbstractFactoryBea
adapter.setApplicationEventPublisher(this.applicationEventPublisher);
}
if (getBeanFactory() != null) {
adapter.setBeanFactory(getBeanFactory());
adapter.setBeanFactory(getBeanFactory()); // NOSONAR never null
}
adapter.afterPropertiesSet();
this.adapter = adapter;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017 the original author or authors.
* Copyright 2017-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,6 +30,7 @@ import org.springframework.util.Assert;
* A SpEL expression based {@link AbstractFileListFilter} implementation.
*
* @author Artem Bilan
* @author Gary Russell
*
* @since 5.0
*/
@@ -61,7 +62,8 @@ public class ExpressionFileListFilter<F> extends AbstractFileListFilter<F>
@Override
public boolean accept(F file) {
return this.expression.getValue(getEvaluationContext(), file, Boolean.class);
Boolean pass = this.expression.getValue(getEvaluationContext(), file, Boolean.class);
return pass == null ? false : pass;
}
private EvaluationContext getEvaluationContext() {

View File

@@ -536,7 +536,9 @@ public abstract class AbstractRemoteFileOutboundGateway<F> extends AbstractReply
|| Command.MGET.equals(this.command)) {
Assert.notNull(this.localDirectoryExpression, "localDirectory must not be null");
if (this.localDirectoryExpression instanceof ValueExpression) {
File localDirectory = this.localDirectoryExpression.getValue(File.class);
File localDirectory = ExpressionUtils.expressionToFile(this.localDirectoryExpression,
ExpressionUtils.createStandardEvaluationContext(getBeanFactory()), null,
"localDirectoryExpression");
try {
if (!localDirectory.exists()) {
if (this.autoCreateLocalDirectory) {