You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2022/10/19 07:17:19 UTC
[camel] 06/09: (chores) camel-spring-xml: use standard check for exception type in catch blocks
This is an automated email from the ASF dual-hosted git repository.
orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit edd109b5e5cfc5d0bdee7c300590760399ec2d79
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Oct 18 16:53:16 2022 +0200
(chores) camel-spring-xml: use standard check for exception type in catch blocks
---
.../org/apache/camel/spring/xml/CamelBeanPostProcessor.java | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/components/camel-spring-xml/src/main/java/org/apache/camel/spring/xml/CamelBeanPostProcessor.java b/components/camel-spring-xml/src/main/java/org/apache/camel/spring/xml/CamelBeanPostProcessor.java
index 9a34cf35d22..7bd845be278 100644
--- a/components/camel-spring-xml/src/main/java/org/apache/camel/spring/xml/CamelBeanPostProcessor.java
+++ b/components/camel-spring-xml/src/main/java/org/apache/camel/spring/xml/CamelBeanPostProcessor.java
@@ -170,11 +170,9 @@ public class CamelBeanPostProcessor
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
try {
return delegate.postProcessBeforeInitialization(bean, beanName);
+ } catch (BeansException e) {
+ throw e; // do not wrap already beans exceptions
} catch (Exception e) {
- // do not wrap already beans exceptions
- if (e instanceof BeansException) {
- throw (BeansException) e;
- }
throw new BeanCreationException("Error post processing bean: " + beanName, e);
}
}
@@ -183,11 +181,9 @@ public class CamelBeanPostProcessor
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
try {
return delegate.postProcessAfterInitialization(bean, beanName);
+ } catch (BeansException e) {
+ throw e; // do not wrap already beans exceptions
} catch (Exception e) {
- // do not wrap already beans exceptions
- if (e instanceof BeansException) {
- throw (BeansException) e;
- }
throw new BeanCreationException("Error post processing bean: " + beanName, e);
}
}