Remove Exception from IOS.onInit()

This commit is contained in:
Gary Russell
2018-12-21 17:01:35 -05:00
committed by Artem Bilan
parent 81b4ea1bef
commit 113a371f2c
63 changed files with 118 additions and 94 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-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.
@@ -35,6 +35,7 @@ import org.springframework.util.Assert;
/**
* @author Mark Fisher
* @author Artem Bilan
* @author Gary Russell
*
* @since 2.1
*/
@@ -207,7 +208,7 @@ public abstract class AbstractAmqpChannel extends AbstractMessageChannel
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
if (!this.initialized && this.rabbitTemplate != null) {
if (this.connectionFactory != null) {

View File

@@ -160,7 +160,7 @@ abstract class AbstractSubscribableAmqpChannel extends AbstractAmqpChannel
}
@Override
public void onInit() throws Exception {
public void onInit() {
super.onInit();
this.dispatcher = this.createDispatcher();
if (this.maxSubscribers == null) {

View File

@@ -138,7 +138,7 @@ public class PollableAmqpChannel extends AbstractAmqpChannel
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
AmqpTemplate amqpTemplate = getAmqpTemplate();
if (this.queue == null) {
if (getAdmin() == null && amqpTemplate instanceof RabbitTemplate) {

View File

@@ -182,7 +182,7 @@ public class AmqpInboundGateway extends MessagingGatewaySupport {
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
if (this.retryTemplate != null) {
Assert.state(getErrorChannel() == null, "Cannot have an 'errorChannel' property when a 'RetryTemplate' is "
+ "provided; use an 'ErrorMessageSendingRecoverer' in the 'recoveryCallback' property to "

View File

@@ -311,7 +311,7 @@ public abstract class AbstractCorrelatingMessageHandler extends AbstractMessageP
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
Assert.state(!(this.discardChannelName != null && this.discardChannel != null),
"'discardChannelName' and 'discardChannel' are mutually exclusive.");

View File

@@ -352,7 +352,7 @@ public abstract class AbstractMessageChannel extends IntegrationObjectSupport
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
if (this.messageConverter == null) {
if (getBeanFactory() != null) {

View File

@@ -118,7 +118,7 @@ public class DefaultHeaderChannelRegistry extends IntegrationObjectSupport
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
Assert.notNull(getTaskScheduler(), "a task scheduler is required");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-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.
@@ -82,7 +82,7 @@ public class DirectChannel extends AbstractSubscribableChannel {
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
if (this.maxSubscribers == null) {
Integer maxSubscribers = this.getIntegrationProperty(IntegrationProperties.CHANNELS_MAX_UNICAST_SUBSCRIBERS, Integer.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-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.
@@ -98,7 +98,7 @@ public class ExecutorChannel extends AbstractExecutorChannel {
}
@Override
public final void onInit() throws Exception {
public final void onInit() {
Assert.state(getDispatcher().getHandlerCount() == 0, "You cannot subscribe() until the channel "
+ "bean is fully initialized by the framework. Do not subscribe in a @Bean definition");
super.onInit();

View File

@@ -126,10 +126,9 @@ public class PublishSubscribeChannel extends AbstractExecutorChannel {
/**
* Callback method for initialization.
* @throws Exception the exception.
*/
@Override
public final void onInit() throws Exception {
public final void onInit() {
super.onInit();
if (this.executor != null) {
Assert.state(getDispatcher().getHandlerCount() == 0,

View File

@@ -194,9 +194,8 @@ public abstract class IntegrationObjectSupport implements BeanNameAware, NamedCo
/**
* Subclasses may implement this for initialization logic.
* @throws Exception Any exception.
*/
protected void onInit() throws Exception {
protected void onInit() {
}
/**

View File

@@ -37,6 +37,7 @@ import org.springframework.util.StringUtils;
* @param <R> the {@link AbstractMappingMessageRouter} implementation type.
*
* @author Artem Bilan
* @author Gary Russell
*
* @since 5.0
*/
@@ -198,7 +199,7 @@ public final class RouterSpec<K, R extends AbstractMappingMessageRouter>
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
ConversionService conversionService = getConversionService();
if (conversionService == null) {

View File

@@ -95,7 +95,7 @@ public abstract class AbstractEndpoint extends IntegrationObjectSupport
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
if (!this.autoStartupSetExplicitly) {

View File

@@ -121,7 +121,7 @@ public class ReactiveStreamsConsumer extends AbstractEndpoint implements Integra
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
if (this.errorHandler == null) {
Assert.notNull(getBeanFactory(), "BeanFactory is required");
@@ -138,11 +138,13 @@ public class ReactiveStreamsConsumer extends AbstractEndpoint implements Integra
private final Subscriber<Message<?>> delegate = ReactiveStreamsConsumer.this.subscriber;
@Override
public void hookOnSubscribe(Subscription s) {
this.delegate.onSubscribe(s);
ReactiveStreamsConsumer.this.subscription = s;
}
@Override
public void hookOnNext(Message<?> message) {
try {
this.delegate.onNext(message);
@@ -153,10 +155,12 @@ public class ReactiveStreamsConsumer extends AbstractEndpoint implements Integra
}
}
@Override
public void hookOnError(Throwable t) {
this.delegate.onError(t);
}
@Override
public void hookOnComplete() {
this.delegate.onComplete();
}
@@ -182,7 +186,7 @@ public class ReactiveStreamsConsumer extends AbstractEndpoint implements Integra
private Subscription subscription;
private MessageHandler messageHandler;
private final MessageHandler messageHandler;
MessageHandlerSubscriber(MessageHandler messageHandler) {
Assert.notNull(messageHandler, "'messageHandler' must not be null");

View File

@@ -330,7 +330,7 @@ public abstract class MessagingGatewaySupport extends AbstractEndpoint
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
Assert.state(!(this.requestChannelName != null && this.requestChannel != null),
"'requestChannelName' and 'requestChannel' are mutually exclusive.");
Assert.state(!(this.replyChannelName != null && this.replyChannel != null),

View File

@@ -133,7 +133,7 @@ public abstract class AbstractMessageHandler extends IntegrationObjectSupport
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
if (this.statsEnabled) {
this.handlerMetrics.setFullStatsEnabled(true);
}

View File

@@ -192,7 +192,7 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
Assert.state(!(this.outputChannelName != null && this.outputChannel != null), //NOSONAR (inconsistent sync)
"'outputChannelName' and 'outputChannel' are mutually exclusive.");

View File

@@ -88,7 +88,7 @@ public abstract class AbstractReplyProducingMessageHandler extends AbstractMessa
@Override
protected final void onInit() throws Exception {
protected final void onInit() {
super.onInit();
initAdvisedRequestHandlerIfAny();
doInit();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-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.
@@ -53,7 +53,7 @@ public class ExpressionEvaluatingMessageHandler extends AbstractMessageHandler {
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
this.processor.setBeanFactory(getBeanFactory());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-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.
@@ -164,7 +164,7 @@ public class LoggingHandler extends AbstractMessageHandler {
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-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.
@@ -91,7 +91,7 @@ public class MessageHandlerChain extends AbstractMessageProducingHandler impleme
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
synchronized (this.initializationMonitor) {
if (!this.initialized) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-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.
@@ -199,7 +199,7 @@ public class ExpressionEvaluatingRequestHandlerAdvice extends AbstractRequestHan
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
if (this.getBeanFactory() != null) {
this.messagingTemplate.setBeanFactory(this.getBeanFactory());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-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.
@@ -66,7 +66,7 @@ public class RequestHandlerRetryAdvice extends AbstractRequestHandlerAdvice
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
this.retryTemplate.registerListener(this);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-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.
@@ -47,7 +47,7 @@ class AbstractMessageProcessingRouter extends AbstractMappingMessageRouter
@Override
public final void onInit() throws Exception {
public final void onInit() {
super.onInit();
if (this.messageProcessor instanceof AbstractMessageProcessor) {
ConversionService conversionService = getConversionService();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-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.
@@ -147,7 +147,7 @@ public abstract class AbstractMessageRouter extends AbstractMessageHandler imple
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
Assert.state(!(this.defaultOutputChannelName != null && this.defaultOutputChannel != null),
"'defaultOutputChannelName' and 'defaultOutputChannel' are mutually exclusive.");

View File

@@ -105,7 +105,7 @@ public class ErrorMessageExceptionTypeRouter extends AbstractMappingMessageRoute
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
populateClassNameMapping(this.channelMappings.keySet());
this.initialized = true;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-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.
@@ -69,6 +69,7 @@ import org.springframework.util.StringUtils;
* @author Oleg Zhurakousky
* @author Artem Bilan
* @author Liujiong
* @author Gary Russell
*/
public class RecipientListRouter extends AbstractMessageRouter
implements InitializingBean, RecipientListRouterManagement {
@@ -257,7 +258,7 @@ public class RecipientListRouter extends AbstractMessageRouter
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
this.recipients.forEach(recipient -> recipient.setChannelResolver(getChannelResolver()));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-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.
@@ -107,21 +107,24 @@ public class ExpressionEvaluatingTransactionSynchronizationProcessor extends Int
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
if (this.evaluationContext == null) {
this.evaluationContext = createEvaluationContext();
}
}
@Override
public void processBeforeCommit(IntegrationResourceHolder holder) {
doProcess(holder, this.beforeCommitExpression, this.beforeCommitChannel, "beforeCommit");
}
@Override
public void processAfterCommit(IntegrationResourceHolder holder) {
doProcess(holder, this.afterCommitExpression, this.afterCommitChannel, "afterCommit");
}
@Override
public void processAfterRollback(IntegrationResourceHolder holder) {
doProcess(holder, this.afterRollbackExpression, this.afterRollbackChannel, "afterRollback");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 the original author or authors.
* Copyright 2015-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.
@@ -72,7 +72,7 @@ public class DecodingTransformer<T> extends AbstractTransformer {
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
if (this.evaluationContext == null) {
this.evaluationContext = IntegrationContextUtils.getEvaluationContext(getBeanFactory());
}

View File

@@ -160,7 +160,7 @@ public class HeaderEnricher extends IntegrationObjectSupport implements Transfor
}
@Override
public void onInit() throws Exception {
public void onInit() {
boolean shouldOverwrite = this.defaultOverwrite;
boolean checkReadOnlyHeaders = getMessageBuilderFactory() instanceof DefaultMessageBuilderFactory;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-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.
@@ -58,7 +58,7 @@ public class HeaderFilter extends IntegrationObjectSupport implements Transforme
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
if (getMessageBuilderFactory() instanceof DefaultMessageBuilderFactory) {
for (String header : this.headersToRemove) {

View File

@@ -53,7 +53,7 @@ public class PayloadTypeConvertingTransformer<T, U> extends AbstractPayloadTrans
}
@Override
protected void onInit() throws Exception { // NOSONAR thrown by super class
protected void onInit() {
super.onInit();
Assert.notNull(this.converter, () -> getClass().getName() + " requires a Converter<Object, Object>");
}

View File

@@ -238,7 +238,7 @@ public class RemoteFileTemplate<F> implements RemoteFileOperations<F>, Initializ
}
@Override
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
BeanFactory beanFactory = this.beanFactory;
if (beanFactory != null) {
if (this.directoryExpressionProcessor != null) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-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.
@@ -194,7 +194,7 @@ public class FileTransferringMessageHandler<F> extends AbstractMessageHandler {
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
this.remoteFileTemplate.setBeanFactory(this.getBeanFactory());
this.remoteFileTemplate.afterPropertiesSet();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-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.
@@ -69,7 +69,7 @@ public class CacheWritingMessageHandler extends AbstractMessageHandler {
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
this.gemfireTemplate.afterPropertiesSet();
this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory());

View File

@@ -256,7 +256,7 @@ public class BaseHttpInboundEndpoint extends MessagingGatewaySupport implements
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
validateSupportedMethods();

View File

@@ -141,7 +141,7 @@ public class HttpRequestHandlingController extends HttpRequestHandlingEndpointSu
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
this.evaluationContext = this.createEvaluationContext();
}

View File

@@ -218,7 +218,7 @@ public abstract class HttpRequestHandlingEndpointSupport extends BaseHttpInbound
* was called with true after the converters were set.
*/
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
BeanFactory beanFactory = getBeanFactory();
if (this.multipartResolver == null && beanFactory != null) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-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.
@@ -198,7 +198,7 @@ public class TcpInboundGateway extends MessagingGatewaySupport implements
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
if (this.isClientMode) {
Assert.notNull(this.clientConnectionFactory,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-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.
@@ -227,7 +227,7 @@ public class TcpSendingMessageHandler extends AbstractMessageHandler implements
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
if (this.isClientMode) {
Assert.notNull(this.clientConnectionFactory,

View File

@@ -499,7 +499,7 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
if (!this.mapperSet) {
this.mapper.setBeanFactory(this.getBeanFactory());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-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.
@@ -49,7 +49,7 @@ public class FailoverClientConnectionFactory extends AbstractClientConnectionFac
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
for (AbstractClientConnectionFactory factory : this.factories) {
Assert.state(!(this.isSingleUse() ^ factory.isSingleUse()),

View File

@@ -480,7 +480,7 @@ public class UnicastSendingMessageHandler extends
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
this.mapper.setBeanFactory(getBeanFactory());
this.evaluationContext = IntegrationContextUtils.getEvaluationContext(getBeanFactory());

View File

@@ -156,7 +156,7 @@ public class JdbcMessageHandler extends AbstractMessageHandler {
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
Assert.state(!(this.sqlParameterSourceFactory != null && this.preparedStatementSetter != null),
"'sqlParameterSourceFactory' and 'preparedStatementSetter' are mutually exclusive.");

View File

@@ -80,7 +80,7 @@ public class JmsInboundGateway extends MessagingGatewaySupport implements Dispos
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
this.endpoint.afterPropertiesSet();
}

View File

@@ -89,7 +89,7 @@ public class SubscribableJmsChannel extends AbstractJmsChannel
}
@Override
public void onInit() throws Exception {
public void onInit() {
if (this.initialized) {
return;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-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.
@@ -106,7 +106,7 @@ public class NotificationPublishingMessageHandler extends AbstractMessageHandler
}
@Override
public final void onInit() throws Exception {
public final void onInit() {
Assert.isTrue(this.getBeanFactory() instanceof ListableBeanFactory, "A ListableBeanFactory is required.");
Map<String, MBeanExporter> exporters = BeanFactoryUtils.beansOfTypeIncludingAncestors(
(ListableBeanFactory) this.getBeanFactory(), MBeanExporter.class);

View File

@@ -565,7 +565,7 @@ public abstract class AbstractMailReceiver extends IntegrationObjectSupport impl
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
this.folderOpenMode = Folder.READ_WRITE;
this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory());

View File

@@ -130,7 +130,7 @@ public class ImapMailReceiver extends AbstractMailReceiver {
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
this.scheduler = getTaskScheduler();
if (this.scheduler == null) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2007-2016 the original author or authors.
* Copyright 2007-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.
@@ -34,6 +34,7 @@ import org.springframework.util.Assert;
*
* @author Amol Nayak
* @author Oleg Zhurakousky
* @author Gary Russell
* @since 2.2
*
*/
@@ -104,7 +105,7 @@ public class MongoDbStoringMessageHandler extends AbstractMessageHandler {
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
this.evaluationContext =
ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory());
if (this.mongoTemplate == null) {

View File

@@ -213,7 +213,7 @@ public abstract class AbstractMqttMessageHandler extends AbstractMessageHandler
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
if (this.topicProcessor instanceof BeanFactoryAware && getBeanFactory() != null) {
((BeanFactoryAware) this.topicProcessor).setBeanFactory(getBeanFactory());

View File

@@ -133,7 +133,7 @@ public class MqttPahoMessageHandler extends AbstractMqttMessageHandler
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
Assert.state(getConverter() instanceof MqttMessageConverter,
"MessageConverter must be an MqttMessageConverter");

View File

@@ -131,7 +131,7 @@ public class SubscribableRedisChannel extends AbstractMessageChannel
}
@Override
public void onInit() throws Exception {
public void onInit() {
if (this.initialized) {
return;
}

View File

@@ -141,7 +141,7 @@ public class RedisQueueInboundGateway extends MessagingGatewaySupport implements
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
if (!this.extractPayload) {
Assert.notNull(this.serializer, "'serializer' has to be provided where 'extractPayload == false'.");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-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.
@@ -99,7 +99,7 @@ public class RedisQueueOutboundChannelAdapter extends AbstractMessageHandler {
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
if (this.evaluationContext == null) {
this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory());

View File

@@ -240,7 +240,7 @@ public class RedisStoreWritingMessageHandler extends AbstractMessageHandler {
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
this.evaluationContext =
ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory());
Assert.state(!this.mapKeyExpressionExplicitlySet ||

View File

@@ -16,6 +16,7 @@
package org.springframework.integration.rmi;
import java.rmi.RemoteException;
import java.rmi.registry.Registry;
import org.springframework.beans.factory.InitializingBean;
@@ -35,6 +36,7 @@ import org.springframework.util.StringUtils;
*
* @author Mark Fisher
* @author Artem Bilan
* @author Gary Russell
*/
public class RmiInboundGateway extends MessagingGatewaySupport
implements RequestReplyExchanger, InitializingBean {
@@ -102,7 +104,7 @@ public class RmiInboundGateway extends MessagingGatewaySupport
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
if (this.registryHost != null) {
@@ -115,7 +117,12 @@ public class RmiInboundGateway extends MessagingGatewaySupport
this.exporter.setService(this);
this.exporter.setServiceInterface(RequestReplyExchanger.class);
this.exporter.setServiceName(SERVICE_NAME_PREFIX + this.requestChannelName);
this.exporter.afterPropertiesSet();
try {
this.exporter.afterPropertiesSet();
}
catch (RemoteException e) {
throw new IllegalStateException(e);
}
}
@Override

View File

@@ -120,7 +120,7 @@ public class StompMessageHandler extends AbstractMessageHandler implements Appli
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
if (this.evaluationContext == null) {

View File

@@ -116,7 +116,7 @@ public class WebSocketOutboundMessageHandler extends AbstractMessageHandler {
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
if (!CollectionUtils.isEmpty(this.messageConverters)) {
List<MessageConverter> converters = this.messageConverter.getConverters();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-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.
@@ -87,7 +87,7 @@ public class MarshallingWebServiceInboundGateway extends AbstractWebServiceInbou
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
Assert.notNull(this.marshaller, "This implementation requires Marshaller");
Assert.notNull(this.unmarshaller, "This implementation requires Unmarshaller");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-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.
@@ -70,7 +70,7 @@ public abstract class AbstractXmlTransformer extends AbstractTransformer {
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
ResultFactory generatedResultFactory = configureResultFactory(this.resultType, this.resultFactoryName, this.getBeanFactory());
if (generatedResultFactory != null) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-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.
@@ -25,6 +25,7 @@ import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
@@ -213,7 +214,7 @@ public class XsltPayloadTransformer extends AbstractXmlTransformer implements Be
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory());
if (this.templates == null) {
@@ -224,7 +225,12 @@ public class XsltPayloadTransformer extends AbstractXmlTransformer implements Be
else {
transformerFactory = TransformerFactory.newInstance();
}
this.templates = transformerFactory.newTemplates(createStreamSourceOnResource(this.xslResource));
try {
this.templates = transformerFactory.newTemplates(createStreamSourceOnResource(this.xslResource));
}
catch (TransformerConfigurationException | IOException e) {
throw new IllegalStateException(e);
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-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.
@@ -25,6 +25,7 @@ import org.springframework.util.Assert;
/**
* @author Oleg Zhurakousky
* @author Artem Bilan
* @author Gary Russell
* @since 2.0
*/
public abstract class AbstractXmppConnectionAwareMessageHandler extends AbstractMessageHandler {
@@ -43,7 +44,8 @@ public abstract class AbstractXmppConnectionAwareMessageHandler extends Abstract
}
protected void onInit() throws Exception {
@Override
protected void onInit() {
BeanFactory beanFactory = this.getBeanFactory();
if (this.xmppConnection == null && beanFactory != null) {
this.xmppConnection =