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:18 UTC

[camel] 05/09: (chores) camel-spring: 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 8b38194b54fcd57490fbf491bda1d0d9a446c7f0
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Oct 18 16:50:49 2022 +0200

    (chores) camel-spring: use standard check for exception type in catch blocks
---
 .../java/org/apache/camel/spring/spi/CamelBeanPostProcessor.java    | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/spi/CamelBeanPostProcessor.java b/components/camel-spring/src/main/java/org/apache/camel/spring/spi/CamelBeanPostProcessor.java
index e365d8d9137..3c50c04e5e3 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/spi/CamelBeanPostProcessor.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/spi/CamelBeanPostProcessor.java
@@ -171,11 +171,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);
         }
     }