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

[camel] 08/09: (chores) camel-openapi-java: 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 6d0bba942974413788968ef09e5fe126b4c4259b
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Oct 18 16:54:38 2022 +0200

    (chores) camel-openapi-java: use standard check for exception type in catch blocks
---
 .../main/java/org/apache/camel/openapi/RestOpenApiReader.java  | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestOpenApiReader.java b/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestOpenApiReader.java
index 2716f6806a1..e6ed424d6fc 100644
--- a/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestOpenApiReader.java
+++ b/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestOpenApiReader.java
@@ -1082,18 +1082,16 @@ public class RestOpenApiReader {
             final List<?> values = allowableValues.stream().map(v -> {
                 try {
                     return valueOf.invoke(v);
+                } catch (RuntimeException e) {
+                    throw e;
                 } catch (Throwable e) {
-                    if (e instanceof RuntimeException) {
-                        throw (RuntimeException) e;
-                    }
                     throw new IllegalStateException(e);
                 }
             }).collect(Collectors.toList());
             setEnum.invoke(values);
+        } catch (RuntimeException e) {
+            throw e;
         } catch (Throwable e) {
-            if (e instanceof RuntimeException) {
-                throw (RuntimeException) e;
-            }
             throw new IllegalStateException(e);
         }
     }