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:22 UTC
[camel] 09/09: (chores) camel-swagger-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 850df98da478096f347e13d53cedcd4026aa6757
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Oct 18 16:55:13 2022 +0200
(chores) camel-swagger-java: use standard check for exception type in catch blocks
---
.../java/org/apache/camel/swagger/RestSwaggerReader.java | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java
index 22161ddd336..0a4e6389fb8 100644
--- a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java
+++ b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java
@@ -473,20 +473,16 @@ public class RestSwaggerReader {
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);
}
}