GH-3418: Fix Poller Undeclared Checked Exceptions

Resolves https://github.com/spring-projects/spring-integration/issues/3418

`Class.newInstance()` can propagate checked exceptions that are not declared.

**cherry-pick/back-port to 5.3.x, 5.2.x, 4.3.x**
This commit is contained in:
Gary Russell
2020-10-30 15:57:36 -04:00
committed by Artem Bilan
parent 04f89f5421
commit 13807eeb38
2 changed files with 119 additions and 2 deletions

View File

@@ -58,6 +58,7 @@ import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ErrorHandler;
import org.springframework.util.ReflectionUtils;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -402,7 +403,7 @@ public abstract class AbstractPollingEndpoint extends AbstractEndpoint implement
private Message<?> doPoll() {
IntegrationResourceHolder holder = bindResourceHolderIfNecessary(getResourceKey(), getResourceToBind());
Message<?> message;
Message<?> message = null;
try {
message = receiveMessage();
}
@@ -414,7 +415,7 @@ public abstract class AbstractPollingEndpoint extends AbstractEndpoint implement
return null;
}
else {
throw (RuntimeException) e;
ReflectionUtils.rethrowRuntimeException(e);
}
}