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

@@ -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>");
}